OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: MIG on 07 Feb 2005, 10:53:34
-
I have created an object in a certain coordinate using the "createvehicle" command and i want to name it so it can perform a task defined in a script. Of course i could add the object directly in the mission and name it there and after that it could perform the task, but i don't want to make it that way. It has to be created or camcreated and then named. Is there any command to name a camcreated object in a mission?
Here a code sample of what i'm using:
_cord = [1121.944946,3956.699951,1]
_l = "elevator" createvehicle _cord
_l setdir 180.000000
;_l Name / Text is" "
_l exec "\fml_isleobj\scripts\start.sqs"
-
Think you've already done it.
Not much experience of CreateVehicle, but if you CamCreate it the object would be named : _l. If you need the name outside of the script make sure the name is a global variable (without the underscore).
One problem is that you are not passing an array to the script you're calling; _l is an object not an array. Does this work any better:
_cord = [1121.944946,3956.699951,1]
_l = "elevator" CamCreate _cord
_l setdir 180.000000
;_l Name / Text is" "
[_l] exec "\fml_isleobj\scripts\start.sqs"
-
One problem is that you are not passing an array to the script you're calling; _l is an object not an array.
There's no need to pass an array into a script...
You can use
[stuff]
stuff
"stuff"
when using [stuff] the stuff is called in the script by _this select 0
when using just stuff, it's called in the script by _this
Never really used "stuff" (only used it as an empty string when no arguments are passed in the executed script), but I would presume it's also called in the script by _this...
-
Yes, string arguments are also
_this.
-
Thanks to all for the feedback :) I've tryed it and it starts the script. Only small prob: The player is performing the object movement :D