OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: oWn on 14 Mar 2005, 10:00:16
-
Ok, this is how it is...
i have a suicide script with make the soldier explode on death, I've tried to make this work with respawned soldiers to, but is is wath happend:
dude1 dies, explodes as he shoud.
X sec later he respawn. but instead dude1s corpse explodes time after time. (with 15 sec delay ~15)
Now. how to make the new dude1 explode instead?
The script (made orgilany by Armstrong):
________________________
_bomber = _this select 0
_target = _this select 1
_distance = _this select 2
_remove = _this select 3
_combatmode = _this select 4
#start
_bomber setcombatmode "_combatmode"
_bomber setspeedmode "full"
_bomber setunitpos "UP"
~0.001
? hoppaiplasket=_remove : removeallweapons _bomber
#over
_bomber commandmove getpos _target
? (_bomber distance _target) < _distance : goto "booom"
? !(alive _bomber) : goto "booom"
~0.1
? (_bomber distance _target) < _distance : goto "booom"
? !(alive _bomber) : goto "booom"
~0.1
? (_bomber distance _target) < _distance : goto "booom"
? !(alive _bomber) : goto "booom"
~0.1
goto "over"
#booom
bomb="heat120" camcreate getpos _bomber
bomb="shell120" camcreate getpos _bomber
~15
goto "start"
exit
___________
-
Ok, this is how it is...
i have a suicide script with make the soldier explode on death, I've tried to make this work with respawned soldiers to, but is is wath happend:
dude1 dies, explodes as he shoud.
X sec later he respawn. but instead dude1s corpse explodes time after time. (with 15 sec delay ~15)
Now. how to make the new dude1 explode instead?
The script (made orgilany by Armstrong):
________________________
_bomber = _this select 0
_target = _this select 1
_distance = _this select 2
_remove = _this select 3
_combatmode = _this select 4
#start
_bomber setcombatmode "_combatmode"
_bomber setspeedmode "full"
_bomber setunitpos "UP"
~0.001
? (hoppaiplasket == _remove) : removeallweapons _bomber
#over
_bomber commandmove getpos _target
? (_bomber distance _target) < _distance : goto "booom"
? !(alive _bomber) : goto "booom"
~0.1
? (_bomber distance _target) < _distance : goto "booom"
? !(alive _bomber) : goto "booom"
~0.1
? (_bomber distance _target) < _distance : goto "booom"
? !(alive _bomber) : goto "booom"
~0.1
goto "over"
#booom
bomb="heat120" camcreate getpos _bomber
bomb="shell120" camcreate getpos _bomber
~15
goto "start"
exit
___________
its looping because you havent exited the script when the _bomber is dead
I have highlighted the loop in blue
and corrected a line in red
equals to, is represented by ==, not =
what you need to do is createunit a new bomber when the unit dies and attach your script to the new unit
best way to do that is add a killed event handler to the unit and use that to create a new bomber
-
Thanks!
I have removed the loop totaly. One little thing remains:
what you need to do is createunit a new bomber when the unit dies and attach your script to the new unit
best way to do that is add a killed event handler to the unit and use that to create a new bomber
erhm.. How to do this? you have a link or somthing? ???
Ones again Thanks for your help! :D
-
read the comref. it explains how to use the createunit command line