Jump to content
avibird 1

HOW TO SETUP Multiple commands from one trigger an example is in the post.

Recommended Posts

OK I have a another Syntax issue :dontgetit:

I have four groups of POW's of 4 units each.

I have a radio trigger that can Recruit all my POW's into one large group and another to disband them into Individual units. There are only ten radio trigger in the game I don't want to waste them all on recruitment and disband. The issue is I don't want to have to disband all the groups at once just to get the group I need to be individual and I don't want to use up all my in game radio triggers for only this function. I was wondering if there is a way to setup my trigger so what ever group leader call for the disband it will only work for that his group.

 

This is my current trigger setup.

 

Trigger activation - Recruitment of POW groups

      Type -             none

      Activation -    Radio Alpha

      Repeatable

Trigger expression

    Condition -    (player == TC)

   On Activation - [TL1,P1,P2,P3,TL2,P4,P5,P6,TL3,P7,P8,P9,TL4,P10,P11] join TC

 

 

Trigger activation - Disband groups

      Type -             none

      Activation -    Radio Bravo

      Repeatable

Trigger expression

    Condition -     player == TL1 || player == TL2 || player == TL3 || player == TL4 || player == TC;

 

   On Activation - [TL1] join grpNull; [P1] join grpNull; [P2] join grpNull; [P3] join grpNull; [TL2] join grpNull; [P4] join grpNull; [P5] join grpNull; [P6] join grpNull; [TL3] join grpNull; [P7] join grpNull; [P8] join grpNull; [P9] join grpNull; [TL4] join grpNull; [P10] join grpNull; [P11] join grpNull;

 

 

I can make four other radio trigger to disband Individual groups but  can I setup the if I use Radio trigger Bravo with lets say TLI then only P1 P2 and P3  will disband from their current group and so on with each  (Team leader) TL2, TL3 and TL4  using if statement in the script code.

 

I don't really know the Syntax but I have seen if used in scripts BEFORE ( if this then this )

 

  On Activation -  IF TL1 THEN [TL1] join grpNull; [P1] join grpNull; [P2] join grpNull; [P3] join grpNull;  IF  TL2  THEN [TL2] join grpNull; [P4] join grpNull; [P5] join grpNull; [P6] join grpNull;  IF  TL3 THEN [TL3] join grpNull; [P7] join grpNull; [P8] join grpNull; [P9] join grpNull;  IF TL4  THEN [TL4] join grpNull; [P10] join grpNull; [P11] join grpNull;
 

 

 

Any feedback or help would be great. Avibird

 

 

 

    

 

 

Share this post


Link to post
Share on other sites

Seems like an odd approach to your problem.

Why not use an addAction instead?

You could have an addAction on any POW, that makes them join the TC units group,

then another addAction on every TL1-TL4 and TC to disband all POWS from the TC group, if that's your goal?

 

Cheers

  • Thanks 1

Share this post


Link to post
Share on other sites
1 hour ago, Grumpy Old Man said:

Seems like an odd approach to your problem.

Why not use an addAction instead?

:yeahthat:

...addActions are much useful than triggers in this cases. Although it seem easy for a novice mission maker to use editor only resources, little  scripts could and will save you a LOT of work on the long run.

Just my 2 cents here... 

Share this post


Link to post
Share on other sites

@Grumpy Old Man @HazJ would something like this work in Theory to allow for Radio Alpha to but used by three different units and get three different outcomes ?  This is what I was taking about using the if and then statements. IDK if this would work or even the right syntax lol see I am trying.  Grumpy have you used a program called typeSQF editor with Cpack console?

 

 

Trigger activation - Recruitment of POW groups

      Type -             none

      Activation -    Radio Alpha

      Repeatable

Trigger expression

    Condition -    player == TL1 ||   player == TL2 ||   player == TL3

   On Activation -  if (player == TL1) then  { [P1,P2,P3] join TL1};  if (player == TL2)  then { [P4,P5,P6] join TL2}; if (player == TL3) then { [P7,P8,P9] join TL3}; 

 

 

 

 

 

 

 

Share this post


Link to post
Share on other sites

Holy shit it works I need to test more to make sure but I now can use a single radio trigger for multiple things using different units :drinking2:+ one for me lol

Share this post


Link to post
Share on other sites

Eden editor... Bleh. I don't use it at all really, except for playable units and respawn markers which is are at [0, 0, 0] ha. How I would do it is local triggers.

https://community.bistudio.com/wiki/createTrigger

Quote

NOTE1: Since Arma 3 v1.43.129935 triggers can be created locally on clients setting optional param makeGlobal to false

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Hi avibird1 is this for SP, MP Hosted or MP Dedicated as there would be different ways it would need to be done ?

 

This should work on all SP, MP Hosted or MP Dedicated

 

I would do it this way but it does depend on how you exactly want to do it 

 

below adds a little database to each unit so it knows who they can join and who is in their team

 

this setVariable ["POW", [TL1,[P1,P2,P3]], true]; // add this to the init of P1,P2,P3

this setVariable ["POW", [TL2,[P4,P5,P6]], true];// add this to the init of P4,P5,P6

this setVariable ["POW", [TL3,[P7,P8,P9]], true];// add this to the init of P7,P8,P9

this setVariable ["POW", [TL4,[P10,P11,P12]], true];// add this to the init of P10,P11,P12

 

and to the initPlayerLocal.sqf add 

 

the below will only show the join action if you are TL1 and looking at P1,P2 or P3  or TL2  and looking at P4,P5 or P6  ect

 and the leave action if you look at one of them after they joined you They will then form their own group

 

player addAction ["Team Join Me" , {((cursorTarget getVariable "POW") select 1) join player},[],0,false,false,"","!(isnil {cursorTarget getVariable ""POW""}) and (group player != group cursorTarget) and (player == ((cursorTarget getVariable ""POW"") select 0))"];

player addAction ["Team Leave Me" , {[cursorTarget] join grpnull;((cursorTarget getVariable "POW") select 1) join (cursorTarget},[],0,false,false,"","!(isnil {cursorTarget getVariable ""POW""}) and (group player == group cursorTarget) and (player == ((cursorTarget getVariable ""POW"") select 0))"];
 

 

Share this post


Link to post
Share on other sites

Hey thanks for the reply. I play most of my mission on a host server with myself controlling all the AI or  with a few others 3-6  players. I am not into the whole large large clan play with Arma too much drama for me.

 

The way I have it seems to work on a host server tell me if I'm wrong.  I will definitely set up a mission using your code to see how it works and plays out one of the design of the mission each group leader may not have a line of sight of the other members in its group they may be in different prison cells. How would that work with the trigger setup I can switch in and out of group with visual contact. Avibird

Share this post


Link to post
Share on other sites

If you wanted an action to kick a unit from your group you could try this

 

in the initPlayerLocal.sqf add 

 

Kick_Unit = 
{
    {
    _id = player addAction ["Kick " + (name _x) + "  " + str(_x distance player), {[_this select 3] join grpnull;player removeaction [_this select 2]},_x,1,false,false,"",""];   // adds kick name and distance action for each unit in your group
    [_id] spawn {params ["_id"];sleep 10;player removeaction _id;}; // removes action after 10 seconds
    } foreach group player;
};

 

player addAction ["Kick Unit From Group" , {spawn Kick_Unit},[0],1,false,false,"","(count (units group player) > 1)"];  // adds a kick action when you have members in your group

 

 

 

Share this post


Link to post
Share on other sites
7 hours ago, avibird 1 said:

@Grumpy Old Man @HazJ would something like this work in Theory to allow for Radio Alpha to but used by three different units and get three different outcomes ?  This is what I was taking about using the if and then statements. IDK if this would work or even the right syntax lol see I am trying.  Grumpy have you used a program called typeSQF editor with Cpack console?

 

 

Trigger activation - Recruitment of POW groups

      Type -             none

      Activation -    Radio Alpha

      Repeatable

Trigger expression

    Condition -    player == TL1 ||   player == TL2 ||   player == TL3

   On Activation -  if (player == TL1) then  { [P1,P2,P3] join TL1};  if (player == TL2)  then { [P4,P5,P6] join TL2}; if (player == TL3) then { [P7,P8,P9] join TL3}; 

 

 

 

 

 

 

 

 

Been using notepad++ in my early days, now exclusively using poseidon which is extremely feature rich. It's made by one of the BI devs, has autocomplete, auto-syntax completion and loads of stuff more, always up to date.

 

For your prisoner recruit and release things I'd personally use an addAction.

Alternatively there's the communication menu but that might be beyond the scope of this.

A simple function inside init.sqf could handle all prisoner joining/releasing stuff, then you can easily adjust what happens from a single line:

//init.sqf or wherever you seem fit
GOM_fnc_prisonerActions = {

	params ["_unit","_prisoners"];


	_recruit = _unit addAction ["Recruit Prisoners",{

		params ["_unit","_caller","_ID","_prisoners"];

		(_prisoners select {alive _x}) join _unit;

	},_prisoners,0,false,true,"","_this isEqualTo _target",15];

	_dismiss = _unit addAction ["Dismiss Prisoners",{

		params ["_unit","_caller","_ID","_prisoners"];

		(_prisoners select {alive _x}) join grpNull;

	},_prisoners,0,false,true,"","_this isEqualTo _target",15];
true
};
//adding the actions
_group1 = [TL1,[P1,P2,P3]] call GOM_fnc_prisonerActions;

This will only join alive prisoners to the group, since we don't care about collateral damage.

 

Cheers

Share this post


Link to post
Share on other sites

@Grumpy Old Man @zonekiller @HazJ 

 

Gentleman thanks for all the feedback and information. I will definitely be fooling around with all your codes you guys posted above to see how it works and how to setup things up. With that said I'm still a little confused about a few things. 

 

The way I have it setup will it work in a host server multiplayer environment meaning Co-op player vs AI not multiplayer player versus player.

 

The thing I am seeing is that there are many ways of organizing writing and calling Scripts for this game. Some more efficient and sexier than others but they all can work.  For example in Eden editor you can setup a lot of the things that used to be done in a description.file within a mission folder. Now you can just use the Eden editor for them which is the better way? Is it just preference? 

 

Writing code in SQF's is it  the same as putting codes in triggers game logics modules and object init's ?

 

An analogy I will use is like painted a picture by numbers or painting a picture on an open canvas. You both have a picture at the end of the day but the opencanvas has more options and freedom to use whatever colors you want while painting by numbers you must use a set of colors that are predetermined in a set order.

 

This is how I see using in game resources like triggers game Logics modules you still need to understand codes but you are Limited in a pre-set way of using them. 

 

Tell me if I am missing the bigger concept here or am I on the mark with my analogy. I know writing sqf's from scratch will allow me to have unlimited possibilities while using game resources will limit a scripter on what he can do with the codes. Avibird

Share this post


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

I know writing sqf's from scratch will allow me to have unlimited possibilities while using game resources will limit a scripter on what he can do with the codes. Avibird

 

You're not limited either way, since it's all interchangeable.

A trigger is basically a waitUntil loop, a module is basically executing a function/multiple functions with certain variables.

It's just way more convenient to stay on the .sqf side of things, once you made that transition.

 

Biggest pro on a purely script based approach is that everything is centralized for editing/tweaking, instead of having to open more than a dozen triggers, modules and whatnots, just think about more complex tasks.

Even having a task branch out into 3 different follow-up tasks depending on its outcome ("SUCCEEDED","CANCELLED","FAILED") is a nightmare to do with triggers and modules alone.

Doing the same in .sqf is way more readable and easier to adjust and you can make sure it's working in MP/dedicated, which is not always guaranteed using BI modules.

 

On top of that you can set up your own functions library that can be used in multiple missions.

 

Only a few things that come to mind, there's more to it.

 

Cheers

 

  • Like 1

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

×