Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → actor follow frames
actor follow frames
2001-06-21, 6:51 AM #1
okay i have a cog that is near completed but i need some help. The cog generates an enemy once the player enters sector1 then the enemy is supposed to walk to a thing and then partol between 2 frames that need to loop. Then when the player sees the enemy the enemy is supposed to stop look at the player and then the enemy would attack the player. If the enemy is killed another one is supposed to respawn and start all over again. Then once the player enters sector2 it is supposed to destroy the enemy and it is finished. The problem i have is i can't figure out where i can stick the stuff for the frames where it will loop until the cog is finished.
i need to stick this in there somewhere
Code:
	AiSetMoveThing(enemy, ghost2); //move enemy to ghost position
	AiSetMoveFrame(enemy, 1); //now move enemy along his frames
	AiSetMoveFrame(enemy, 2);
	AiSetMoveFrame(enemy, 1);

here is the rest of the cog where should i stick it
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

also if u see any other errors point them out
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-06-21, 11:28 AM #2
come on guys please it isn't hard i just can't figure out where to put it
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-06-21, 12:02 PM #3
try moving to the first frame, then in the arrived: message checking to make sure it's the stormtrooper and that he's at the right frame, then put the rest of the frame-moving code in. you might have to add another check in the arrived: message to start the whole thing over again.. maybe there's a simpler way, I'm too tired to think of anything else right now [http://forums.massassi.net/html/wink.gif]
2001-06-21, 12:25 PM #4
U must be tired because whatever u said i made no sense of. First of all i don't have an arrived message. U are suggesting that i put one in i assume. I understand what u are sugessting i think but how do i egt these frames to loop until the player is sighted?
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-06-21, 1:59 PM #5
hey thanks for your help but i figured it out. it just suddenly came to me. so i don't need anymore help. unless someone sees some other error
roses are red, violets are blue, I am schizophrenic, and I am too!

↑ Up to the top!