Jump to content
Sign in to follow this  
mr_shadow

Launcher reload script

Recommended Posts

Hello, does anyone know if there is a way to reload the launcher with script?

For example I have a player and added him "launch_NLAW_F", is there a way to reload it or setammo of it? I dont want the unit have a backpack on his skin.

 

 

I have tryed to setammo of currentweapon and secondaryweapon but it seems to me that this command does not work with launchers.

 

 

Share this post


Link to post
Share on other sites
Guest

Maybe you can use www.community.bistudio.com/wiki/loadMagazine

:)

Share this post


Link to post
Share on other sites

I've tryed 

vehicle player loadMagazine [[0],"launch_NLAW_F","NLAW_F"];

which doesn't work.

Share this post


Link to post
Share on other sites
Guest

I will try something in a few minutes I will tell you what

Share this post


Link to post
Share on other sites
Guest

Here you go.

player addWeapon "launch_NLAW_F"; // Add the weapon to the player
player addSecondaryWeaponItem "NLAW_F"; // Add the magazine to the secondary Weapon
// You may also use
player addWeapon "SomeRifleClassName"; 
player addPrimaryWeaponItem "Magazine";
//
player addWeapon "SomePistolClassName";
player addHandgunItem "Magazine";
// More detailled way
player addWeaponItem ["ClassName", "Mag"];
player addWeaponItem ["ClassName", ["Mag",ammoCount, muzzleName]]; // Use Muzzle Name with GL

Always remember that if you want to do this the right way (modulable) you can find the right magazines in the configs and use _unit and _classname as parameters of your function

 

EDIT : Fixed thanks to @Bnae, I did not double checked the code.

Share this post


Link to post
Share on other sites
Guest

Sorry for you, it does work for me.

Share this post


Link to post
Share on other sites
Guest

Nope.

 

I will send you a test mission

Share this post


Link to post
Share on other sites

You missed one double comma. You probably noticed that.

player addWeapon "launch_NLAW_F";    // Add the weapon to the player
player addSecondaryWeaponItem "NLAW_F";    // Add the magazine to the secondary Weapon

Share this post


Link to post
Share on other sites

Thing that helped me:

 

player addbackpack "B_Kitbag_sgg";  player addSecondaryWeaponItem "NLAW_F"; removebackpack player;

Share this post


Link to post
Share on other sites
Guest

 

You missed one double comma. You probably noticed that.

player addWeapon "launch_NLAW_F";    // Add the weapon to the player
player addSecondaryWeaponItem "NLAW_F";    // Add the magazine to the secondary Weapon

 

This works and you don't need that kind of "hack" thing.

Share this post


Link to post
Share on other sites

Tested in editor without any problems

 

in player init

comment "Remove existing items";
	removeAllWeapons this;  
	removeAllItems this;
	removeAllAssignedItems this; 
	removeUniform this; 
	removeVest this; 
	removeBackpack this; 
	removeHeadgear this; 
	removeGoggles this; 

comment "Add weapons"; 
	this addWeapon "launch_NLAW_F"; 

comment "Add items"; 
	this linkItem "ItemMap"; 
	this linkItem "ItemCompass";
	this linkItem "ItemWatch";

comment "Set identity"; 
	this setFace "WhiteHead_20"; 
	this setSpeaker "Male01GRE"; 

player addWeapon "launch_NLAW_F"; 
player addSecondaryWeaponItem "NLAW_F"; 

Share this post


Link to post
Share on other sites

There is also a command for unlimited ammo (sorry currently on the mobile).

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  

×