Game Modding | Call of Duty: Black Ops 3 | Scripting
Zombieslayeraj:
I have most of the scripting for my map's easter egg done, however there is one thing I want which is for zombies to have a random chance to drop a hand that is used for another part of the easter egg. So far for testing and such I have left it in the middle of the room, but if someone could possibly help me to figure out how to make a zombie drop the part that would be incredible!
sharpgamers4you:
Hmmm this is really good, but i have no idea bro sorry, but will get back to you when I have something
MyNameIsNobody:
Maybe would be easier/better to spawn in one specific zombie that drops it that can spawn at random during a span of the next 3 rounds after "x" happens in the EE. But i cant script.
#precache( "model", "mario_sunshine_cap");#define CAP_DROP_CHANCE 10functionmario_cap_zom_spawn(){if(level.zombie_can_drop_cap==0)//check if zombie can drop cašreturn;if(!isdefined(zm_zonemgr::get_zone_from_position(self.origin,true)))//check if zom is in playable areareturn;if(RandomInt(100)>CAP_DROP_CHANCE)//drop chancereturn;level.zombie_can_drop_cap=0;v_land_pos=util::ground_position(self.origin+(0,0,100),300);cap=Spawn("script_model",v_land_pos);capSetModel("mario_sunshine_cap");capclientfield::set("sm64_keyline",1);trig=Spawn("trigger_radius_use",cap.origin+(0,0,32),0,32,32);trigSetCursorHint("HINT_NOICON");trigSetHintString("Press ^3[{+activate}]^7 to pick up");trigSetTeamForTrigger("allies");trigwaittill("trigger",player);trigDelete();capDelete();levelnotify("mario_cap_pickedup");}
#precache( "model", "mario_sunshine_cap");#define CAP_DROP_CHANCE 10functionmario_cap_zom_spawn(){if(level.zombie_can_drop_cap==0)//check if zombie can drop cašreturn;if(!isdefined(zm_zonemgr::get_zone_from_position(self.origin,true)))//check if zom is in playable areareturn;if(RandomInt(100)>CAP_DROP_CHANCE)//drop chancereturn;level.zombie_can_drop_cap=0;v_land_pos=util::ground_position(self.origin+(0,0,100),300);cap=Spawn("script_model",v_land_pos);capSetModel("mario_sunshine_cap");capclientfield::set("sm64_keyline",1);trig=Spawn("trigger_radius_use",cap.origin+(0,0,32),0,32,32);trigSetCursorHint("HINT_NOICON");trigSetHintString("Press ^3[{+activate}]^7 to pick up");trigSetTeamForTrigger("allies");trigwaittill("trigger",player);trigDelete();capDelete();levelnotify("mario_cap_pickedup");}
quick question, what is a level notify? Also thank you I will check if this works
#precache( "model", "mario_sunshine_cap");#define CAP_DROP_CHANCE 10functionmario_cap_zom_spawn(){if(level.zombie_can_drop_cap==0)//check if zombie can drop cašreturn;if(!isdefined(zm_zonemgr::get_zone_from_position(self.origin,true)))//check if zom is in playable areareturn;if(RandomInt(100)>CAP_DROP_CHANCE)//drop chancereturn;level.zombie_can_drop_cap=0;v_land_pos=util::ground_position(self.origin+(0,0,100),300);cap=Spawn("script_model",v_land_pos);capSetModel("mario_sunshine_cap");capclientfield::set("sm64_keyline",1);trig=Spawn("trigger_radius_use",cap.origin+(0,0,32),0,32,32);trigSetCursorHint("HINT_NOICON");trigSetHintString("Press ^3[{+activate}]^7 to pick up");trigSetTeamForTrigger("allies");trigwaittill("trigger",player);trigDelete();capDelete();levelnotify("mario_cap_pickedup");}
So I tried this, and I changed it to my model name right and I got
UNRECOVERABLE ERROR:
^1SCRIPT ERROR: No generated data for 'scripts/zm/zm_test.gsc'
RandomInt(100) makes a number between 0 and 99, not 1 and 100, and you used >, not >=. So with #define CAP_DROP_CHANCE 10, the numbers 0-10 are all not > 10, and all work. The way it is right now, the cap on your map has an 11% chance to spawn, not 10% like you wanted. You might not care, but in fringe cases like percentages below 5 it can feel like a much bigger difference. Hell, if someone set it to be 0% temporarily, it'd actually be 1%. What you'd want is
RandomInt(100) makes a number between 0 and 99, not 1 and 100, and you used >, not >=. So with #define CAP_DROP_CHANCE 10, the numbers 0-10 are all not > 10, and all work. The way it is right now, the cap on your map has an 11% chance to spawn, not 10% like you wanted. You might not care, but in fringe cases like percentages below 5 it can feel like a much bigger difference. Hell, if someone set it to be 0% temporarily, it'd actually be 1%. What you'd want is