OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Ryu on 28 Dec 2003, 11:43:01
-
Can anyone tell me what's wrong with this?
"KEGSSoldierEB" createunit [getpos pos1, officer1, "sol1 = this; this setbehaviour safe", 0.8, "PRIVATE"]
It creates the unit but not in safe mode. Officer1 is already in safe mode.
cheers
-
The syntax for setbehaviour is unitname setbehaviour "safe".
To get it working you'd put the 'safe' in {}'s
"KEGSSoldierEB" createunit [getpos pos1, officer1, "sol1 = this; this setbehaviour {safe}", 0.8, "PRIVATE"]
like so.
-
No, that doesn't work. No error message but not safe mode
-
If Officer1 is a UNIT, then you're using createunit wrong. Try this:
"KEGSSoldierEB" createunit [getpos pos1, group officer1, "sol1 = this; this setbehaviour {safe}", 0.8, "PRIVATE"]
You have to create units into an existing group (which can be empty of units).
-
If the group was not defined right the unit would not have been created at all I think.
What a puzzle.
Ok, consider this. Maybe the unit is not created to safe mode because the group leader of the group the unit is created in is not in safe mode.(?)
-
:( NO, still no luck. The officer is on patrol and set to safe.
-
The answer is to set the behaviour separate from the createunit command:
"SoldierEB" createunit [getpos officer1, group officer1, "sol1 = this", 0.8, "PRIVATE"]; group officer1 setbehaviour {safe}
You can put the setbehaviour command after all units have been created. This also means you won't have to name each unit as you create it.
-
:)Great, that did it.
BTW I like to name the units I create to deleate them when they are no longer needed.
Thanks guys