Search the Community
Showing results for tags 'setUnitLoadout'.
Found 3 results
Good day, I am having trouble with getUnitLoadout and setUnitLoadout functions. I want to make it so that when players respawn, they have the same loadout like they did before they died/respawned. But in some cases it removes the primary and secondary weapons. I am using the code below: //In onPlayerKilled.sqf I have: player setVariable ["Saved_Loadout",getUnitLoadout player]; //In onPlayerRespawn.sqf I have: player setUnitLoadout (player getVariable ["Saved_Loadout",]); It works when players respawn through the menu. But the problem is when they are shot and go into the incapacitated animation (I have revive enabled). I assume that when you go into the incapacitated state you lose your weapons, and then it saves your loadout when you "Hold space" to respawn. So technically you did not have a weapon when the script saved your loadout. I was thinking that the "getUnitLoadout" function should be triggered just before you go into the incapacitated state, but I am not sure how to do that. Maybe check if the player's health is below 10%? Any help would be appreciated. -MrSydney
FUNCTIONS FOR GETTING / SETTING VEHICLE LOADOUT Hi all, Here is a script for getting the loadout of any vehicle or crate (any container in fact) then transfer it on another vehicle or crate. This works in SP or MP. This functions work also for virtual arsenal, edited, or scripted with addAction command. If any uniform, vest or backpack with their own custom loadout inside it, you'll recover the exact loadout for each one. (I didn't push to keep the same ammo count on each mag...) So, it's compatible and consistent with some automatic loaded backpacks, which will be loaded as you let them instead of their auto-default loadout. NB1: The loadout of the receiving container will be replaced by the loadout you get. NB2: see also the respawn vehicle script for integration of these two functions on respawning vehicles. (script to be issued soon). parameters: one objet <vehicle or crate, preferable> applying to getVehicleLoadout, two objects <new vehicle or crate, old vehicle or crate> applying to getVehicleLoadout Limitations: The object you picked the loadout with getVehicleLoadout must not be deleted before you apply the setVehicleLoadout on another object. Not tested, crates and vehicles overall load limitations, if any. I didn't see any of them so far. Examples: car1 call MGI_fnc_getVehicleLoadout; // you pick the current loadout of a vehicle; cursorTarget call MGI_fnc_getVehicleLoadout; // if you're pointing at a backpack on ground, you pick its loadout (must stay on cursorTarget for transferring the whole backpack in a named vehicle/crate); [car2,crate1] call MGI_fnc_setVehicleLoadout; // you call the loadout of crate1, previously recorded with MGI_fnc_getVehicleLoadout; The two objects must be present, not applicable on player or infantry units (see BI commands getUnitLoadout / setUnitLoadout) you apply the loadout of crate1 on car2, these two objects have now the same loadout. [car2,cursorTarget] call MGI_fnc_setVehicleLoadout; // see above. If you are still on same cursorTarget, you pass the container to the new object (so,new vehicle must be named for debug console usage). Codes to be run anywhere you need it, locally, preferably on server. MGI_fnc_getVehicleLoadout MGI_fnc_setVehicleLoadout
Hi, Posting here coz cant get in new feedback tracker :( VERSION: Public (non-dev) 1.62.137494 DESCRIPTION: I noticed following problem when using setUnitLoadout command. When more than 1 magazine have same number of bullets (but less than maximum magazine capacity), this command will not set given bullet count, instead added mags will be fully loaded to its maximum capacity. REPRODUCTION Try execute following player setUnitLoadout [,,,,["V_Chestrig_rgr",[["30Rnd_556x45_Stanag",15,3]]],,"","",,["","","","","",""]] This command should give 3 mags with 15 bullets each. It will give 3 full mags instead. HOWEVER!!!!!! Adding one magazine will work fine. player setUnitLoadout [,,,,["V_Chestrig_rgr",[["30Rnd_556x45_Stanag",15,1]]],,"","",,["","","","","",""]] ALSO: There is also a nasty workaround player setUnitLoadout [,,,,["V_Chestrig_rgr",[["30Rnd_556x45_Stanag",15,1],["30Rnd_556x45_Stanag",15,1]]],,"","",,["","","","","",""]] This will give two semi-filled magazines. But this is not very usable, because getUnitLoadout will combine similar mags with same ammo count. Hopefully this command will be fixed, as it is THE VERY BEST item handling command ever!!! I personally love, how this command handles wrong input and empty arrays, so much more flexible from addMagazine, addItem and others. Great work BIS! :)