Any way to force a player to attack?

Here you can post threads requesting help on the official POL Ultima Online Emulator Core 096.
Note: Core 096 is no longer officially supported.

Moderator: POL Developer

Post Reply
Poi
Grandmaster Poster
Posts: 298
Joined: Fri Apr 14, 2006 9:36 am

Any way to force a player to attack?

Post by Poi »

I searched the forums and only found a few dead end topics, is there any way to force a player to attack a mobile via script(text command, not use script)?
Terciob
Master Poster
Posts: 90
Joined: Fri Nov 07, 2008 3:47 am

Re: Any way to force a player to attack?

Post by Terciob »

Yeah, you can enable warmode with who.setwarmode(1) and who.attack_once(target) to force a swing from who on a mobile.
Poi
Grandmaster Poster
Posts: 298
Joined: Fri Apr 14, 2006 9:36 am

Re: Any way to force a player to attack?

Post by Poi »

who.attack_once(target) doesn't seem to be working, the war mode works perfectly though..

I could be mistaken, but isn't .attack_once a 97 thing, not 96?
User avatar
CWO
POL Expert
Posts: 1158
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA

Re: Any way to force a player to attack?

Post by CWO »

mobile.attack_once() was implemented in POL098. There is no other way to force someone to attack another.
Poi
Grandmaster Poster
Posts: 298
Joined: Fri Apr 14, 2006 9:36 am

Re: Any way to force a player to attack?

Post by Poi »

Okay, so then I want to ask one more question,

My mainhitscript is set up like this:
MainHitScript(attacker, defender, weapon, armor, basedamage, rawdamage)

How could I use start_script(mainhitscript, params) to run this, as far as I understand start_script only allows for one param, I could use arrays for the startscript but I don't want to change my mainhitscript because I'm not sure how it would affect any other scripts, is there any way to pass multiple variables using start_script or only one?
User avatar
CWO
POL Expert
Posts: 1158
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA

Re: Any way to force a player to attack?

Post by CWO »

Not sure if it will return the completely desired result as you want but you would have to change mainhitscript... What you would do is pass an array with all of the values in their order with start_script then change mainhitscript like this:

Code: Select all

Program MainHitScript(attacker, defender, weapon, armor, basedamage, rawdamage)
     if (TypeOf(attacker) == "Array")
          defender := attacker[2];
          weapon := attacker[3];
          armor := attacker[4];
          basedamage := attacker[5];
          rawdamage := attacker[6];
          attacker := attacker[1]; // Always be sure to set attacker last!
     endif
     // The rest of your MainHitScript code
Poi
Grandmaster Poster
Posts: 298
Joined: Fri Apr 14, 2006 9:36 am

Re: Any way to force a player to attack?

Post by Poi »

That should actually work perfectly!

Now just one more question, how can I get the weapon damage?(I'm not sure what the name of the prop is, ive tried damage, dmg, not sure what else)
:)
User avatar
CWO
POL Expert
Posts: 1158
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA

Re: Any way to force a player to attack?

Post by CWO »

For that you'll have to read the itemdesc.cfg entry for it.

You get basedamage from the random die string. To calculate rawdamage, you'll have to follow the combat pseudocode. What you're looking for is the last IF block on this page http://docs.polserver.com/pol099/attack.php
Poi
Grandmaster Poster
Posts: 298
Joined: Fri Apr 14, 2006 9:36 am

Re: Any way to force a player to attack?

Post by Poi »

Alright thank you a TON, but I have one LAST question(for this topic :D)

When using Start_script how would I go about defining the script location? Will it find it by just using the script name?
User avatar
CWO
POL Expert
Posts: 1158
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA

Re: Any way to force a player to attack?

Post by CWO »

Your hitscript is in a package right? Its the regular :packagename:scriptname... start_script(":package:scriptname", params);
Poi
Grandmaster Poster
Posts: 298
Joined: Fri Apr 14, 2006 9:36 am

Re: Any way to force a player to attack?

Post by Poi »

Awesome thank you, still not working the way I want but Ill figure it out from here, thank you so much :D
:bacondance:
Post Reply