Jump to content
Sign in to follow this  
Kolmain

Escape and Evade

Recommended Posts

How would I check if a unit has a weapon and if they are in a vehicle of either West or East?

EDIT: Found this for a weapon:

´ll describe what I did bellow, for the use of others (with less than the basic of scripting)

-Created my unit, OPFOR named "me", in it init Field: this setcaptive true; removeallweapons this;

-Created 4 Blufor soldiers pointing at me

-created some ammoboxes

-Created a trigger type "none", condition: (currentweapon me != "") or (primaryweapon me != "") or (secondaryWeapon me != "");

On act.: me setCaptive false;

On Deac.: me setCaptive true;

I just added the "or (primaryweapon me != "") or (secondaryWeapon me != "")" part because in the specific case, hidden weapons (like a RPG on the back) uncover the unit in my mission.

When previewing it, as soon as you get a weapon, you read it´s respective hint and the enemy AIs starts to shoot. If you drop the weapon, they cease fire.

Edited by Kolmain

Share this post


Link to post
Share on other sites

Ok, you've figured it out for the weapon, heres how to check to see if a unit is in a vehicle:

Its pretty simple

<Name_of_unit> in <Vehicle's_name>
e.g. S1 in myVehicle

If unit "s1" is in "myVehicle", then the expression returns the value "true".

Also, you can use the syntax below to see if a unit has a certain weapon:

<Name_of_unit> hasWeapon "Weapon class"

If the unit does posses the defined weapon (if you put just two "" with nothing inbetween, it should check to see if the unit has no weapons), then the expression returns a value of "true".

Just one thing: I'm not sure if the weapon class should be in single quotes ('') or doule quotes (""), but I'm sure you can just test that quickly.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×