if I have a bunch of enemies.. all instances of the same active object.. so how do i diferrentiate between them if i want only one of them to do something. i can understand its easy to do for just one action.. but what if i have different groups for diff ai 'states', and i want one of them to start doing an 'attack' state while the others remain idle.
thanks =
n/a
Assault Andy Administrator
I make other people create vaporware
Registered 29/07/2002
Points 5686
3rd July, 2005 at 02:46:27 -
Each active has it's own Unique identifier called its Fixed Value. However that isn't very helpful if you want to check each object to see if it's doing something. What you want to do is use a loop to scan through each object.
You can use alterable values for things like this. How you'd set it up depends on what you want the enemies to do, but say you have ten enemies. At the start of the frame, you set the enemies' Alterable Value A to random(3). This will set each enemy's Alterable Value A to either 0, 1, or 2. Then you can set separate actions to have enemies shoot if their Alterable Value A is 0, move if it's 1, and eat ice cream if it's 2. Whatever you want. Hope that's helpful.
hmm thanks for the advice but it really doesnt solve my problem.. maybe i need to elaborate:
im making a beat-em up and i need some of the enamies to wait their while others are attacking. then when the attacker dies i need another enemy to run in and take his place,
you can do exactly what defenstrator(damn confusing spelling) said, if the alterable value = 0, make the enemies move towards player, when one enemiy gets close enough to the player, set their alterable value to 1 and attak player, then do a check, and if one of the enemies has an alterable value of 1, set the alterable value of the other enemiess to 3, and when the attacking enemy dies, set the alterable values of the other enemies to 0 to restart the process
here's the process
0 = move towards player
1 = attack player, set enemies with alterable value 0 to 3
3 = stop moving
scan for an alterable value of 1, if alterable value of 1 is apparent, then set all enemies with an alterable value of 0 to 3
when attacking enemy dies, set all enemies with alterable value 3 to 0
and just use the article to learn how to scan through your enemies for their alterable values