Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Script help.
Script help. [message #376165] Sat, 14 March 2009 08:58 Go to next message
Mark72091 is currently offline  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 Go to previous messageGo to next message
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 #376169 is a reply to message #376165] Sat, 14 March 2009 09:12 Go to previous messageGo to next message
Mark72091 is currently offline  Mark72091
Messages: 12
Registered: August 2006
Karma: 0
Recruit
Server crashes when the script above runs.

I tried commenting the above out and everything works fine.
Re: Script help. [message #376185 is a reply to message #376165] Sat, 14 March 2009 11:23 Go to previous messageGo to next message
Mark72091 is currently offline  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 Go to previous messageGo to next message
Mark72091 is currently offline  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.
Re: Script help. [message #376264 is a reply to message #376165] Sun, 15 March 2009 05:32 Go to previous message
mrãçķz is currently offline  mrãçķz
Messages: 3069
Registered: August 2007
Karma: 0
General (3 Stars)
Permabanned for trying and failing DDoS
Nice idea Smile
Previous Topic: Predator Stealth?
Next Topic: max vehicles
Goto Forum:
  


Current Time: Sat Nov 30 22:30:48 MST 2024

Total time taken to generate the page: 0.00740 seconds