PDA

View Full Version : An AI question / problem.


Sdw
16.06.2007, 14:38
I'm trying to make a holy ****ing easy AI and I can't get it to work.

Here is what I'm trying to do :
class 1 giran_guard_clan : guard_stand
{
handler SEE_CREATURE (creature, myself)
{
if((myself->GetLifeTime() > 5 && myself->InMyTerritory(myself.sm) == 1 && creature->pledge_id == 2))
{
myself->AddAttackDesire(creature, 1, 1500);
}
}
}

Compiled version :
class 1 giran_guard_clan : guard_stand

handler 5 25 // SEE_CREATURE
variable_begin
"creature"
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end

push_event // myself
push_const 704
add
fetch_i
func_call 184549406 // func[GetLifeTime]
push_const 5
greater
push_reg_sp
fetch_i
branch_false L300001
push_event // myself
push_const 704
add
fetch_i
push_event // myself
push_const 704
add
fetch_i // sm
push_const 544
add
fetch_i
func_call 184615156 // func[InMyTerritory]
shift_sp -1
push_const 1
equal
and
push_event // creature
push_const 112
add
fetch_i // pledge_id
push_const 792
add
fetch_i4
push_const 2 // clan 2
equal
and
branch_false L300001
L300000
push_event // myself
push_const 704
add
fetch_i
push_event // creature
push_const 112
add
fetch_i
push_const 1
push_const 1500
func_call 184745993 // func[AddAttackDesire]
shift_sp -3
shift_sp -1
L300001
handler_end

class_end

Resulting error :

[+] Incomplete code information
[+] PC=[ 25], ai=[giran_guard_clan],handler=[SEE_CREATURE]

The C1 version I've kept works fine but I can't get it to work in C4, don't know why. It's bothering me since it's so easy & it doesn't work.

Thanks for your help.

FidoW
16.06.2007, 15:31
handler 5 25 // SEE_CREATURE

Thats wrong.

Bloodust
16.06.2007, 16:02
I was looking at ai.obj and there seems to be like 10 different SEE_CREATURE handlers, whats the difference between them ?

ateh
16.06.2007, 16:15
lol? There is just one SEE_CREATURE handler....

Sdw
16.06.2007, 16:19
Handler 5 is right. So I guess the second number is false.
What is it ? Number seems to change, according to ... ? I'll try to guess.

Bloodust
16.06.2007, 16:32
lol? There is just one SEE_CREATURE handler....

Only one my ass lol

handler 5 391 // SEE_CREATURE
handler 5 231 // SEE_CREATURE
handler 5 917 // SEE_CREATURE
handler 5 481 // SEE_CREATURE
handler 5 426 // SEE_CREATURE

5 seems to remain but what are the other numbers then, I cant see the pattern ...

m4rk
16.06.2007, 16:34
number of lines: 54

handler 5 54 // SEE_CREATURE

Sdw
16.06.2007, 16:36
C4 sucks ... Thanks. T_T.

Bloodust
16.06.2007, 16:39
aah, Thanks m4rk, you are truly an information library of L2 server files :P
#include <m4rk.h> O.o