Jump to content
Sign in to follow this  
Ddawguga

Wanted: Random Weapons Upon respawns SCRIPT

Recommended Posts

I have been trying to create a script for random pistols upon respaws for a deathmatch multiplayer map. For some reason i cant get mine to work and i keep spawning with nothing at all. Can someone create a basic random pistol respawn script or point me in the right direction? Thanks in advance.

Share this post


Link to post
Share on other sites

RandomPistol.sqf:

_unit = _this;

_weapons = ["M9","Makarov","M9SD","MakarovSD"];
_magazines = ["9Rnd_9x19_M9","8Rnd_9x18_Makarov","9Rnd_9x19_M9","8Rnd_9x18_MakarovSD"];

_i = random floor count _weapons;
_c = 4;

removeAllWeapons _unit;
while{_c > 0}do{
 _unit addMagazine (_magazines select _i);
 _c = _c - 1;
};

_unit addWeapon (_weapons select _i);
_unit selectWeapon (_weapons select _i);

Tajin as a nice respawn script floating around. See if you can find it, it will give you an example of how to call this script when the unit respawns.

Share this post


Link to post
Share on other sites

couldnt find tajins respawn script, or one that would work in conjunction with this one, help anyone??? please,

Edited by Ddawguga

Share this post


Link to post
Share on other sites

You've got mail ^^

Share this post


Link to post
Share on other sites

I know this is an old post but I'd like to get random weapon loadouts for my enemy units. I have 10 'woodsmen' and they all start with AK-47's. I'd like to mix this up and randomise their loadouts in their INIT boxes without me having to do each one individually.

Can I adjust the array's above to get a mix of rifles and smg's and correct magazines into inventory?

Share this post


Link to post
Share on other sites

I've adapted Big Dawg's script and made a random weapon script. I use this to arm civilians with a range of different weapons without me having to set them one by one.

It will destroy a unit's default weapons and add a random weapon and three compatible magazines. There is a section at the end that adds 'accessories' but this can be removed if you like.

Weapons can be changed in the array but make sure you get the correct magazine type in the correct position in the array.

Put this in a sqf file and call from unit's INIT line.

_unit = _this;

//if there are x weapons then make sure there are x magazines

_weapons = [“AK_74â€,â€AK_47_Mâ€,â€AK_47_Sâ€,â€AKS_74",â€FN_FALâ€,â€LeeEnfieldâ€,â€PKâ€,â€RPK_74",â€Sa vz.58V Acogâ€];

_magazines = [“30Rnd_545x39_AKâ€,â€30Rnd_762x39_AK47â€,â€30Rnd_762x39_AK47â€,â€30Rnd_545x39_AKâ€,â€20Rnd_762x51_FNFALâ€,â€10x_303â€,â€100Rnd_762x54_PKâ€,â€75Rnd_545x39_RPKâ€,â€30Rnd_762x39_SA58â€];

_i = random floor count _weapons;

// sets how many magazines to load

_c = 4;

removeAllWeapons _unit;

while{_c > 0}do{

_unit addMagazine (_magazines select _i);

_c = _c - 1;

};

_unit addWeapon (_weapons select _i);

_unit selectWeapon (_weapons select _i);

//Can comment out or leave in this bit

_unit addMagazine “HandGrenadeâ€

_unit addweapon “NVGogglesâ€

Share this post


Link to post
Share on other sites

Big Dawg KS / Cougs - are you ok if we use this in our mission framework? it is currently a closed framework, but we do track all attributions, just in case.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×