Jump to content
Sneakman480

Keycard for opening doors and gates

Recommended Posts

Hi

 

I dont know how to make a system where any player needs a virtual "keycard" item to be able to open certain doors and gates, if he gets killed or whatever someone else can take the keycard and is able to open the same locked doors and gates.

I have this code but im not sure how to make it work for a vItem. 

 

opendoor = player addaction ["unlock door", {if ((_this select 0) getVariable "var_getkey")) then {home1 setVariable ['bis_disabled_Door_1', 0, true, true]; hint "Door is unlocked now"}}

 

 

Share this post


Link to post
Share on other sites
20 minutes ago, B4v4ri4n_Strik3r said:

With the comparison

(life_inv_keycard > 0)

you can check whether a player has a vItem with variablename keycard in his inventory.

would i add it to this

opendoor = player addaction ["unlock door", {if ((_this select 0) getVariable "var_getkey")) then {home1 setVariable ['bis_disabled_Door_1', 0, true, true]; hint "Door is unlocked now"}}  

somewhere in it?

Share this post


Link to post
Share on other sites

this addAction ["<t color='#0caa41'>Open Gates</t>", {private _gates = [tmp1, tmp2, tmp3, tmp4]; {_x animate ["Door_1_move", 1];} forEach _gates;}, nil, 1, false, true]; this addAction ["<t color='#ff0000'>Close Gate</t>", {private _gates = [tmp1, tmp2, tmp3, tmp4]; {_x animate ["Door_1_move", 0];} forEach _gates;}, nil, 1, false, true]; 
 

I saw this on another guys post for having a few doors working together, so if i wanted to add the check for life_inv_keycard where would it go?

Sorry for all these noob questions, im new to this and stuff makes more sense if i see the solution 😄

Share this post


Link to post
Share on other sites

Take a look at the BI wiki: https://community.bistudio.com/wiki/addAction

addAction.thumb.JPG.6cc9f8646ef0b42852d20c7593248980.JPG

You now can see the point condition. So add your check as condition.

this addAction ["<t color='#0caa41'>Open Gates</t>", {private _gates = [tmp1, tmp2, tmp3, tmp4]; {_x animate ["Door_1_move", 1];} forEach _gates;}, nil, 1, false, true,"",'life_inv_keycard > 0'];
this addAction ["<t color='#ff0000'>Close Gate</t>", {private _gates = [tmp1, tmp2, tmp3, tmp4]; {_x animate ["Door_1_move", 0];} forEach _gates;}, nil, 1, false, true,"",'life_inv_keycard > 0']; 

 

Share this post


Link to post
Share on other sites
On 11/26/2018 at 8:30 AM, B4v4ri4n_Strik3r said:

Take a look at the BI wiki: https://community.bistudio.com/wiki/addAction

addAction.thumb.JPG.6cc9f8646ef0b42852d20c7593248980.JPG

You now can see the point condition. So add your check as condition.

this addAction ["<t color='#0caa41'>Open Gates</t>", {private _gates = [tmp1, tmp2, tmp3, tmp4]; {_x animate ["Door_1_move", 1];} forEach _gates;}, nil, 1, false, true,"",'life_inv_keycard > 0'];
this addAction ["<t color='#ff0000'>Close Gate</t>", {private _gates = [tmp1, tmp2, tmp3, tmp4]; {_x animate ["Door_1_move", 0];} forEach _gates;}, nil, 1, false, true,"",'life_inv_keycard > 0']; 

 

Thank you for all your help :)

 

Though my final problem is that when i lock the doors in editor i can still open them normally in game? How do i stop that?

Share this post


Link to post
Share on other sites
1 hour ago, Sneakman480 said:

Thank you for all your help :)

 

Though my final problem is that when i lock the doors in editor i can still open them normally in game? How do i stop that?

Need to lock them through the life server

Share this post


Link to post
Share on other sites
10 hours ago, JedINyte said:

Need to lock them through the life server

Something to do with this?

/* Setup the federal reserve building(s) */
_dome = nearestObject [[16019.5,16952.9,0],"Land_Dome_Big_F"];
_rsb = nearestObject [[16019.5,16952.9,0],"Land_Research_house_V1_F"];

for "_i" from 1 to 3 do {_dome setVariable[format["bis_disabled_Door_%1",_i],1,true]; _dome animate [format["Door_%1_rot",_i],0];};
_dome setVariable["locked",true,true];
_rsb setVariable["locked",true,true];
_rsb setVariable["bis_disabled_Door_1",1,true];
_dome allowDamage false;
_rsb allowDamage false;

Share this post


Link to post
Share on other sites
2 hours ago, Sneakman480 said:

Something to do with this?

/* Setup the federal reserve building(s) */
_dome = nearestObject [[16019.5,16952.9,0],"Land_Dome_Big_F"];
_rsb = nearestObject [[16019.5,16952.9,0],"Land_Research_house_V1_F"];

for "_i" from 1 to 3 do {_dome setVariable[format["bis_disabled_Door_%1",_i],1,true]; _dome animate [format["Door_%1_rot",_i],0];};
_dome setVariable["locked",true,true];
_rsb setVariable["locked",true,true];
_rsb setVariable["bis_disabled_Door_1",1,true];
_dome allowDamage false;
_rsb allowDamage false;

Yea that's the bit

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×