Announcement

Collapse
No announcement yet.

[SCRIPT] Rearming ammobox

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

  • [SCRIPT] Rearming ammobox

    Hey guys,

    I'm currently working on a script for one of my missions. What it is supposed to do is basically re-equip someone with the gear they were initially loaded out with.

    So far I believe I have the script so that it checks the player's side and then checks another variable (that of which defines what class/kit the player is/has) and then runs a code block which re-equips the soldier.

    I have the add-action to the ammobox set up right, but so far my re-equip script isn't doing its job.

    This is what is in a unit's init line:

    Code:
    this setVariable ["_num", x]; //where x is the unit class
    ...and here is what I have so far in my re-equip script:

    Code:
    _unit = _this select 0;
    _num = _this select 1;
    
    switch (side player) do 
    {
        case WEST: //Blufor Equipment
        {
            switch (_num) do
            {
                case 1: //Team Leader
                {
                    removeAllWeapons _unit;
                    removeAllItems _unit;
                    _unit addWeapon "ACE_M4_ACOG";
                    _unit addWeapon "ACRE_PRC148";
                    _unit addWeapon "ACRE_PRC343";
                    _unit addWeapon "ItemGPS";
                    _unit addWeapon "ACE_Map";
                    _unit addWeapon "ItemCompass";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "HandGrenade_West";
                    _unit addMagazine "HandGrenade_West";
                    _unit addMagazine "SmokeShell";
                    _unit addMagazine "SmokeShell";
                };
                case 2: //Rifleman
                {
                    removeAllWeapons _unit;
                    removeAllItems _unit;
                    _unit addWeapon "ACE_M4_Eotech";
                    _unit addWeapon "ACRE_PRC343";
                    _unit addWeapon "ItemGPS";
                    _unit addWeapon "ACE_Map";
                    _unit addWeapon "ItemCompass";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "HandGrenade_West";
                    _unit addMagazine "SmokeShell";
                    _unit addMagazine "ACE_M84";
                    _unit addMagazine "ACE_M7A3";
                };
                default
                {
                };
            };
        };
    };
    Blackpython / ZephyrDark
    Former 31st RECCE Member


  • #2
    Re: [SCRIPT] Rearming ammobox

    Ah! Found out what I needed to do,

    Fixed the check so that the script called the caller from the addAction output(or whatever), used typeOf to define the player's unit class, and then using that did a switch containing the Classnames as the cases.

    so in other words, this:
    Code:
    _unit = _this select 1;
    sleep 0.25;
    _class = typeOf _unit;
    
    switch (side _unit) do 
    {
        case WEST: //Blufor Equipment
        {
            switch (_class) do
            {
                case "US_Soldier_TL_EP1": //Team Leader
                {
                    removeAllWeapons _unit;
                    removeAllItems _unit;
                    _unit addWeapon "ACE_M4_ACOG";
                    _unit addWeapon "ACRE_PRC148";
                    _unit addWeapon "ACRE_PRC343";
                    _unit addWeapon "ItemGPS";
                    _unit addWeapon "ACE_Map";
                    _unit addWeapon "ItemCompass";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "HandGrenade_West";
                    _unit addMagazine "HandGrenade_West";
                    _unit addMagazine "SmokeShell";
                    _unit addMagazine "SmokeShell";
                };
                case "US_Soldier_EP1": //Rifleman
                {
                    removeAllWeapons _unit;
                    removeAllItems _unit;
                    _unit addWeapon "ACE_M4_Eotech";
                    _unit addWeapon "ACRE_PRC343";
                    _unit addWeapon "ItemGPS";
                    _unit addWeapon "ACE_Map";
                    _unit addWeapon "ItemCompass";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "ACE_30Rnd_556x45_S_Stanag";
                    _unit addMagazine "HandGrenade_West";
                    _unit addMagazine "SmokeShell";
                    _unit addMagazine "ACE_M84";
                    _unit addMagazine "ACE_M7A3";
                };
                default
                {
                };
            };
        };
    };
    if (true) exitWith {};
    Blackpython / ZephyrDark
    Former 31st RECCE Member

    Comment


    • #3
      Re: [SCRIPT] Rearming ammobox

      I want time to learn this gobblygook. Thanks for posting. Will be trying variations on this in my next mission.
      |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

      Comment


      • #4
        Re: [SCRIPT] Rearming ammobox

        ok this looks highly usefull

        but how do i use it? what needs to go into where?

        thanks
        AnimalMother
        Ex TG-31st LR
        "Is it the 31st policy to have hott women as their avatars? Because if so that's a pretty baddass policy." - Pvt. brokeback
        sigpic

        Arte et Marte

        Comment


        • #5
          Re: [SCRIPT] Rearming ammobox

          Basically, Animal, you put the script in the second post in a text file called "rearm.sqf". Make any object which you want the players to rearm off of (be it a unit or object or vehicle) and put in its init line "this addaction ["Text to appear in action menu", "rearm.sqf"];

          If you want to change the loadouts for each unit just change the classnames for the objects in the script and to change the what unit is getting what loadout add a new case/edit a case to include that unit's classname.
          Blackpython / ZephyrDark
          Former 31st RECCE Member

          Comment

          Connect

          Collapse

          TeamSpeak 3 Server

          Collapse

          Advertisement

          Collapse

          Twitter Feed

          Collapse

          Working...
          X