OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Mr.T on 15 May 2003, 06:56:01
-
I was wondering if anyone can tell me how to make stock OFP objects such as Player units and vehicles indestructible.
This is for a multiplayer map im making. Is there a line of code that i should include in the objects Init field?
Thanks,
Mr.T
-
Hey
I was just gonna ask this, as in, don't you type :
Alive Unitname
In the condition feild ?
If so, are you SURE it works ?
O Neil ;)
-
Hey
I was just gonna ask this, as in, don't you type :
Alive Unitname
In the condition feild ?
If so, are you SURE it works ?
O Neil ;)
I think that just returnes wether or not that unit is alive... it doesnt make them stay alive....
not sure
-
Oh, yea I had a feeling...
O Neil ;)
-
You could create a script...
_object = _this select 0
#Alive
@getdammage _object < 0.25
_object setdammage 0
~0.01
?!alive _object : goto "end"
goto "alive"
#end
exit
Not sure about the syntax, but at least you'll se where I'm going..
-
put in its init
this addeventhandler ["hit","this setdammage 0"]; this addeventhandler ["killed","this setdammage 0"]
LCD OUT
-
None of these will reliably work becuase when a unit is killed the AI of the unit is completely disbaled, even if you bring it back to life. :-[
A script that constantly sets a units damage to 0, won't save anyone from a bullet to the head.
A script such as knut erics's is the best way to make units really tough...not indestructable but tough.
I'd make the script like this:
#Alive
_object setdammage 0
~0.01
?!alive _object :exit
goto "alive"
-
the engine can take faster loops then that, toadster mate, like:
~0.00000001
or even worse.... it's up to yer CPU/RAM :)
'course, in MP one should prolly keep the slowest PC in mind...
PS - most machines should be able to eat a delay of some ~0.0001
:-*
-
None of these will reliably work becuase when a unit is killed the AI of the unit is completely disbaled, even if you bring it back to life. :-[
A script that constantly sets a units damage to 0, won't save anyone from a bullet to the head.
A script such as knut erics's is the best way to make units really tough...not indestructable but tough.
I'd make the script like this:
#Alive
_object setdammage 0
~0.01
?!alive _object :exit
goto "alive"
Sorry guys im a bit of a n00b at this. Toadlife where would i incude this code int the ext or a sqs file? Can i put it in the units Init field?
Thanks for the input so far.
Much appreciated,
Mr.T
-
ok save this script as "toughguy.sqs", and put it iny our missions folder.
#loop
_this setdammage 0
~0.01
?!alive _this:_this setdammage 1;exit
goto "loop"
For every unit that you want to make tough, put: this exec "toughguy.sqs" in their init feild.
-
Excellent Thanks a bunch!
Finally i might be able to get my map to work.
-
no "[]"?
And Mr T. Are ya da same guy as Mr T at the swedish PCG forum?
-
no "[]"?
No you don't have to pass an array to a script. If you are just passing one variable to a script, why put it inside of an array?
"_this" is the variable that you pass to a script...it can be an array which contains multiple variables, or just a single variable. In the exmaple I posted above, there was only one variable that needed to be passed to the script so there was no need for me to put it inside an array. It saves keystrokes. :)
-
@ toady - i saw somwere dat da eventhandlers work b4 da game itself react2 da death ;) worth checkin isnt it ? ;)
LCD OUT