Game Modding | Call of Duty: Black Ops 3 | Scripting
Qelifern:
I've created a craftable which works, it gives you a weapon (much like the shield craftable).
zm_craftables::craftable_trigger_think( "craft_staff_ice_zm_craftable_trigger", STAFF_ICE_NAME, STAFF_ICE_WEAPON, "Hold ^3&&1^7 to take Staff of Ice", DELETE_TRIGGER, PERSISTENT );
However I want the trigger that gives you the weapon to disappear after you've taken it from the crafting station. And if at anytime you lose the weapon it should be up for grabs again. (checks all players weapons if the ice staff is there, if not = it should become available for pickup) similar to Origins.
changing the value "PERSISTENT" to:
#define UNCRAFT 3
#define ONE_USE_AND_FLY 2
#define PERSISTENT 1
#define ONE_TIME_CRAFT 0
doesnt work since any of the other options wont have the desired effect
Been sat here for some time now and I'm stuck on what to do....
Magicman:
I don't know if this will be satisfactory, but what you could do is have a barrier spawn in when someone has the staff. For example, if someone picks up the staff, then a "wall" will spawn around the trigger and block other people from getting it. The script was created by @mathfag. You can implement the code then in radiant add a script_brushmodel around the trigger for the staff and give it the targetname "no_gun_barricade" When someone has the staff, it will show, and when someone does not have it, it will disappear. Hope that made sense. Also, where it says PUT NAME OF STAFF HERE in the script, obviously put the name of the staff.
main:
thread no_gun_area();
bottom of mapname.gsc:
function autoexec no_gun_area()
{
models_clips = GetEntArray("no_gun_barricade","targetname");
while(1)
{
foreach(player in GetPlayers())
{
if(player chech_area_gun())
{
foreach(mod in models_clips)
mod SetVisibleToPlayer(player);
IPrintLn("show models");
}
else
{
foreach(mod in models_clips)
mod SetInvisibleToPlayer(player,1);
}
}
wait 0.05;
}
}
function chech_area_gun() //self = player
{
guns = array("PUT NAME OF STAFF HERE");
foreach(gun in guns)
{
if(self HasWeapon(GetWeapon(gun), 1))
return 1;
}
return 0;
}
Qelifern:
I don't know if this will be satisfactory, but what you could do is have a barrier spawn in when someone has the staff. For example, if someone picks up the staff, then a "wall" will spawn around the trigger and block other people from getting it. The script was created by @mathfag. You can implement the code then in radiant add a script_brushmodel around the trigger for the staff and give it the targetname "no_gun_barricade" When someone has the staff, it will show, and when someone does not have it, it will disappear. Hope that made sense. Also, where it says PUT NAME OF STAFF HERE in the script, obviously put the name of the staff.
Magicman:
That has worked like a charm, thank you and thanks to mathfag :)
Qelifern:
No problem, well done on the craftables. Did you create the staff personally or are you using harry's?