Skip to content

Scripting Help

frugsfrugs Member Posts: 2
Attempting to write a simple AI script for my bard which will allow him play his bard song just before the end of round, whilst attacking his nearest enemy for the rest of it. Unfortunately, my code doesn't seem to behave as expected.

Can someone take a look and tell me what I'm doing wrong?

// Bard song every round IF HotKey(A) Global("attack_n_sing_toggle", "LOCALS", 1) THEN RESPONSE #100 SetGlobal("attack_n_sing_toggle", "LOCALS", 0) END IF HotKey(A) Global("attack_n_sing_toggle", "LOCALS", 0) THEN RESPONSE #100 SetGlobal("attack_n_sing_toggle", "LOCALS", 1) AttackOneRound(NearestEnemyOf(Myself)) Continue() END IF Global("attack_n_sing_toggle", "LOCALS", 1) THEN RESPONSE #100 AttackReevaluate(NearestEnemyOf(Myself), 85) BattleSong() END

Comments

  • prophet1prophet1 Member Posts: 172
    edited January 2014
    The value of the variable you're setting with SetGlobal() won't change until the next AI update cycle. I.e. even though you have Continue() in the second block (and assuming that block gets executed), the third block won't fire until the next time this script is processed from the top.
  • frugsfrugs Member Posts: 2
    Hmmm ok, thanks for your reply prohet :)

    I've updated it so that there's an extra flag for determining whether the first round of attacking has completed, but I'm finding that the script seems to desync from the round timer if my character has to move around between attacks.
Sign In or Register to comment.