OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: David555 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.
-
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"
-
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
-
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
-
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
-
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.
-
Make an array up with all the object names that you need to have kept in a constant state of repair
eg
damcon = [Ac1,Ac2,Ac3,Ac4]
then create a looping script
#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
-
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.
-
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.