Jump to content
Sign in to follow this  
-XDF-Banksy

Addaction for Group Members

Recommended Posts

Ok I have searched the frums and can't seem to find an answer for what I am trying to achieve. I am setting up a recruit training mission that will have numerous triggers associated for different training areas, and I want to have actions added to the DS staff as we move through the various stands.

The DS Staff will be grouped and here lies my problem, as there are numerous triggers I can't group them to the staff members so I need to set up the addAction to the trigger so when the DS staff enter the action gets added so they can start that particular activity and then when complete they enter another trigger at the end of the activity that removes that action.

So long way around of asking how do I get the trigger to only work for certain members of the group what would I put in the trigger condition or init line to get this to work.

I try to convince myself I know how to do this and then always get stumped somewhere.

Edited by [XDF]Banksy

Share this post


Link to post
Share on other sites

If you find out please let me know, I'm dealing with the same thing. While I have the 'only availble to X people' thing working, vehicle actions are available to anyone OUTSIDE the vehicle too and after respawn everything fails horribly.

Share this post


Link to post
Share on other sites

Just a quick thought. Couldn't you just make it so say, the Group Teamleader gets the actions only by giving him a unique name. Then make the DS Staff people always join as that character?

Looked over the script commands and perhaps getPlayerUID may be of use. Can't play around with it as currently not home. Let us know how you go :)

In theory you should be able to get the unique ID's of the players you wish to have commands on, then if a player with a certain UID is present/triggers a script etc, give him set actions. I am no programmer though, so please correct me if I am leading people down the wrong path.

I guess it depends on whether it is unique per serial or unique per session.

Edited by Snakelet

Share this post


Link to post
Share on other sites

Thought I would update this thread with a solution. Thankfully one of the great scripters norrin noticed my plight and worked with me to solve it, I am going to try an do some justice to his work and post the answer and I do hope I get this right. All I wanted to happen was for a certain person to be able to move into a trigger have an action added then for him to move through and area into another trigger then have the action removed, he then would enter another trigger and that would add another action and so on, so my plight was that I couldn't group the trigger with the player as there were to be numerous triggers that needed a similar effect.

Ok here we go: -

First the init.sqf needed a couple of lines added to it, they are as follows: -

XDFInstructor = [XDF1];

ok the XDFInstructor is only a global name for one or more units, you don't need to group the players in their init lines for this to work the name could be anything you want i.e. Instructor, Killer, etc. and the XDF1 is the player name that will fall into the XDFInstructor parameter this is the player name you set when you put the characters in game i.e. S1, L1 etc. in the player name area you can add more than one name just put a , after each name, that way you may want only selected units to get the addaction.

The next lines in you init.sqf need to be: -

//Global variables defining whether action added or not

SLactionAdded = false;

The SL infront of the actionAdded is just a name in this case SL stands for sneaker lane, so if this was to get in a vehicle it could be IVactionAdded = false; so the IV might stand for in vehicle.

I hope I haven't lost you so far!!

Create a trigger and give it the parrameters you want i.e. blufor, present, (condition) this, (init) nul = [] execVm "addAction_SneakerLane.sqf";

Ok now you need to create your actionAdded .sqf script, obviously you need to give it a name for example mine was actionAdded_SneakerLane.sqf, in the script you need to put the following: -

if (player in XDFInstructor && !SLactionAdded) then {reset_SL = player addAction ["Reset Sneaker Lane", "Sneaker_Lane.sqf"]};

SLactionAdded = true;

Ok so as you can see basically norrin's script says to the pc if player is in the XDFInstructor slot and the SLactionAdded then you need to add the addAction with an id of reset_SL to the player and put Reset Sneaker Lane into his action list and start the scrip Sneaker_Lane.sqf, you also need to set the SLactionAdded to true. This makes the script work. The reason I assign a n id name to the action is because if you don't the system will assign the first action assigned to that charecter a number which is '0' and if you set your trigger to repeat and then run through it will add the action again and assign the next number '1' and so on, even if you set a remove action in another trigger, the game will remember you had an action assigned and give you the next number in the sequence so you would just end up with heaps of the addedactions in your menu, by assigning a name when you remove the action and then re-add again by going through the trigger it will assign the same name so you can remove it again. (sorry hard to explain but I think you will get it)

Now create another trigger somewhere else and: -

blufor, present, (condition)this, (init)nul = [] execVm "removeAction_SneakerLane.sqf";

Right lastly the removeAction script, so once again create a script and call it what ever mine is removeAction_SneakerLane.sqf and in this put the following: -

if (SLactionAdded) then {player removeAction reset_SL};

SLactionAdded = false;

I am not going to explain this as hopefully by now you can figure the bits out.

I hope this is easy to understand I have tried to make it simple as I know sometimes it is hard to work out just how it all goes together. I am not sure how to get the scripts into the page but if anyone wants it pm me and I will send them to you.

Once again I would like to thank norrin who without his help this wouldn't have happened.

Edited by [XDF]Banksy

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  

×