Hello! I have tried to do automatic fighting macro using !power script, but I have little problem right now. !power {{ --emote|//@{selected|token_name} attacks with his primary weapon...// --charid|@{selected|character_id} --format|playerattack --name|@{selected|Attack|max} --title|Melee Attack --vs.| **@{target|target1|token_name}** --leftsub|Primary Attack [[ [$AN] [[@{selected|Attack}]] + 0d0 ]] --rightsub|Primary Defence [[ [$DN] [[@{target|target1|Defence}]] + 0d0 ]] --Attackthrow:| Primary throw: [[ [$AtkP] 1d20 ]] Secondary throw: [[ [$AtkS] 1d20 ]] --Defence:| Primary throw: [[ [$DefP] 1d20 ]] Secondary throw: [[ [$DefS] 1d20 ]]
--?? $AtkP.total == 1 AND $AtkS.total <= $AN.total ?? Attacker:| Critically hit! [[ [$ANu] 1d1 ]] --?? $AtkP.total == 1 AND $AtkS.total > $AN.total ?? Attacker:| Special hit! [[ [$ANu] (1d1+1) ]] --?? $AtkP.total >= 5 AND $AtkP.total <= $AN.total ?? Attacker:| Normal hit! [[ [$ANu] (1d1+2) ]] --?? $AtkP.total <= 19 AND $AtkP.total > $AN.total ?? Attacker:| Miss! [[ [$ANu] (1d1+3) ]] --?? $AtkP.total == 20 AND $AtkS.total <= $AN.total ?? Attacker:| Miss! [[ [$ANu] (1d1+3) ]] --?? $AtkP.total == 20 AND $AtkS.total > $AN.total ?? Attacker:| FUMBLE! [[ [$ANu] (1d1+4) ]] --?? $AtkP.total >= 2 AND $AtkP.total <= 4 AND $AtkS.total <= $AN.total ?? Attacker:| Special hit! [[ [$ANu] (1d1+1) ]] --?? $AtkP.total >= 2 AND $AtkP.total <= 4 AND $AtkS.total > $AN.total ?? Attacker:| Normal hit! [[ [$ANu] (1d1+2) ]]
--?? $DefP.total == 1 AND $DefS.total <= $DN.total ?? Defender:| Critical defence! [[ [$DNu] 1d1 ]] --?? $DefP.total == 1 AND $DefS.total > $DN.total ?? Defender:| Special defence! [[ [$DNu] (1d1+1) ]] --?? $DefP.total >= 5 AND $DefP.total <= $DN.total ?? Defender:| Normal defence! [[ [$DNu] (1d1+2) ]] --?? $DefP.total <= 19 AND $DefP.total > $DN.total ?? Defender:| Unsuccesful defence! [[ [$DNu] (1d1+3) ]] --?? $DefP.total == 20 AND $DefS.total <= $DN.total ?? Defender:| Unsuccesful defence! [[ [$DNu] (1d1+3) ]] --?? $DefP.total == 20 AND $DefS.total > $DN.total ?? Defender:| FUMBLE! [[ [$DNu] (1d1+4) ]] --?? $DefP.total >= 2 AND $DefP.total <= 4 AND $DefS.total <= $DN.total ?? Defender:| Special defence! [[ [$DNu] (1d1+1) ]] --?? $DefP.total >= 2 AND $DefP.total <= 4 AND $DefS.total > $DN.total ?? Defender:| Normal defence! [[ [$DNu] (1d1+2) ]]
--?? $ANu.total == 2 AND $DNu.total == 2 ?? Struggle:| Normal Damage (shield parry) [[ [$Dama] 0d1+1 ]] --?? $ANu.total == 3 AND $DNu.total == 3 ?? Struggle:| Normal Damage (shield parry) [[ [$Dama] 0d1+2 ]] --?? $ANu.total > 3 AND $DNu.total >= 3 ?? Struggle:| No hit, no damage [[ [$Dama] 0d1+3 ]] --?? $ANu.total > 3 AND $DNu.total < 3 ?? Struggle:| No hit, EXTRA HIT FOR DEFENDER! [[ [$Dama] 0d1+4 ]] --?? $ANu.total <= 3 AND $DNu.total == 1 ?? Struggle:| No damage [[ [$Dama] 0d1+5 ]] --?? $ANu.total == 1 AND $DNu.total == 3 ?? Struggle:| Special damage (no shield parry) [[ [$Dama] 0d1+6 ]] --?? $ANu.total == 1 AND $DNu.total == 2 ?? Struggle:| Normal damage (no shield parry) [[ [$Dama] 0d1+7 ]] --?? $ANu.total == 1 AND $DNu.total > 3 ?? Struggle:| Critical damage (no shield parry) [[ [$Dama] 0d1+8 ]] --?? $ANu.total == 2 AND $DNu.total > 3 ?? Struggle:| Special damage (no shield parry) [[ [$Dama] 0d1+9 ]] --?? $ANu.total == 3 AND $DNu.total > 3 ?? Struggle:| Normal damage (no shield parry) [[ [$Dama] 0d1+10 ]] }} For some reason that Struggle line give always value 2. That means variables ANu and DNu are always 3. In case shown above that value should be 4 (No hit, Extra hit for defender), but for some reason value is still 2. To clarify my script, there are 2 skills which are needed from attribute list - selected|Attack and target|Defence. There is also selected|Attack|max but that contains only type of selected NPC primary weapon (1H Spear in this case). After that there is two 1d20 throws - one for attacker and one for defender (there are also secondary 1d20 throws to both of them which helps to define if attack is critical, special or fumble). Both throw's values are checked and value 1 to 5 is stored as a help variable. So attack throw will be cheked (1=critical hit, 2=special hit, 3=normal hit, 4=miss and 5=fumble) and stored variable ANu (first big if blog in script). After that defence throw will be cheked (1=critical, 2=special, 3=normal defence, 4=unsuccesful defence and 5=fumble) and stored variable DNu (second big if blog in script). Finally (last big if blog in script) there is comparison between variables ANu and DNu which defines what happens, but value is always 2 (Struggle: Normal Damage (shield parry). That means ANu and DNu are always 3. Am I storing values in variables some wrong way? In the picture that ANu variable value should be 4 (in row: attacker: Miss! 4) and DNu variable 1 (in row: defender: Critical defence 1). That means script should select script row --?? $ANu.total > 3 AND $DNu.total < 3 ?? Struggle:| No hit, EXTRA HIT FOR DEFENDER! [[ [$Dama] 0d1+4 ]] and value shown last line should be 4, but that is not the case. Could somebody help me? Is there some error or glitch in my syntax? Thanks in advantage! :)