OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Babalon on 24 May 2003, 00:59:30

Title: "name"
Post by: Babalon on 24 May 2003, 00:59:30
I'm makeing a script for one of my missions, and I am looking right now for something that will retrieve a units name.

I came across "name" in my command reference, and have two questions.

1) What does "name" do?

2) If it doesn't do what I need, is there a command that does?

IE: Lets say * is the name of the command I'm looking for.  The name of the vehicle is Tank1.

  *  = vehicle

So now in the script vehicle = Tank1.
Title: Re:"name"
Post by: toadlife on 24 May 2003, 01:36:46
putting...

tank1 = this

...in a tank's init feild doesn't make the tanks name "tank1". It makes the tanks ID tank1. The ID is what you can use to reference that tank later in scripts, like so..

tank1 move (getpos player)

Name's that are retrived by the "name" command are either defined by the mission maker in description.ext file, by your player profile, or assigned randomly by the game.

Every unit (AI or human) is assigned a name. Inaminate objects don't get names assigned to them.

To display your name ont he screen you use the name command like so...

_myname = name player
hint format["Hello %1",_myname]

or you could just do it like this...

hint format["Hello %1",name player]