Jump to content
Sign in to follow this  
snniper

Grabbing what triggers a trigger

Recommended Posts

Hi all, after searching around for an answer I have failed to find one so I decided to ask,Im trying to make a Tanoa mission that has to do with being the right rank to access a store and I am having a trouble with a trigger.  The trigger is to inform a player that they are not the right rank for the store but I cant find a command other than thisTrigger to see what is triggering the trigger.  Im trying to find out what is trigger the trigger because Im comparing its rank ingame to what the store needs to wether it gets access or not. And when I do this I feel like its not grabbing the player that triggers it.

//What I Have in the trigger
nul = [thisTrigger,1] execVM "HG_MSS\checking.sqf";

//What is in the checking.sqf
_math=_this select 0;
_num=_this select 1;
_compare=rankId _math;
if (_compare<=_num) then
{
	hint "You are not a high enough rank to use this shop";
}
else
{
	hint "Welcome to the shop";
};

Thanks In advance.

-Snniper

Share this post


Link to post
Share on other sites

If you're doing a classic shop system, why use triggers? Because addAction in combination with an object like a laptop or whatever is much more reliable considering that you will have access to the caller via _this select 1 in the script that's executed, and triggers are just a nuisance to work with in your case. You have lists like list trigger and such, but filtering out a single unit from it when multiple units are guaranteed to be inside of it is really just adding unnecessary work, plus you'd have to consider locality issues as list only has local effect.

Share this post


Link to post
Share on other sites

Try:

{nul = [_x,1] execVM "HG_MSS\checking.sqf"} forEach thisList

Share this post


Link to post
Share on other sites

Using tryteyker's idea of an addAction, Shopkeeper's init:

this addAction ["Use Shop", "shop.sqf", [], 0, true, true, "", "rankId _this > 1"];

Assuming they are a Sergeant (rankID 2) or higher they'll see the action, otherwise they won't.

Share this post


Link to post
Share on other sites

I am triggered by these triggers. Sorry. I had to. I will have to agree that addactions can offer more flexibility but can be a locality pain depending on how you handle it. { } for each thislist is a great way to access who is in a trigger. Serenas idea works well

Share this post


Link to post
Share on other sites

If you're doing a classic shop system, why use triggers? Because addAction in combination with an object like a laptop or whatever is much more reliable considering that you will have access to the caller via _this select 1 in the script that's executed, and triggers are just a nuisance to work with in your case. You have lists like list trigger and such, but filtering out a single unit from it when multiple units are guaranteed to be inside of it is really just adding unnecessary work, plus you'd have to consider locality issues as list only has local effect.

I am doing what your suggesting with the addaction but I had this trigger setup to tell them if they where the wrong rank or not when they entered the zone but now after reading what you guys said its kind of point less to have this trigger and I think I will just add another add action saying that they are the wrong rank.

 

Thank you for your responses 

Share this post


Link to post
Share on other sites


this addAction [

"Use Shop",

{

if (rankId (_this select 1) <= 1) then {

hint "You are not a high enough rank to use this shop";

} else {

hint "Welcome to the shop";

[_this select 1] call fn_start_shop_or_whatever;

};

}

];

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  

×