Home   Help Search Login Register  

Author Topic: Invincible Ammo Crates  (Read 1913 times)

0 Members and 1 Guest are viewing this topic.

David555

  • Guest
Invincible Ammo Crates
« on: 16 Mar 2004, 04:48:04 »
Is it possible to make ammo crates Invincible?  Or if not, is there a way to make them respawn with custom weapons every time they are blown up in multiplayer?  I was able to make them respawn but only with their defult weaponry.

Thanks.

RAAH

  • Guest
Re:Invincible Ammo Crates
« Reply #1 on: 16 Mar 2004, 06:56:51 »
Use hit eventhandler and setdammage 0 when they are hit...

try the following in init line of ammoboxes... Not  sure if the syntax is correct though...

this addEventHandler ["hit",{this setdammage 0}]

If it does not work, try changing "this" => "ammoboxname"

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Invincible Ammo Crates
« Reply #2 on: 16 Mar 2004, 17:56:40 »
how much stress does an event handler place on the server, compared to that of a slow looping script or trigger etc.

does it loop to check if the condition is true at the same rate as a trigger or the "@" command.

or more specifically Is:

Having a looping script that say runs a setdammage 0 command on 3 arrays  containing 5 elements each, with say  a 3 second interval between arrays

more or less efficient that having 15 static objects with a hit event handler attached with the same command

« Last Edit: 16 Mar 2004, 17:59:49 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

DBR_ONIX

  • Guest
Re:Invincible Ammo Crates
« Reply #3 on: 16 Mar 2004, 18:38:55 »
The eventhandeler waits for the thing to be hit, then runs..
I don't think it loops

You can have loads of them in a SP map with no slow down.. So I guess it better
- Ben

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Invincible Ammo Crates
« Reply #4 on: 16 Mar 2004, 21:12:34 »
The eventhandeler waits for the thing to be hit, then runs..
I don't think it loops

You can have loads of them in a SP map with no slow down.. So I guess it better
- Ben

Triggers and @statements loop, i believe the rate at which they check for their particular condition is the f.p.s rate

Event handlers must use a similar system so that they know when the event has occured. It may be done in a different way, it may be a slower loop than the fps cycles, who knows

If event handlers are informed that the event has occured in another manner, in a way that doesnt add to cpu stress, then this is great news


If what you are saying is true, that using dozens of eventhandlers doesnt slow the fps down, then that is a great bonus for damage control systems , veh respawns  just about any looping script or trigger that could be replaced by an event handler.

I was always under the impression (Although i had never bothered to check it out) that event handlers were as hungry for cpu time as triggers or @'s
« Last Edit: 16 Mar 2004, 21:20:56 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

David555

  • Guest
Re:Invincible Ammo Crates
« Reply #5 on: 17 Mar 2004, 03:01:15 »
Hey,

Thanks for the replies, I still can't get it to work though.  I tried using

this addEventHandler ["hit",{this setdammage 0}];

with both "this" and "ammoboxname" but the crate still gets blown up.

My problem is with satchel charges.  If you lay satchel charges near it, it gets blown up and becomes unusable.

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Invincible Ammo Crates
« Reply #6 on: 18 Mar 2004, 16:42:02 »
Make an array up with all the object names that you need to have kept in a constant state of repair

eg

Code: [Select]
damcon = [Ac1,Ac2,Ac3,Ac4]
then create a looping script

Code: [Select]
#start
~3
{_x Setdammage 0} forEach damcon
goto "START"

and have it executed from the init.sqs

no need to check the damage state, simply repair  on each loop regardless


Ref the stachel charges, it may be that a hit event cannot be triggered by a satchel charge


easy to check, instead of setting damage 0, simply have the event handler post a hint message on screen, then set a satchel charge off,  if it doesnt post the hint, but it does for say an rpg round, then you know why it isnt working


you could also add the event handler killed to the crate instead
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:Invincible Ammo Crates
« Reply #7 on: 19 Mar 2004, 06:48:13 »
I've always thought that event handlers do cause stress on the server, because they react so fast to the event. It must be near the @ statement or even faster.
Not all is lost.

David555

  • Guest
Re:Invincible Ammo Crates
« Reply #8 on: 24 Mar 2004, 03:54:13 »
Awesome, that got it, thanks guys.  I ended up just using the event handler, if the server runs poorly I might give the script a try.  Replacing the "hit" with "killed" did the trick.