Page 1 of 1

<onLeaveCombat> lua code

Posted: Sun May 30, 2010 6:38 pm
by userforum
Hello, i need a little help ... im trying to make a lua code to cast druid_recover when i kill an enemy, since there is a delay to attack another enemy and it somethimes kill me. So, i tried to use the code that comes with the profile :

--if( 15 > userforum.HP/userforum.MaxHP*100 ) then
-- player:cast("DRUID_RECOVER");

but it doesnt work, it says it got a error, can someone help me ? or give me some advice? thank you in advance

Re: <onLeaveCombat> lua code

Posted: Sun May 30, 2010 6:49 pm
by rock5
userforum wrote:Hello, i need a little help ... im trying to make a lua code to cast druid_recover when i kill an enemy, since there is a delay to attack another enemy and it somethimes kill me. So, i tried to use the code that comes with the profile :

--if( 15 > Timbr.HP/Timbr.MaxHP*100 ) then
-- player:cast("DRUID_RECOVER");

but it doesnt work, it says it got a error, can someone help me ? or give me some advice? thank you in advance
I'm guessing your players name is Timbr? That should be "player". Also needs an "end". Try;

Code: Select all

if( 15 > player.HP/player.MaxHP*100 ) then
	player:cast("DRUID_RECOVER");
end;

Re: <onLeaveCombat> lua code

Posted: Sun May 30, 2010 9:10 pm
by userforum
It was just an example, i put a name to example what i need, because letting like player doesn't work...


--if( 15 > player.HP/player.MaxHP*100 ) then
-- player:cast("DRUID_RECOVER");

it doesn't work.

any new idea?
thxxx

Re: <onLeaveCombat> lua code

Posted: Sun May 30, 2010 9:49 pm
by Administrator
You need to take out those "--" in front of those two lines. The "--" basically means "ignore this."

Re: <onLeaveCombat> lua code

Posted: Sun May 30, 2010 10:54 pm
by userforum
humm osrry, i just copy the code on the default profile

but it still doesnt work
since i tried a lot of lua code to make this work, i dont know more what to do

:(

Re: <onLeaveCombat> lua code

Posted: Mon May 31, 2010 2:26 am
by rock5
userforum wrote:humm osrry, i just copy the code on the default profile

but it still doesnt work
since i tried a lot of lua code to make this work, i dont know more what to do

:(
Did you put the "end" after it like I told you too?

Also, what do you mean "doesn't work"? What happens? What do you expect to happen? Did you get an error message?

Re: <onLeaveCombat> lua code

Posted: Mon May 31, 2010 8:58 am
by filipsworks
maybe delete <CDATA... tag?

Re: <onLeaveCombat> lua code

Posted: Tue Jun 01, 2010 1:28 pm
by userforum
doesnt work too.

well, i put the CD on the recover(druid) in 4 seconds, then it will check even if im already healing.

thx for the help

Re: <onLeaveCombat> lua code

Posted: Tue Jun 01, 2010 3:12 pm
by KillerTHC
Try this code it should work.

Code: Select all

if( (player.HP/player.MaxHP*100) < 15) then
	player:cast("DRUID_RECOVER");
else
	return false;
end