Code: Select all
Sub Event_BuffGone
:chkevent
/varcalc GroupMax $group(count)-1
/varcalc BuffCounter $group(count)-1
/for GroupMember 0 to $GroupMax
/if "$GroupClass"=="Warrior" /goto :Tank
/if "$GroupClass"=="Paladin" /goto :Caster
/if "$GroupClass"=="Shadow Knight" /goto :Caster
/if "$GroupClass"=="Bard" /goto :Caster
/if "$GroupClass"=="Monk" /goto :Tank
/if "$GroupClass"=="Rogue" /goto :Tank
/if "$GroupClass"=="Ranger" /goto :Caster
/if "$GroupClass"=="Beastlord" /goto :Caster
/if "$GroupClass"=="Cleric" /goto :Caster
/if "$GroupClass"=="Druid" /goto :Caster
/if "$GroupClass"=="Shaman" /goto :Caster
/if "$GroupClass"=="Enchanter" /goto :Caster
/if "$GroupClass"=="Wizard" /goto :Caster
/if "$GroupClass"=="Necromancer" /goto :Caster
/if "$GroupClass"=="Magician" /goto :Caster
/goto :nextmember
:Tank
/varsub v89 1
/goto :nextmember
:Caster
/if n $group($GroupMember)==$char(id)
/press F1
/varsub v89 1
/if n $group($GroupMember)!=$char(id) /target id $group($GroupMember)
/varsub v89 1
/stand
/delay 11
/face
/g -- Buff -- on %t
/call SpellSub 8 35
/sit
/goto :nextmember
:nextmember
/if n "$BuffCounter"=="0" {
/goto :Main
} else {
/next GroupMember
/goto :chkevent
}
:Main
/call Main
/return Now, what I am attepting to do is build a controlled loop, based on the number of people in the group (which may not always be the same). The script is supposed to check how many people are in the group, and store that as a variable.
The script will check the groupmembers class, and if its a correct class, it will cast the buff on them, subtract one from the variable, and then move on to the next member, and do the same thing. If the player is not of the correct class, it will still subtract one from the variable, and continue on to the next member.
Once that variable is set to 0, the next time through the script, it will return to the main loop, and continue from there.
So far, I've managed to get it to do one of two things.
1. Cast the spell on itself, and return to the main loop*.
2. Never return to the main loop*, eternally cycling through groupmembers, and casting the buff on them.
Any thoughts would be appreciated, in the meantime, Im going to tinker with it some more...
~Ake
*By "main loop", I mean Sub Main :Loop
