Jump to content
  • Topics

  • Posts

    • hey welcome to the Arma mission making zone ^_^,   to get started I really recommend you explore the Arma documentation https://community.bistudio.com/wiki/Category:Arma_3:_Scripting_Commands,  all the explanation of the magic is there in the documentation, or you could try tutorials on youtube to get started ^_^   so to spawn a unit Arma uses "createUnit" command, a unit needs a group it can be your group, to add a unit to your group, you get your group with the command: private _playerGrp = group player; next you place down the unit you want to spawn and copy his class by right clicking him and going to Log >> Log Classes to Clipboard, after you got the class into your clipboard you delete the unit and use the "createUnit" command to spawn in the unit to a group https://community.bistudio.com/wiki/createUnit private _unit = _playerGrp createUnit ["B_crew_F", getPosATL player, [], 0, "FORM"]; that is kinda the basics on how you spawn a unit in Arma, but to actually spawn in some units for empty vehicle seats, driver, gunner, etc..., here is a script I wrote(that probably took less then a second, probably 😃 ) spawnAssistantUnits = { params ["_veh","_unitGrp","_unitClass"]; // if provided object is not a vehicle, exit if (_veh isKindOf "Man") exitWith {}; // get commander seat, gunner seats, driver seat private _commander = commander _veh; private _turrets = allTurrets _veh; private _driver = driver _veh; // spawn commander if there is no unit in commander seat if (isNull _commander) then { private _unit = _unitGrp createUnit ["B_Soldier_F", getPos _veh, [], 0, "FORM"]; _unit assignAsCommander _veh; [_unit] orderGetIn true; _unit moveInCommander _veh; // if vehicle doesn't have a commander seat, delete unit if (vehicle _unit == _unit) then { deleteVehicle _unit; }; }; // spawn driver if there is no unit in driver seat if (isNull _driver) then { private _unit = _unitGrp createUnit ["B_Soldier_F", getPos _veh, [], 0, "FORM"]; _unit assignAsDriver _veh; [_unit] orderGetIn true; _unit moveInDriver _veh; // if vehicle doesn't have a driver seat, delete unit if (vehicle _unit == _unit) then { deleteVehicle _unit; }; }; // get current full crew of the vehicle private _fullCrew = fullCrew _veh; // get occupied turret paths private _occupied_turret_paths = []; { private _x_seatType =_x select 1; private _x_turretPath =_x select 3; _occupied_turret_paths pushBack str(_x_turretPath); } forEach _fullCrew; // spawn units for gunners empty { private _x_str_turret = str(_x); // if turret gunner doesn't have a unit assigned if (!(_x_str_turret in _occupied_turret_paths)) then { // then spawn unit private _unit = _unitGrp createUnit ["B_Soldier_F", getPos _veh, [], 0, "FORM"]; _unit assignAsTurret [_veh, _x]; [_unit] orderGetIn true; _unit moveInTurret [_veh, _x]; }; } forEach _turrets; }; the above function might not work in 3DEN editor object inits, but you can in your mission folder directory "Documents\Arma 3\missions\YourMissionName", inside the folder create a file named "init.sqf", and paste the above code there, next you want to radio activate to call the function [vehicle player, group player, "B_Soldier_F"] call spawnAssistantUnits;   to call the function through radio commands, place a trigger, set activation type to "Radio Alpha" and give it a text, now in "On Activation" paste the above code, you can now hop into any vehicle and and press 0, 0 2x and you should see your text which would spawn in some units to all the empty gunner, driver, commander seats, also make sure you set the trigger to repeat or you can only call the function once   P.S: why am I seriously writing all this down?, simple because I got nothing to do ^_^, also don't feel pity for me for wasting my time writing all the code, I'm a fast typer 😃   
    • Hello! I know this script is old and maybe not functional? But I've managed to put into my server but when I get the Message that I've found something nothing happens. Any ideas? Or maybe there is a script that does something like that that works?
    • Introducing a basic survival mod that adds hunger and water stats and makes the ingame items such as foods and fuel canister making them usable with custom sounds and animations https://steamcommunity.com/sharedfiles/filedetails/?id=3223868432     pics:     Main Features:     
          
          
      For Scripters:     - for performance reasons, player's food and water values are stored locally on player, the same player on the same network machine can get the player's hunger and water value by using:
          
              // food & water value ranges from 0 to 1, 1 = max         private _foodValue = player getVariable ["food", 1];         private _waterValue = player getVariable ["water", 1];
          
          - however the above function won't work when a different network machine or server is getting the player's food and water value in MP, to get the player's food and water value across networks use "survivalpack_fnc_getHungerWater" function
          
              // gets target player's hunger & water value, use this function in replacement of getVariable, because the food and water values are stored locally on player for performance reasons         [<player>] call survivalpack_fnc_getHungerWater; // returns nothing but sets three variables
          
              // example getting the first player's hunger & water value 
              
                   [] spawn {                 _firstPlayer = allPlayers select 0;                                               [_firstPlayer] call survivalpack_fnc_getHungerWater;                                  waitUntil {!isNil "sp_recievedpacketvar_player"};                 waitUntil {_firstPlayer == sp_recievedpacketvar_player};                                                   systemChat format ["player '%1' actual food and water values are %2%4 %3%4", name sp_recievedpacketvar_player, sp_recievedpacketvar_food, sp_recievedpacketvar_water, "%"];                 systemChat format ["player '%1' displayed food and water values are %2%4 %3%4", name sp_recievedpacketvar_player, round(sp_recievedpacketvar_food * 100), round(sp_recievedpacketvar_water * 100), "%"];             };
                  
              // sets hunger & water value for target player, use -1 to avoid setting a value         [<player>, <food_value>(0-1), <water_value>(0-1)] call survivalpack_fnc_setHungerWater
                  
                  
              // example setting the first player's hunger to 50%
                  
                   [allPlayers select 0, 0.5, -1] call survivalpack_fnc_setHungerWater;
                  
          - Item classes: Adding items (through script)
                       // to player inventory         player addItem "SPItem_CanisterFuel";         player addItem "SPItem_CanisterFuelEmpty";         player addItem "SPItem_TacticalBacon";         player addItem "SPItem_CanSpirit";         player addItem "SPItem_CanFranta";         player addItem "SPItem_CanRedGull";         player addItem "SPItem_Waterbottle";         player addItem "SPItem_WaterbottleEmpty";         player addItem "SPItem_Canteen";         player addItem "SPItem_CanteenEmpty";         player addItem "SPItem_Cerealbox";         player addItem "SPItem_PowderedMilk";         player addItem "SPItem_RiceBox";         player addItem "SPItem_Pumpkin";         player addItem "SPItem_Orange";         player addItem "SPItem_BakedBeans";
                       // to a crate/vehicle/container         this addItemCargoGlobal ["SPItem_CanisterFuel", 10];         this addItemCargoGlobal ["SPItem_CanisterFuelEmpty", 10];         this addItemCargoGlobal ["SPItem_TacticalBacon", 10];         this addItemCargoGlobal ["SPItem_CanSpirit", 10];         this addItemCargoGlobal ["SPItem_CanFranta", 10];         this addItemCargoGlobal ["SPItem_CanRedGull", 10];         this addItemCargoGlobal ["SPItem_Waterbottle", 10];         this addItemCargoGlobal ["SPItem_WaterbottleEmpty", 10];         this addItemCargoGlobal ["SPItem_Canteen", 10];         this addItemCargoGlobal ["SPItem_CanteenEmpty", 10];         this addItemCargoGlobal ["SPItem_Cerealbox", 10];         this addItemCargoGlobal ["SPItem_PowderedMilk", 10];         this addItemCargoGlobal ["SPItem_RiceBox", 10];         this addItemCargoGlobal ["SPItem_Pumpkin", 10];         this addItemCargoGlobal ["SPItem_Orange", 10];         this addItemCargoGlobal ["SPItem_BakedBeans", 10];
              
          - Animation classes:
                   sp_anim_start_eating         sp_anim_eating         sp_anim_end_eating         sp_anim_start_drinking_waterbottle         sp_anim_drinking_waterbottle         sp_anim_end_drinking_waterbottle         sp_anim_start_canister_fuel         sp_anim_canister_fuel         sp_anim_end_canister_fuel
              
      For Modders:     - this mod is on github and is open source 
          https://github.com/Shaanig03/Arma-3-Survival-Pack-Mod
          - license "MIT License"
             P.S: also my first published mod, hope you find it useful for a scenario ^_^    
×