View Single Post
Old 12.02.2006, 22:24   #1
Kirikups
Архивный участник
 
Join Date: Oct 2005
Posts: 175
Default AI - How join SEE_CREATURE() and TIMER_FIRED() ?

Hello all,

i woudl like to link EventHandler SEE_CREATURE(creature) and EventHandler TIMER_FIRED() then i wrote:

Code:
	EventHandler SEE_CREATURE(creature)
	{
		if ((myself.c_ai0 != creature)
		{
			myself.c_ai0 = creature;

			myself.i_ai1 = creature.x;	// i save creature/pc location_x
			myself.i_ai2 = creature.y;	// i save creature/pc location_y
			myself.i_ai3 = creature.z;	// i save creature/pc location_z

			myself.i_ai0 = 0;		// atm NPC dont attack creature/pc

			SetTimerPeriod(5);		// in 5 secs i want to check if PC moved or not
		}
	}

	EventHandler TIMER_FIRED()
	{
		if ((myself.i_ai0 == 0) && (myself.i_ai1 == myself.c_ai0.x) && (myself.i_ai2 == myself.c_ai0.y) && (myself.i_ai3 == myself.c_ai0.z)) {

			Say("Are you sleeping, "+myself.c_ai0.name+" ?");

			AddAttackDesire(myself.c_ai0, @AMT_MOVE_TO_TARGET, 1500);

			myself.i_ai0 = 1;		// action done and must restart for another creature/pc
		}
	}
I want when NPC attack PC if that PC not moved during 5 secs but i have some problems to save creature.x creature.y and creature.z before timer start... a = b, assign incompatible

Regards
Kirikups is offline