OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: stalin on 31 Mar 2003, 16:15:55

Title: giving a name to a created vehicle
Post by: stalin on 31 Mar 2003, 16:15:55
At one point in my mission I want to create a police jeep.
looks like this:

_jeep1 = "JeepPolice" createvehicle getpos g5

Later in the mission i want to delete it (With another script) . How do i give the jeep a name in the createcehicle script so it can easily be deleted later? :-[
Title: Re:giving a name to a created vehicle
Post by: macguba on 31 Mar 2003, 16:27:35
Check out createUnit in the command ref, that might help.   You can name the unit in the init field.

Looking at your example it seems to me that you have already named your vehicle _jeep1.     Try naming it jeep1 instead and then deleteVehicle jeep1 to see what happens ..... _jeep1 might not work because of the local variable thing.   (variables starting with _ are local, not global.    Would that make a difference here?  I have no idea.   Suck it and see.)
Title: Re:giving a name to a created vehicle
Post by: Cap on 31 Mar 2003, 16:50:16
Or couldn't you have the vehicle already on the map, just on an island out of the way, then use the...

jeep1 setpos (getpos g5)

command. It goes something like that.
Title: Re:giving a name to a created vehicle
Post by: Artak on 31 Mar 2003, 21:31:10
There's something fishy in deleting created units and vehicles. I haven't gotten the hang of it yet, and as for the time being it's impossible for me to delete what I have created.
Title: Re:giving a name to a created vehicle
Post by: stalin on 31 Mar 2003, 21:35:40
yes it's tricky.. I can't even delete the vehicle in the same script that created it using the local variable..

guess I'll work around it by teleporting vehicles to where they are needed for now :)
Title: Re:giving a name to a created vehicle
Post by: LCD on 03 Apr 2003, 19:22:56
lol

name it in global name w/o underscore @ start :P

den delete da jeep1

LCD OUT