OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: GoldGazelle on 05 May 2010, 20:57:16

Title: Naming a Spawned Vehicle
Post by: GoldGazelle on 05 May 2010, 20:57:16
I'd like to say sorry ahead of time to anyone who rolls there eyes after reading this. I am a newbie.

I have a mission where a Bradley APC spawns out side of a town and drives to the town to extract the player back to base. I want the player to have the option of getting into the Bradley or proceeding on foot back to base. What I mean by option is that I don't want to use a Load waypoint for the Bradley and a Get In waypoint for the player.

I would like to use "unitname in vehiclename" in the condition field of the Bradley's waypoint at the town which brings us to my problem. How do I name a spawned vehicle that doesn't exist until a script is executed.

Thank you to anyone who can help,

GoldGazelle

PS  -I am using the "Createunit tutorial by CrashnBurn" for this mission (only using ai_assign.sqs, ai_control.sqs, and tank3.sqs files in my mission folder)
Title: Re: Naming a Spawned Vehicle
Post by: bedges on 05 May 2010, 21:32:24
From the COMREF (http://www.ofpec.com/COMREF/index.php?action=details&id=85&game=OFP):

Quote
"soldierWB" createUnit [getMarkerPos "marker_1", groupAlpha,"loon1 = this ; this addweapon {binocular}", 0.6, "corporal"]
Title: Re: Naming a Spawned Vehicle
Post by: RKurtzDmitriyev on 05 May 2010, 23:05:15
Or, if you're using the createVehicle command, do this

Code: [Select]
newapc = "Bradley" createvehicle someposition

where newapc is the name of your new unit and someposition is the name of the spawning position. The createVehicle command seems to return the name of the created unit, which is why the code above works.
Title: Re: Naming a Spawned Vehicle
Post by: GoldGazelle on 06 May 2010, 05:38:13
Thank you very much,

Everything works the way I wanted it to now. Much appreciation for your help with this.

GoldGazelle