i need a cog that does this
-The Cog Starts when Walkplayer enters specified sector 1
-The Cog generates enemy1 at thing1
-The enemy then walks to thing2
-The enemy then follows a set of frames over and over again (so he looks like he is patrolling)
-if he sees you he stops the patrol to chase you
-if he dies the cog starts all over again creating enemy1 ...
-The loop ends when Walkplayer enters specified sector 2
this is what i came up with sofar
first of all the thing doesn't work. i am not very good with links so that might be the problem. second of all i can't figure out how to get the enemy to follow frames since he isn't created until the player enters sector1 i need help on this asap this is extremely aggravaiting and would like to get it solved soon
-The Cog Starts when Walkplayer enters specified sector 1
-The Cog generates enemy1 at thing1
-The enemy then walks to thing2
-The enemy then follows a set of frames over and over again (so he looks like he is patrolling)
-if he sees you he stops the patrol to chase you
-if he dies the cog starts all over again creating enemy1 ...
-The loop ends when Walkplayer enters specified sector 2
this is what i came up with sofar
Code:
# ROX Cog Script
#
# ENEMYPATHGENERATOR.COG
#
# Creates enemy and has him follow frames until player is seen.
#
#[Han5678]
symbols
thing player local
thing ghost1
thing ghost2
thing enemy local
template enemy
sector sector1 linkid=1
sector sector2 linkid=2
int cur_num=0 local
int cur_alive=0 local
int generate_num=1 local
int max_alive local
message startup
message entered
message pulse
message killed
message sighted
end
# ========================================================================================
code
starup:
player = GetLocalPlayerThing();
return;
# ........................................................................................
entered:
if (GetSenderId() == 1) //if it is first sector create player
{
SetPulse(1);
}
else if (GetSenderId() == 2) // if it is second sector kill him and call it a day
{
DestroyThing(enemy);
SetPulse(0);
}
return;
# ........................................................................................
pulse:
if((cur_alive < max_alive)) //see if we have room for one more enemy
{
enemy = CreateThing(enemy, ghost1); // if so create him and make it so we can't have any more
CaptureThing(enemy); // enemies
cur_num = cur_num + 1;
cur_alive = cur_alive + 1;
if(cur_num >= generate_num) SetPulse(0);
}
return;
# ........................................................................................
killed:
cur_alive = cur_alive - 1; //if he is killed set pulse to replace him
SetPulse(1);
return;
# ........................................................................................
sighted:
StopThing(enemy); //if the player sees him stop the enemy and make him go after player
AISetInterest(enemy,player);
return;
end
first of all the thing doesn't work. i am not very good with links so that might be the problem. second of all i can't figure out how to get the enemy to follow frames since he isn't created until the player enters sector1 i need help on this asap this is extremely aggravaiting and would like to get it solved soon
roses are red, violets are blue, I am schizophrenic, and I am too!