Jump to content
Sign in to follow this  
Von Quest

How to set Script to run ONLY if X Equipment is worn?

Recommended Posts

Currently working on several odd projects.

1. Can not figure out how you would set it up so your Script would only run if you had or was wearing X. Example: for a possible HALO project, would check to see if you had on a parachute then execVM somescript.sqf to display an Altimeter device (WIP), or Trini's Dive Mate would not run if you did not have on the re-breather, etc.

2. Also was wondering how you could set a certain script to run ONLY for a specific person. Tried Radio Triggers using Group but doesn't work, and just Radio Triggers set alone shows up for everyone instead of intended player. Could of sworn I saw it before but now can't find it.

Share this post


Link to post
Share on other sites

1. : You could execute the "somescript.sqf" script from the init.sqf and then have something like this in the somescript.sqf (I'm not sure if the parachute would be classed as a backpack, but if it does the following code should work) :

while {true} do
{

_BackpackClassname = "ClassNameForParachute";

if ((backpack player) == _BackpackClassname) then
{

	##
	Code For Altimeter
	##
	waitUntil {(backpack player) != _BackpackClassname)};

}
else
{

	waitUntil {(backpack player) == _BackpackClassname};
	##
	Code To Remove Altimeter
	##

};

};

2. : As you've said, Radio Triggers should execute code for every single player within it, so within the code you just have to check if the client that it's currently being executed for is the client you want it to be executed for. It could look something like this :

FNC_CodeForOnePlayer = 
{

_player = _this;
if (player != _player) exitWith {};

##
Code Here
##

};

UnitnameForPlayerHere call FNC_CodeForOnePlayer;

Both of these solutions are untested but I'm just going to assume that they should work with some customization so they better fit your requirements.

Edited by FreakJoe

Share this post


Link to post
Share on other sites
2. Also was wondering how you could set a certain script to run ONLY for a specific person. Tried Radio Triggers using Group but doesn't work, and just Radio Triggers set alone shows up for everyone instead of intended player. Could of sworn I saw it before but now can't find it.
You have to use setRadioMsg on each client that you dont want to see the radio trigger option. TBH dependant on what it is i prefer to use actions as atleast you have more control over targets and callers.

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  

×