Forum Jump :

Author Message


Posts: 33
Rank:


Level: Member

Country: us
Location: FL , US
Occupation:
Age:
In-game name: R.Danh or darkstaride

 
#1 Posted at 2016-05-04 00:17        
     
So basically what I'm trying to create is that, an addaction will appear when you're near a specific vehicle.
And I don't know how to do it to be honest.. I was thinking of
if (distance > _nearsuv then {
}
or something like that..
//gets user
_unit = player;

//near player 5 meters detect variable
_allsuv = ["SUV_TK_CIV_EP1","SUV_TK_EP1","SUV_UN_EP1","SUV_PMC"];
_nearSUV = nearestobjects [_unit,["_allsuv"],1];
hint "got variables workin boys";

Any help? Thanks!


if (_nearSUV distance _unit > 1) then {
	hint "workin";
}
This works, but it displays errors

Also another question, how do I display an addaction that is attached to a vehicle ?

This post was edited by darkstaride (2016-05-04 00:30, ago)


Author Message


Posts: 1189
Rank:


Level: Member

Country: tr
Location:
Occupation: Computer Science student
Age: 23
In-game name: Wak

 
#2 Posted at 2016-05-04 01:47        
     
The addAction command has a condition field, you can use that.

_allsuv = ["SUV_TK_CIV_EP1", "SUV_TK_EP1", "SUV_UN_EP1", "SUV_PMC"];
_nearSUV = nearestobjects [_unit, ["_allsuv"], 1];
"_allow" is a string above, not a variable. Even if you put it as a variable it whould create 2 arrays inside each other.

_nearSUV = nearestObjects [_unit, _allsuv, 1];
This is a partial fix, because nearestObjects returns an array, so _nearSUV becomes an array (because of this you probably should name it _nearSUVs). You need an object to use the distance command, so we select the first object from that array (the closest).
if ((_nearSUV select 0) distance player > 1) then {
    hint "workin";
};

Sometimes I like to think as I started the whole "earplugs" thing.

W0lle: The only advice I can give you is: Do not try to understand BI. You will not succeed and it only makes your brain go boom. I would even go so far and say that not even they understand their own actions :-D.

#define getDamage getDammage

Advertisement


Author Message


Posts: 33
Rank:


Level: Member

Country: us
Location: FL , US
Occupation:
Age:
In-game name: R.Danh or darkstaride

 
#3 Posted at 2016-05-04 02:29        
     
@654wak654 Thank you for your response, I will test this later today.

Added 11 minutes later:

@654wak654, It works but the addaction I put it doesn't appear. I can just play around with it. Thanks for the help.

This post was edited by darkstaride (2016-05-04 02:40, ago)






Tags: Help, Scripts