Jump to content
Sign in to follow this  
ShinShin

Help Checking if opfor units/east are Infantry or LandVehicles

Recommended Posts

Hey! Quick help/Question.

I'm having a small bit of trouble now trying to get this bit of script to execute if the conditions are met/true.

I'm wanting to execute this code only if the unit(s) are infantry & if they're a vehicle or in a vehicle then I want it to do nothing.

[Status | Working] (10/29/2013 - 7:30AM)

{
if ((side _x == EAST) && (vehicle _x == _x)) then {
	_x unassignItem "NVGoggles_OPFOR";
	_x removeItem "NVGoggles_OPFOR";
	_x addPrimaryWeaponItem "acc_flashlight";
	_x enableGunLights "forceOn";
	_x setBehaviour "SAFE";
	_x setSkill ["aimingSpeed", 0.60];
	_x setSkill ["endurance", 0.50];
	_x setSkill ["courage", 0.60];
	_x setSkill ["spotTime", 0.50];
}
} forEach allUnits;
Edited by ShinShin

Share this post


Link to post
Share on other sites

Maybe something like

if {(side _x == EAST) and (vehicle _x == _x)} then {

Side equals east and the vehicle of the unit is the unit (so not in a vehicle)

Share this post


Link to post
Share on other sites

RPT is spitting this error out at me and I don't understand why.

{
if {(side _x == EAST) and (vehicle _x ==>
 Error position: <if {(side _x == EAST) and (vehicle _x ==>
 [color="#B22222"]Error if: Type code, expected Bool[/color]
File C:\Users\KALEB\Documents\Arma 3 - Other Profiles\INDIANA\missions\Co13_OperationWhiteKnight.Altis\startUpInit.sqf, line 84

But anyways, tried it your way and that's the result.

Share this post


Link to post
Share on other sites
RPT is spitting this error out at me and I don't understand why.

{
if {(side _x == EAST) and (vehicle _x ==>
 Error position: <if {(side _x == EAST) and (vehicle _x ==>
 [color="#B22222"]Error if: Type code, expected Bool[/color]
File C:\Users\KALEB\Documents\Arma 3 - Other Profiles\INDIANA\missions\Co13_OperationWhiteKnight.Altis\startUpInit.sqf, line 84

But anyways, tried it your way and that's the result.

conditions are stated with regular ()-brackets, code is stated with {}-brackets

{if ((side _x == EAST) && (vehicle _x == _x)) then {YOURCODE}} foreach YOURARRAY;

additionaly, i am not sure if "foreach _x" will work as it is not defined in your example.

Share this post


Link to post
Share on other sites
conditions are stated with regular ()-brackets, code is stated with {}-brackets

{if ((side _x == EAST) && (vehicle _x == _x)) then {YOURCODE}} foreach YOURARRAY;

additionaly, i am not sure if "foreach _x" will work as it is not defined in your example.

Yes, thanks for your Input and I will try it as you've stated.

as for the "_x" part, that wasn't meant to be, was just fiddling around with it way before I made this thread and forgot to change it back to "allUnits;". Hehe :)

Okay, tested your way and it's working great now. Thanks man, for such a small problem It was really frustrating me for the past 3 hours. lmao

Edited by ShinShin
Additional Comment +1

Share this post


Link to post
Share on other sites

Sorry about the confusion dont know how those curly braces got in there all i did was copy your original text and change your isKindOf check to vehicle _x == _x.

You got it sort so all good.

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  

×