Script help. [message #376165] |
Sat, 14 March 2009 08:58 |
Mark72091
Messages: 12 Registered: August 2006
Karma: 0
|
Recruit |
|
|
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.
-
Attachment: beacon.txt
(Size: 3.13KB, Downloaded 122 times)
|
|
|
Re: Script help. [message #376166 is a reply to message #376165] |
Sat, 14 March 2009 09:00 |
|
saberhawk
Messages: 1068 Registered: January 2006 Location: ::1
Karma: 0
|
General (1 Star) |
|
|
TehViRuS wrote on Sat, 14 March 2009 11:58 | 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.
|
And the problem is *what* exactly?
|
|
|
|
Re: Script help. [message #376185 is a reply to message #376165] |
Sat, 14 March 2009 11:23 |
Mark72091
Messages: 12 Registered: August 2006
Karma: 0
|
Recruit |
|
|
Ok got a little bit more info on this.
For some reason the script works perfectly fine on City Flying
I left the test server up and a few people were playing on City Flying and they placed a beacon and everything went fine. So I joined in an set the next map to field to try again and see what the issue was and as soon as it detonated it crashed.
Now I have been learning C++ and have quite a few other things complete on my own and this is the only thing that I just can't seem to figure out.
I will continue messing with it but if anyone sees the problem any help would be appreciated.
|
|
|
Re: Script help. [message #376186 is a reply to message #376165] |
Sat, 14 March 2009 11:25 |
Mark72091
Messages: 12 Registered: August 2006
Karma: 0
|
Recruit |
|
|
Well disregard this post...
I changed the script to use
GenericSLNode *x = SmartGameObjList->HeadNode;
Instead and it seems to work.
|
|
|
|