Oh, that's clever. Although, I'm not really using this for a game, more like a simple "simulation," so that workaround isn't required. laugh

I have another question, though. At the moment the NPC's are getting in eachother's way trying to get to the enemy, so there's often a line of NPC's running at an enemy, while only one can reach them. Can I add a c_trace somewhere in there, so if an NPC can't see the closest enemy, it chooses the next closest?

EDIT: Alright, I tried something out but it doesn't seem to work. After the NPC sends out a c_scan searching for enemies, if it has found an entity, it does a c_trace from my.x (the npc) to you.x (the entitiy it found). This has ACTIVATE_SHOOT set. On the enemy action, I have emask set to ENABLE_SCAN as well as ENABLE_SHOOT.
Code:
my.emask |= ENABLE_SCAN|ENABLE_SHOOT;


In the enemy_event function I have it check for both of these.
Code:
if(event_type == EVENT_SCAN && EVENT_SHOOT){


So, what I'm thinking is, that if the c_trace can't activate the event_shoot, the NPC is obviously not in line of sight, and it doesn't think this entity is an enemy, which would make the NPC search for others. Problem is, it doesn't work.

I put a wall in front of an NPC. Behind the wall there's an enemy that's considered closer. On the side, there's an enemy that is farther away. If this c_trace were to work, the NPC should go for the enemy that's farther away, but it doesn't. Does the c_trace activate the EVENT_SHOOT even if there's an obstacle in the way? What should I do? D:

Quick replies would be appreciated, because I need to get this thing done. tongue

Last edited by Valdsator; 12/11/11 16:22.