OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: TH on 01 Aug 2004, 16:30:23
-
In mfcti how can i assign a script/scripts to a vehicle as soon as its built at the factory, or build menu...for example when a person builds a flag i want it to be assigned a script.
-
Hi TH !
You can ether give the new object a name and then give the named object the addaction or, if the new object is created next to a known object such as the player, then you can search for the nearest object of that type and assign it that way.
Example 1 -
newObject = "ACamp" createVehicle [_xPos, _yPos, 0]
newObject addAction ["Break Camp", "breakcamp.sqs"]
OR
"ACamp" createVehicle [_xPos, _yPos, 0]
nearestobject [_player, "ACamp"] addAction ["Break Camp", "breakcamp.sqs"]
I prefer the second method, that way I can create multiple versions of the same object without having to give each one a unique name.
Good luck !
Roni
-
thx roni, got it to work a different way... ;D
-
No probs - good luck with it !