Page 1 of 1

need help with onskill cast and with buff table

Posted: Wed May 08, 2013 4:35 am
by Romplayer

Code: Select all

	<onSkillCast><![CDATA[
		local ii = 1
		while player.Buffs[ii] ~= nil do
			buf = player.Buffs[ii]
			if buf == "621252" then
				player:cast("WARLOCK_PSYCHIC_ARROWS");
				player:cast("WARLOCK_PSYCHIC_ARROWS");
				player:cast("WARLOCK_PSYCHIC_ARROWS");
				player:cast("WARLOCK_PSYCHIC_ARROWS");
				player:cast("WARLOCK_PSYCHIC_ARROWS");
			end
			ii = ii+1
		end
	]]></onSkillCast>
This doesn't seem to work. I'm not sure how the player.Buffs table is setup either. But I am trying to cast a spell a bunch of times if a certain buff gets applied to my character. Would a for statement do better?

Re: need help with onskill cast and with buff table

Posted: Wed May 08, 2013 5:16 am
by rock5
Buffs are saved as table values about that buff, eg. name, id, etc. So "buf" will never equal the id of the buff, but buf.Id will. buf.Id is a number, though, not a string, so this should work

Code: Select all

if buf.Id == 621252 then
Note, though, that this code will run after every skill cast, even when not in combat. You might want to add extra checks such as if in combat.

If you are interested in the buffs table structure you can start the commandline and type the following

Code: Select all

table.print(player.Buffs)