Results 1 to 3 of 3

Thread: Save loadout script?

  1. #1

    Save loadout script?

    So.......I'm playing an edited Evolution map w/ ACE and a bunch of other mods but how would I go about saving my weapon loadout?...it gets rather boring and time consuming having to regear every death..........

    P.S.

    I mean only keeping my primary,secondary,nvg,binocular slot, and ammo.......

    (Think respawning in CoD/MW2 w/ your selected loadout............)


    EDIT: Found a solution only problem is you respawn with what ever you had when you died not the loadout you picked from a weaponbox........

    (Put this in init.sqs)
    [] exec "WeaponRespawn\WRespawn_Init.sqs";

    //WRespawn_Init.sqs
    #start
    @ (! alive player)
    _weapons = weapons player
    _magazines = magazines player

    @ (alive player)
    removeallweapons player

    {player addMagazine _x} foreach _magazines
    {player addWeapon _x} foreach _weapons
    goto "start"

    If anyone has a better solution let me know please but I guess this will work for now :0
    Last edited by FelixK44; Jul 1 2010 at 01:57.

  2. #2
    hello,
    this is this one I use, works very well.

    your options are:

    if method is 0, the player gets the same weapons he started out with every time

    if method is 1, the player gets the same weapons he had when he died

    Code:
    ;Universal Weapons Respawn Script v1.04 (March 31, 2003) revised (February 1, 2007)
    ;Required Version: ArmA
    ;original by toadlife revised by norrin for ArmA
    ;toadlife@toadlife.net
    ;intialize like this: ["unitname",0] exec "weapons_respawn.sqs"
    ;            Or this: ["unitname",1] exec "weapons_respawn.sqs"
    ;
    ; * "unitname" = The name of the player the script runs on (must be enclosed by quotes!)
    ; * 0/1 = method of repleneshing weapons
    ;  **if method is 0, the player gets the same weapons he started out with every time
    ;  **if method is 1, the player gets the same weapons he had when he died
    ;
    ; Advanced example method of initializing script - put the following lines in your init.sqs,
    ; and replce the unit names with your own:
    ;_units = ["w1","w2","w3","w4","w5","w6","w7","w8","w9","w10","w11","w12","w13","w14","w15","w16","w17","w18"]
    ;{[_x,0] exec "weapons_respawn.sqs"} foreach _units
    ;
    ;
    
    ~(random 0.3)
    _name = _this select 0
    _method = _this select 1
    _hasrifle = false
    _unit = call compile format["%1",_name]
    ?(_method == 0):_return = "checklocal";goto "guncheck"
    
    #checklocal
    _unit = call compile format["%1",_name]
    ?(local _unit):goto "respawnloop"
    ~(1 + (random 3))
    goto "checklocal"
    
    #respawnloop
    @!alive _unit
    #checkmethod
    ?(_method == 1):_return = "waitforlife";goto "guncheck"
    
    #waitforlife
    @alive call compile format["%1",_name]
    _unit = call compile format["%1",_name]
    removeAllWeapons _unit
    ?_hasrifle:_guns = _guns - [_prigun];_guncount = count _guns
    _c = 0
    while {_c <= (_magcount - 1)} do {_unit addmagazine (_mags select _c); _c = _c + 1}
    _c = 0
    while {_c <= (_guncount - 1)} do {_unit addweapon (_guns select _c); _c = _c + 1}
    ?_hasrifle:_unit addweapon _prigun;_gun = _guns + [_prigun]
    ;//If unit has a rifle select it
    ?_hasrifle:goto "selectrifle"
    
    ;//No rifle - if unit has a pistol, select it
    ?_unit hasweapon ((weapons _unit - [secondaryweapon _unit,"Binocular","NVGoggles"]) select 0):_unit selectweapon ((weapons _unit - [secondaryweapon _unit,"Binocular","NVGoggles"]) select 0);goto "respawnloop"
    
    ;//No rifle or pistol, select secondary weapon
    _unit selectweapon secondaryweapon _unit
    goto "respawnloop"
    
    #selectrifle
    ;// BUG WORKAROUND! - Added to compensate for selectweapon bug 
    ;// Any gun with more than one muzzle (grenadelaunchers) cannot be selected with selectweapon!
    ;// Default Grenadelaunchers supported - Add your own types if you need to.
    _unit selectweapon _prigun
    ?_prigun == "M16A2GL":_unit selectweapon "M16Muzzle"
    ?_prigun == "M16A4GL":_unit selectweapon "M16Muzzle"
    ?_prigun == "M16A4_ACG_GL":_unit selectweapon "M16Muzzle"
    ?_prigun == "M4GL":_unit selectweapon "M4Muzzle"
    ?_prigun == "M4A1GL":_unit selectweapon "M4Muzzle"
    ?_prigun == "AK74GL":_unit selectweapon "AK74Muzzle"
    
    goto "respawnloop"
    
    
    #guncheck
    _guns = weapons _unit
    _mags = magazines _unit
    ~(random 0.5)
    _guncount = count _guns
    _magcount = count _mags
    ?_unit hasweapon (primaryweapon _unit):_hasrifle = true;_prigun = primaryweapon _unit;goto _return
    _hasrifle = false
    goto _return
    Run Armaedit (get it here--->http://www.armaholic.com/page.php?id=1455) and make a new sqs script and
    then copy the above script and put into your mp mission's folder, and then add either

    intialize like this: ["unitname",0] exec "weapons_respawn.sqs"
    Or this: ["unitname",1] exec "weapons_respawn.sqs"

    so in the editor you'll have your playable players, make a name for each one and then add a number,
    like in a seqence.

    so jim1, jim2, jim3 ect, then add it to the code and it should look like this:

    ["jim1",0] exec "weapons_respawn.sqs"
    ["jim2",0] exec "weapons_respawn.sqs"
    ["jim3",0] exec "weapons_respawn.sqs"
    add to the init line of the playable unit

    or download the script:
    http://www.armaholic.com/page.php?id=1554

    hope that helps.
    Last edited by Günter Severloh; Jul 4 2010 at 03:58.

    Hosting Missions for Invasion-1944, Iron Front: Liberation 1944, & Hell in the Pacific

    WarMod Series - Massive Addon & Mod Customizable Compilation Mods for Arma1, Arma2, & Arma2CO
    WarMod | A2WarMod |A2WarModACE | COWarMod | COWarModACE | COWarModI44 |COSLX

  3. #3
    I've been using this one by Xeno for ages..

    Code:
    // by Xeno
    private ["_weapons", "_magazines","_deadbody", "_p", "_primw", "_muzzles"];
    //if (!(local player)) exitWith {};
    
    while {true} do {
       waitUntil {!alive player};
       _weapons = weapons player;
       _magazines = magazines player;
       _deadbody  = player;
       waitUntil {alive player};
       _p = player;
       removeAllItems _p;
       removeAllWeapons _p;
       hidebody _deadbody;
       {_p addMagazine _x;} forEach _magazines;
        {_p addWeapon _x;} forEach _weapons;
        _primw = primaryWeapon _p;
        if (_primw != "") then {
            _p selectWeapon _primw;
            // Fix for weapons with grenade launcher
            _muzzles = getArray(configFile>>"cfgWeapons" >> _primw >> "muzzles");
            _p selectWeapon (_muzzles select 0);
        };
       execVM "briefing.sqf";
    };
    This respawns you with the weapon loadout when you died, with the added benifit of hiding your old dead body.

    It also selects your primary weapon if for example you died when you had the secondary weapon active.

    Save the above into a file called "respawnGear.sqf"

    Call the script by adding this line to init.sqf

    dummy = [true,true] execVM "respawnGear.sqf";
    Last edited by Beerkan; Apr 15 2012 at 00:54.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •