![]() |
|
|
#1 |
|
Архивный участник
Join Date: Oct 2005
Posts: 175
|
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
}
}
Regards
|
|
|
|
|