View Single Post
Old 16.06.2007, 14:38   #1
Sdw
Архивный участник
 
Join Date: Sep 2005
Posts: 150
Default An AI question / problem.

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 :
Code:
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 :
Code:
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 :
Quote:
[+] 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.
Sdw is offline