OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Silencer on 25 Feb 2005, 13:01:47

Title: Detecting vehicles
Post by: Silencer on 25 Feb 2005, 13:01:47
Hi all,

I have created 2 vehicles, this way:

_SkodaRed= "SkodaRed" createvehicle _Coordinates
_SkodaGreen= "SkodaGreen" createvehicle _Coordinates

This works perfect, but I also have made a trigger (somewhere else).

Question 1:  I want to know how to detect: If the car is
                   _SkodaRed or _SkodaGreen. How can I do this?

Question 2:  And how can I remove the (variable) vehicle when
                    it is in the trigger?

Thanks!
Title: Re:Detecting vehicles
Post by: macguba on 25 Feb 2005, 15:15:23
Use a typeOf command in the trigger.    Probably.
Title: Re:Detecting vehicles
Post by: General Barron on 25 Feb 2005, 20:36:36
Or assign the vehicles to GLOBAL variables, instead of LOCAL ones:

SkodaRed= "SkodaRed" createvehicle _Coordinates
SkodaGreen= "SkodaGreen" createvehicle _Coordinates

Now you can refer to those vehicles in ANY script, using their variables (SkodaRed or SkodaGreen).
Title: Re:Detecting vehicles
Post by: Platoon Patton on 25 Feb 2005, 21:10:11
Hmmmmm I think u will have problems m8...

Our Vehicle Respawn script (MP Dedi Server) uses also "Createvehicle",and somehow many commands do not work on a vehicle created with CreateVehicle :(

Getdammage,TypeOf,Fuel...etc do not work.
 try TypeOf  _SkodaRed or Getdammage _SkodaRed -->Hint format["%1",GetDammage _SkodaRed] will give U scalar :/

Atleast thats what i could find out,if somebody has more info pls share ;)

A very Usefull command would be "SetName",assigning a name outside the editor.

A possible workaround is having your car already on the map somewhere hidden and have it setpossed to the place you want when U want.

Then U can use :?(TypeOf Nameof your RedSkoda == "SkodaRed"):hint "Red Skoda spotted :P" Just an example :D

To remove the vehicle in the triggers list I think U need to look after arrays and how to change them.
[5,6,7] = [5,6,7,8] - [8]
Or If U just use 1 vehicle:thislist resize 0

Again,if somebody has more info I am happy to hear :)








Title: Re:Detecting vehicles
Post by: Blanco on 26 Feb 2005, 04:22:45
Quote
Our Vehicle Respawn script (MP Dedi Server) uses also "Createvehicle",and somehow many commands do not work on a vehicle created with CreateVehicle

Well now, that's strange  ???
This should mean you can't create vehicles with createvehicle?

General is Barron is right, make your variables global and you can deletevehicle the cars via a trigger or another script without a problem.
Any local variable in a trigger creates an error (local variable in a local space)
Title: Re:Detecting vehicles
Post by: h- on 26 Feb 2005, 13:29:05
Quote
Our Vehicle Respawn script (MP Dedi Server) uses also "Createvehicle",and somehow many commands do not work on a vehicle created with CreateVehicle
Yeah, that certainly is strange because those commands you mention work just fine in my OFP...