Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
Citizen Society RPG

Lock Doors (well kind of...)

Recommended Posts

Can someone please help me out by giving me an example of a script that would disable animations for the nearest building/object. All I need is a script that would do such, so that I could create gamelogic in game and place it over the building.

Thank you in advance.

-Alec

Share this post


Link to post
Share on other sites

Place a game logic over the building called place.

It stops all animation however and will prevent visual damage from showing.

buildings = nearestObjects [place, ["building"], 50];{_x enablesimulation false} foreach buildings;

Share this post


Link to post
Share on other sites

Thanks man, I appreciate your reply.

Now to reverse this VIA an action (make the building have animation again), i would need to put what?

Im trying to create some actions and scripts to lock and unlock doors on a building, lol. Thanks again.

-Alec

Share this post


Link to post
Share on other sites

same thing just change the false to true, the script will only fix the doors in position. It won't open or close them.

Share this post


Link to post
Share on other sites

Never mind, it doesn't work man. True = doors can still open. False = doors can still open.

Edited by Citizen Society RPG

Share this post


Link to post
Share on other sites

Well, you can try forcing them closed if someone tries to open them.

_building = _this select 0;
_doors = _this select 1;

_isLocked = {true};
while{alive _building}do{
sleep 0.1;

if(_building call _isLocked)then{
	{
		_door = _X;
		if(_building animationPhase _door != 0)then{_building animate [_door,0]};
	} forEach _doors;
};
};

Give it an array of all the door animation names as the second argument. Also, you can change the code for _isLocked to some other way to determine if the doors are locked (like setVariable/getVariable if it works on buildings).

Btw, chances are this will not stop AI from just walking through the doors.

Edited by Big Dawg KS

Share this post


Link to post
Share on other sites
Sign in to follow this  

×