Any way to force a player to attack?
Moderator: POL Developer
Any way to force a player to attack?
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)?
Re: Any way to force a player to attack?
Yeah, you can enable warmode with who.setwarmode(1) and who.attack_once(target) to force a swing from who on a mobile.
Re: Any way to force a player to attack?
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?
I could be mistaken, but isn't .attack_once a 97 thing, not 96?
Re: Any way to force a player to attack?
mobile.attack_once() was implemented in POL098. There is no other way to force someone to attack another.
Re: Any way to force a player to attack?
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?
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?
Re: Any way to force a player to attack?
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
Re: Any way to force a player to attack?
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)

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)

Re: Any way to force a player to attack?
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
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
Re: Any way to force a player to attack?
Alright thank you a TON, but I have one LAST question(for this topic
)
When using Start_script how would I go about defining the script location? Will it find it by just using the script name?

When using Start_script how would I go about defining the script location? Will it find it by just using the script name?
Re: Any way to force a player to attack?
Your hitscript is in a package right? Its the regular :packagename:scriptname... start_script("
scriptname", params);
Re: Any way to force a player to attack?
Awesome thank you, still not working the way I want but Ill figure it out from here, thank you so much 


