Home   Help Search Login Register  

Author Topic: why is addaction such a pain?  (Read 1710 times)

0 Members and 1 Guest are viewing this topic.

sinchi runa

  • Guest
why is addaction such a pain?
« on: 19 Apr 2008, 19:46:59 »
greetings,

i have been digging through the archives, yet there seems to be no real answer as to how to keep addactions after respawns in MP.

example.. mando has spent so much time on missile and bomb scripts that look and work great... yet you get killed in game once and the console is gone for the rest of the game... :dunno: how do the support menus in evolution keep showing back up?.. is it the same in principle?

so what i am looking for at the moment is this:

i would like to add the mando air support console to evolution or domination type maps.. (i know it is harder than just making a new map.. but not as fun.)

i have been able to use triggers or the like to re-add the addaction.. but it adds it to everybody else's.. and if several are respawning and some haven't died.. they find 100 air support addaction in their menu..

thank you

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: why is addaction such a pain?
« Reply #1 on: 19 Apr 2008, 20:28:19 »
of course it depends on respawn type, but for automatic stock ArmA respawns this should be enough:

Code: [Select]
// respawnable unit
_unit = _this select 0;
while {true} do
{
   waitUntil {alive _unit};
   // Addwhatever needed here

   waitUntil {!alive _unit};
};

Many missions dont use respaws at all, but they are dynamically creating new units when others die. For these cases the setup code of any menu action, etc should be placed there where the unit is created (as in mando air war 3).

sinchi runa

  • Guest
Re: why is addaction such a pain?
« Reply #2 on: 19 Apr 2008, 21:05:05 »
thanks for the reply,

where does that code go? in it own sqs or sqf file.. or in the init.sqf?

also here:
Code: [Select]
  waitUntil {alive _unit};
   // Addwhatever needed here

i would make it look as so?

Code: [Select]
// respawnable unit

_unit = _this select 0;
while {true} do
{
   waitUntil {alive _unit};
   player addAction ["Air Support console", "mando_airsupportdlg.sqf"];

   waitUntil {!alive _unit};
};


Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: why is addaction such a pain?
« Reply #3 on: 19 Apr 2008, 21:11:42 »
Well, which criteria do you use to assing the console? unit name? rank? unit type?

From a BIS thread about the console, who has a Laser Designator, has the console. This might be a good criteria:
Code: [Select]
// Add to your init.sqf
[] spawn
{
  private["_acidx1", "_acidx2", "_unit", "_veh"];
  _acidx1 = -1;
  _acidx2 = -1;
  while {true} do
  {
     waitUntil {("Laserdesignator" in weapons player) && (alive player)};
     _acidx1 = player addAction ["Console: Air support", "mando_airsupportdlg.sqf"];
     while {("Laserdesignator" in weapons player) && (alive player)} do
     {
        _unit = player;
        if (vehicle _unit != _unit) then
        {
           _veh = vehicle _unit;
           _acidx2 = vehicle _unit addAction ["Console: Air support", "mando_airsupportdlg.sqf"];                 
           waitUntil {(vehicle _unit == _unit) || (!alive _unit)};
           _veh removeAction _acidx2;
        };
        Sleep 1;
     };
     _unit removeAction _acidx1;
  };
};
« Last Edit: 19 Apr 2008, 21:16:05 by Mandoble »

sinchi runa

  • Guest
Re: why is addaction such a pain?
« Reply #4 on: 19 Apr 2008, 21:40:45 »
WOW!! perfect.. and the linking it to the laser designator was a great idea.. thank you very much!