Announcement

Collapse
No announcement yet.

addAction help

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • addAction help

    Number = unitName addAction [title, filename, (arguments, priority, showWindow, hideOnUse, shortcut, condition, positionInModel, radius, radiusView, showIn3D, available, textDefault, textToolTip)]

    I need help. The brain boggles here. I get everything up until the optional stuff. How the ? does the syntax work on this hulabaloo? If the "arguments" on to "textToolTip" are optional do I have to include a value for them all or just the ones I want to use...it's weird to me.

    Also, I'm adding one addAction that initializes 5 new add actions and removing the first. One of the 5 is the option it close the new addActions & reinitialize just first one. So, in effect creating a sub-menu.

    http://community.bistudio.com/wiki/addAction
    |TG-189th| Unkl
    ArmA 3 Game Officer
    Dean of Tactical Gamer University
    189th Infantry Brigade Member
    SUBMIT A RIBBON NOMINATION OR CONTACT AN ARMA ADMIN
    "We quickly advance in the opposite direction and take cover in a house on the SW side of town." - BadStache

  • #2
    Re: addAction help

    1. you cant just leave out an optional argument. you just need to mark them with ,"",or the default value, or just based on what the argument is.

    it has a good example on the wiki:
    _vehicle addAction ["Test", "myTest.sqf", "", 1, true, true, "", "true", "display1", 2, 0.25, 9, 0, "<img image='\HSim\UI_H\data\ui_action_autohover_ca.paa' size='1.8' shadow=0 />", "<br />My test tooltip"]

    just match it up with their syntax example:

    Number = unitName addAction [title, filename, (arguments, priority, showWindow, hideOnUse, shortcut, condition, positionInModel, radius, radiusView, showIn3D, available, textDefault, textToolTip)]

    just match it up and replace it with what you need.

    2. the sub menu part is pretty simple.
    its basically just "(_this select 1) removeaction _actionid", _actionid being the value you set when you said "_actionid = player addaction [blah blah blah];"
    just have the action add all the other actions to the admin, and then for all those actions have them remove each other and add the default (_actionid), resetting it. we can work out the details later.

    but i'll agree the addaction arguments are a headache :(
    Last edited by Yink; 09-21-2012, 12:44 AM.
    Yink | Vanilla Pilot | Killer of Stirling | CS GOD | Projects Team

    Comment


    • #3
      Re: addAction help

      I've been playing with addaction a lot. It is a real pain, and I dont understand it hardly at all.

      Here's the code that you will find under almost every post on the bistudo forums:

      this addAction ["name of action","script.sqf",[false],1,false,true,"","(_target distance _this) < 3"];

      This adds an action to an object that will allow any player that gets within 3 meters to execute the action (whatever script you want to put there).

      Then just create a script to do whatever you want.

      =================

      Here are some helpful bits:

      Within the script, you get 3 variables passed to it from the addaction. They are:

      _the_addaction_itself = _this select 0;
      _one_who_used_action = _this select 1;
      _id_of_action = _this select 2;

      (it can be helpful to declare these as easier to write variables, such as: _b = _this select 1;

      ================

      If you would like to make the addaction a one-time use action, put these in your script:

      {_x removeAction actionname} forEach allUnits;
      {_x removeAction actionname} forEach allDead;
      {_x removeAction actionname} forEach vehicles;

      actionname = _this select 0 (or your declared variable)

      You can also just remove the addaction for the unit that ran the addaction:

      (_this select 0) removeAction (_this select 2);

      ================

      Also, don't forget that these are executed locally. So if you run a 'hint "hi my name is Newman";' in your script, only the player who did the action should see it. I believe you can make these global or run on different players by using the CBA global/private functions - ie, CBA_fnc_remoteLocalEvent or CBA_fnc_globalExecute

      Google for more:

      http://lmgtfy.com/?q=site%3Aforums.b....com+addaction
      "Anyone who has never made a mistake has never tried anything new."
      -Einstein

      Comment

      Connect

      Collapse

      TeamSpeak 3 Server

      Collapse

      Advertisement

      Collapse

      Twitter Feed

      Collapse

      Working...
      X