OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Gogs on 31 May 2006, 17:02:17

Title: Giving a name to an empty object you have just spawned.
Post by: Gogs on 31 May 2006, 17:02:17
Suppose I'd just spawned an empty vehichle

_APC = "classname" createVehicle getmarkerpos "marker"

or whatever.

Now I want to give this unit an editor name, specifically so that I can set it to a specific heading using setdir. However, I don't have its name, because it hasn't got one, so I can't. Any suggestions?
Title: Re: Giving a name to an empty object you have just spawned.
Post by: srk on 31 May 2006, 17:11:49
Isn't _APC its name? To give it a specific direction, simply write:-

_APC setdir direction
Title: Re: Giving a name to an empty object you have just spawned.
Post by: Gogs on 31 May 2006, 17:16:47
I thought that had to be the objects CFGvehichles class? Thats what it said in the command reference. Am investigating...
Title: Re: Giving a name to an empty object you have just spawned.
Post by: nominesine on 31 May 2006, 17:44:54
Serial Killer is correct. You just baptized your vehicle _APC. That shall forever be its name, from now and until the day it dies.
Title: Re: Giving a name to an empty object you have just spawned.
Post by: Gogs on 31 May 2006, 17:47:19
Quite right. Tested. Shes a beauty. Thanks a lot boys.
Title: Re: Giving a name to an empty object you have just spawned.
Post by: bedges on 31 May 2006, 17:52:39
Quote
You just baptized your vehicle _APC. That shall forever be its name, from now and until the day it dies.

or until the end of the script, surely? _APC is a local variable, so referencing it within the same script will work just fine. outside the script however, it won't be recognised. use APC without the underscore, that makes it a global variable recognised throughout the mission.
Title: Re: Giving a name to an empty object you have just spawned.
Post by: Gogs on 31 May 2006, 19:05:12
Yep yep. That bits easy. I'd already made that assumption. Once again, cheers boys. Anyone know if there is going to be a solved button for this sort of thread on the new forums?