I try implement the item_skill for attacking monster.
But now, I got a problem !
How to got the ID of the monster that the char is attacking ??
I try the "AI::args->{attackID}" !
But, it is not always corret !
Is there something like "char->{attackID}" ?
The item_skill for attacking monster
Moderator: Moderators
-
- Noob
- Posts: 7
- Joined: 24 Sep 2010, 04:27
- Noob?: Yes
- Location: facebook.com/ladysoulless
- Contact:
Re: The item_skill for attacking monster
i used this to identify current attack target..
AI::args->{ID}
AI::args->{ID}
Re: The item_skill for attacking monster
I know this !Soulless wrote:i used this to identify current attack target..
AI::args->{ID}
It is true when the current action is "attack" (AI::action eq 'attack')...
It is false when the current action is not "attack".
For example, bot found a monster to attack, then add a attack task (with the target AI::args->{ID}) to the AI queue.
Then, insert a "rout" or "move" task to AI queue, to move to the target monster.
In this moment ("route" action), the AI::args->{ID} is undefined !
The AI::args->{ID} is definded in the sequece "attack" task !
At this "route" moment, how to get the AI::args->{ID} ??
I found a method as :
Code: Select all
................
my $attackIndex = AI::findAction("attack");
if ($attackIndex ne "") {
my $args = AI::args($attackIndex);
if (defined($args->{'ID'})) {
my $targetID = $args->{'ID'};
................
-
- Developers
- Posts: 1798
- Joined: 05 Dec 2008, 05:42
- Noob?: Yes
Re: The item_skill for attacking monster
AI::findAction is the preferred method, since queue can contain just about everything.
However, if you want to trigger something while attacking, you may want to check for AI::is('attack') - if so, AI::args would refer to attack too.
However, if you want to trigger something while attacking, you may want to check for AI::is('attack') - if so, AI::args would refer to attack too.
Re: The item_skill for attacking monster
Thxs ! I got it !