Modme Forums

How to replace a weapon the player is holding?

Game Modding | Call of Duty: Black Ops 3 | Scripting


ModmeBot:

Thread By: TheMikeyMan
I'm making a buildable weapon and i was wondering how you would replace the weapon in the current hand rather than just adding a third weapon when its picked up. Everything works its just that.
here is my code:
function blundergat(piece)
{
blundergat= GetEnt ("blundergat_model", "targetname");
blundergat Hide();
level.piecenum=0;
piece1 = GetEnt("triggerss"+piece, "targetname");
bpiece = GetEnt("blundergat"+piece, "targetname");
piece1 SetHintString("Press ^3&&1^7 to interact");
piece1 SetCursorHint("HINT_NOICON");
piece1 waittill("trigger", player);
piece1 Delete();
bpiece Delete();
IPrintLnBold ("Blundergat piece"+ piece+ " found!");
level.piecenum++;
if (level.piecenum==3)
{
IPrintLnBold("Now go to the workbench and make your blundergat!");
bench=GetEnt("bencht", "targetname");
bench SetHintString("Press ^3&&1^7 to interact");
bench SetCursorHint("HINT_NOICON");
bench waittill("trigger", player);
blundergat Show();
currentweapon = player GetCurrentWeapon();
currentweapon Delete();
weapon = GetWeapon("blundergat");
player GiveWeapon(weapon);
player SwitchToWeapon(weapon);
bench Delete();
}
}


ModmeBot:

Reply By: Harry Bo21

player zm_weapons::weapon_give( getWeapon( "weapon" ), undefined, undefined, undefined, 1 );


script needs


#using scripts\zm\_zm_weapons;



again if you were just using the "existing" buildables stuff, this would all already be handled


ModmeBot:

Reply By: TheMikeyMan
thanks