OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: DARMARUS on 11 Dec 2002, 01:28:32

Title: Scripted action menus to come back after respawn
Post by: DARMARUS on 11 Dec 2002, 01:28:32
Hello ive just gottin into basic scripting and i noticed that once u add a action to a unit (for instance like a action called "Take syonide", After u resapwn the action does not come back??)   I used a basic script and exec it thru a trigger
Any can help me??
Title: Re:Scripted action menus to come back after respawn
Post by: toadlife on 11 Dec 2002, 19:39:45
Take a look at the resoawn script I have in the ed depot...

http://www.ofpec.com/editors/snippet_view.php?id=166


Here is a shortened version of it, that you can stick your code into (requires >= v1.85). If you don't have resistace you will have to use triggers and a different method.......

Also, notice the quotes around "unitname". The name of the unit MUST be in quotes when inititalizing the script.

["unitname"] exec "thisscript.sqs"
Code: [Select]
;Generic Respawn Script
;Required Version: 1.85
;by toadlife
;toadlife@toadlife.net
;intialize like this: ["unitname"] exec "thisscript.sqs"
;            Or this: ["unitname"] exec "thisscript.sqs"


requiredVersion "1.85"
_name = _this select 0

_unit = call format["%1",_name]


#checklocal
_unit = call format["%1",_name]
?local _unit:goto "respawnloop"
~(1 + (random 3))
goto "checklocal"


#respawnloop
@!alive _unit

@alive call format["%1",_name]
_unit = call format["%1",_name]

;Insert whatever code you want to run on the respawned unit here!! Address the unit as "_unit"
; EXAMPLE: _pee = _unit addaction ["Take a Piss","piddle.sqs"]

goto "respawnloop"