What I am trying to do is create a script that damages all players within a certain distance.
What I am working on is a beacon that does no damage when detonated but damages all players within X distance 2 damage every 2 seconds for 6 runs.
I have done some debugging and this is the section that is causing the problem.
Vector3 pos = Commands->Get_Position(obj);
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Soldier(o)) {
if (Commands->Get_Distance(Commands->Get_Position(o),pos) < 100) {
Commands->Apply_Damage(o,2.0f,"Laser_NoBuilding",false);
}
}
x = x->NodeNext;
}
Attached is all of the code for the beacon.