Modme Forums

GiveWeapon

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


SweetzIZ:

So well i have a line of code that will give the player a Weapon. BUT as i am new to mod tool i dont know to fix my problem.
as soon as i recive the gun it remove from the player as well as the cash?? HELP ME :D

First

function Award()
{
player = GetPlayers();
current = player GetWeaponsListPrimaries();
weapon = getWeapon("microwavegundw");
here = GetEnt("here", "targetname");
loot_t = GetEnt("loot_t", "targetname");
loot_t SetHintString("Press &&1 to turn on");
loot_t SetCursorHint("HINT_NOICON");
loot_t waittill("trigger", player);
loot_t Delete();
wait 1;
player PlaySoundWithNotify("award01", "soundcomplete");
player waittill("soundcomplete");
wait 15;
player PlaySoundWithNotify("award02", "soundcomplete");
player waittill("soundcomplete");
wait 10;
player PlaySoundWithNotify("award03", "soundcomplete");
player waittill("soundcomplete");
player TakeWeapon(current);
wait 1;
player GiveWeapon(weapon);
player SwitchToWeapon(weapon);
wait 3;
thread zm_powerups::specific_powerup_drop("full_ammo", here.origin);
iPrintLn("complete");
}

This is my second and yes the function is thread

function grab_weapon( player )
{   
    iPrintLnBold("start");
    weaps = player getweaponslistprimaries();
    gun = GetWeapon("microwavegundw");
    current = player GetCurrentWeapon();

    iPrintLnBold(weaps);
    wait 2;
    iPrintLnBold(gun);
    wait 2;
    iPrintLnBold(current);
    wait 2;

    player TakeWeapon(current); 
    player GiveWeapon(gun);
    player SwitchToWeapon(gun);
    player GiveMaxAmmo(weaps);
    iPrintLnBold("stop");
}


I am open for any kind of solution ;D


FrostIceforge:

When it's taking your weapons and your cash, do you also hear Samantha laugh? If so, the script gives you a third weapons without Mule Kick or a fourth weapons with Mule Kick. I'm guessing this is an issue with GiveWeapon. When you want to give a weapon, use

player zm_weapons::weapon_give(getweapon( WEAPON_NAME_HERE ));
And make sure to add
#using scripts\zm\_zm_weapons;
to the top of any files that use your functions.


FrostIceforge:

Also, I am confused with a few parts of your code that might cause issues.

player = GetPlayers();
current = player GetWeaponsListPrimaries();

...

player TakeWeapon(current);
GetPlayers returns an array of all players in the game, then you treat that array like an individual player to get their list of primaries, then you use TakeWeapon to remove all weapons they have, not just the current one they're holding. I'm guessing a lot of that isn't intentional. If you explain what the script is supposed to do, I can help fix it.


SweetzIZ:

Also, I am confused with a few parts of your code that might cause issues.
player = GetPlayers();
current = player GetWeaponsListPrimaries();

...

player TakeWeapon(current);
GetPlayers returns an array of all players in the game, then you treat that array like an individual player to get their list of primaries, then you use TakeWeapon to remove all weapons they have, not just the current one they're holding. I'm guessing a lot of that isn't intentional. If you explain what the script is supposed to do, I can help fix it.


Oh well that code was just me fooling around. As in the first replay that is that's exactly what's happening. The player gets the weapon but immediately afterwards Samantha laughs and then the weapons and money are zeroed.
The meaning of the script is

function Award()
{
player = GetPlayers();
current = player GetWeaponsListPrimaries();
weapon = getWeapon("microwavegundw");
here = GetEnt("here", "targetname");
loot_t = GetEnt("loot_t", "targetname");
loot_t SetHintString("Press &&1 to turn on");
loot_t SetCursorHint("HINT_NOICON");
loot_t waittill("trigger", player);
loot_t Delete();
wait 1;
player PlaySoundWithNotify("award01", "soundcomplete");
player waittill("soundcomplete");
wait 15;
player PlaySoundWithNotify("award02", "soundcomplete");
player waittill("soundcomplete");
wait 10;
player PlaySoundWithNotify("award03", "soundcomplete");
player waittill("soundcomplete");
//At this point GIVE WEAPON TO PLAYER
player TakeWeapon(current);
wait 1;
player GiveWeapon(weapon);
player SwitchToWeapon(weapon);
wait 3;
thread zm_powerups::specific_powerup_drop("full_ammo", here.origin);
iPrintLn("complete");
}

i first try to display the weapon like a wallbuy that the player only could see when the script was done.
so to compile it all i would like the weapon to "spawn" so the player could chose to grab it or not.
or leave it for a team mate.
like the easter eggs in when a weapon amerges from anywhere.

That wolud be amazing :D
and thank you for replaying

"Sorry for bad English"


xdferpc:

I what I would do in your place would be to spawn a random weapon powerup
You can download it here: credits to NSZ
https://mega.nz/file/N0tX2CTS#z283LneG6-XG4aHt4k6kcWSvgVEPJyxLjb1nRGAFYS8
It would only be to put this:
in the .GSC

thread zm_powerups::specific_powerup_drop("weapon","in your origin".origin);


SweetzIZ:

I what I would do in your place would be to spawn a random weapon powerup
You can download it here: credits to NSZ
https://mega.nz/file/N0tX2CTS#z283LneG6-XG4aHt4k6kcWSvgVEPJyxLjb1nRGAFYS8
It would only be to put this:
in the .GSC
thread zm_powerups::specific_powerup_drop("weapon","in your origin".origin);



I will give it a try (y)


SweetzIZ:

I what I would do in your place would be to spawn a random weapon powerup
You can download it here: credits to NSZ
https://mega.nz/file/N0tX2CTS#z283LneG6-XG4aHt4k6kcWSvgVEPJyxLjb1nRGAFYS8
It would only be to put this:
in the .GSC
thread zm_powerups::specific_powerup_drop("weapon","in your origin".origin);



Do you know if you can get a custom gun here insted to put it in the power_up script?
becuse i dont want i to randomly spawn in the map XD
thread zm_powerups::specific_powerup_drop(CUSTOM GUN ??, here1.origin);


xdferpc:

Do you know if you can get a custom gun here insted to put it in the power_up script?
becuse i dont want i to randomly spawn in the map XD
thread zm_powerups::specific_powerup_drop(CUSTOM GUN ??, here1.origin);

no don't change it leave it as I put it
To change the weapon that spawn, you have to edit the nsz_powerup_weapon.gsc that is located in Call of Duty Black Ops III \ share \ raw \ scripts \ _NSZ


SweetzIZ:

no don't change it leave it as I put it
To change the weapon that spawn, you have to edit the nsz_powerup_weapon.gsc that is located in Call of Duty Black Ops III \ share \ raw \ scripts \ _NSZ


well then the weapone that i chose will spawn on the map as a power up?


xdferpc:

yes


SweetzIZ:

yes


quick question how to you set a hint string to none ?


xdferpc:

You mean this ?

"your name Trigger" SetHintString(" ");
"your name Trigger" SetCursorHint("HINT_NOICON");


SweetzIZ:

You mean this ?

"your name Trigger" SetHintString(" ");
"your name Trigger" SetCursorHint("HINT_NOICON");




Thank you so much :D