-
d003232
- Posts: 1252
- Joined: Wed Jun 03, 2009 4:27 pm
#1
Post
by d003232 » Thu Sep 03, 2009 5:24 am
I want to use the <onSkillCast> event for my emergency skills. Simply because if I use the normal skill casting round, it takes very often to long to use the emergency skills. So my idea is, to check for an emergency situation after every cast.
Code: Select all
<onSkillCast>
if( 15 > player.HP/player.MaxHP*100 ) then
player:cast("PRIEST_SOUL_SOURCE");
elseif( 25 > player.HP/player.MaxHP*100 ) then
player:cast("PRIEST_HOLY_AURA");
player:cast("PRIEST_URGENT_HEAL");
player:cast("PRIEST_URGENT_HEAL");
end;
</onSkillCast>
Problems seems now, that the bot also use the '<onSkillCast>' event if he casts allready within <onSkillCast>. So he loop endless.
If I find a little more time, I would/will try to look for a solution.
btw: I couldn't get that coding to work with the '<' symbol. So I turn it around as '>' query.
-
Administrator
- Site Admin
- Posts: 5333
- Joined: Sat Jan 05, 2008 4:21 pm
#2
Post
by Administrator » Thu Sep 03, 2009 7:35 am
Compare arg1.Name with the skill you are casting inside onSkillCast so you know not to try to cast it again. Also, try putting the semicolon in '<' and it should work.
-
d003232
- Posts: 1252
- Joined: Wed Jun 03, 2009 4:27 pm
#3
Post
by d003232 » Thu Sep 03, 2009 3:41 pm
Administrator wrote:Compare arg1.Name with the skill you are casting inside onSkillCast so you know not to try to cast it again.
The bot will now execute the event onSkillCast only if he cast skills directly from the skill list. It will not be executed, if someone cast a skill from within the onSkillCast event. I think that's the easiest solution and I don't think that people need a recursive onSkillCast event.
I could also create a global variable 'onSkillCast_recursiv' ( true | false) or so, witch could easily checked within the event. But if there are no demands for a recursive use, I would prefere the first solution: onSkillCast event only for skills directly from the skill list.
Administrator wrote: Also, try putting the semicolon in '<' and it should work.
Damned, I never noticed that ';'

Who is online
Users browsing this forum: Bing [Bot] and 3 guests