Game Modding | Call of Duty: Black Ops 3 | Scripting
ModmeBot:
Thread By: ByKris How can remove damage by fall?
ModmeBot:
Reply By: natesmithzombies You need to override the stock player_damage_override function. To do so:
1) paste this at the bottom of your mapname.gsc
functionplayer_damage_override(eInflictor,eAttacker,iDamage,iDFlags,sMeansOfDeath,weapon,vPoint,vDir,sHitLoc,psOffsetTime){iDamage=selfcheck_player_damage_callbacks(eInflictor,eAttacker,iDamage,iDFlags,sMeansOfDeath,weapon,vPoint,vDir,sHitLoc,psOffsetTime);if(sMeansOfDeath=="MOD_FALLING")// No Fall Damagereturn0;if(self.scene_takedamage===false){return0;}if(IS_TRUE(self.use_adjusted_grenade_damage)){self.use_adjusted_grenade_damage=undefined;if((self.health>iDamage)){returniDamage;}}if(!iDamage){return0;}// WW (8/20/10) - Sledgehammer fix for Issue 43492. This should stop the player from taking any damage while in laststandif(selflaststand::player_is_in_laststand()){return0;}if(isDefined(eInflictor)){if(IS_TRUE(eInflictor.water_damage)){return0;}}if(isDefined(eAttacker)){if(IS_EQUAL(eAttacker.owner,self)){return0;}if(isDefined(self.ignoreAttacker)&&self.ignoreAttacker==eAttacker){return0;}// AR (5/30/12) - Stop Zombie players from damaging other Zombie playersif(IS_TRUE(self.is_zombie)&&IS_TRUE(eAttacker.is_zombie)){return0;}if((isDefined(eAttacker.is_zombie)&&eAttacker.is_zombie)){self.ignoreAttacker=eAttacker;selfthreadremove_ignore_attacker();if(isdefined(eAttacker.custom_damage_func)){iDamage=eAttacker[[eAttacker.custom_damage_func]](self);}}eAttackernotify("hit_player");if(isdefined(eAttacker)&&isdefined(eAttacker.func_mod_damage_override)){sMeansOfDeath=eAttacker[[eAttacker.func_mod_damage_override]](eInflictor,sMeansOfDeath,weapon);}if(sMeansOfDeath!="MOD_FALLING"){selfthreadplaySwipeSound(sMeansOfDeath,eattacker);if(IS_TRUE(eattacker.is_zombie)||IsPlayer(eAttacker))selfPlayRumbleOnEntity("damage_heavy");if(IS_TRUE(eattacker.is_zombie)){selfzm_audio::create_and_play_dialog("general","attacked");}canExert=true;if(IS_TRUE(level.pers_upgrade_flopper)){// If the player has persistent flopper power, then no exert on explosionif(IS_TRUE(self.pers_upgrades_awarded["flopper"])){canExert=(sMeansOfDeath!="MOD_PROJECTILE_SPLASH"&&sMeansOfDeath!="MOD_GRENADE"&&sMeansOfDeath!="MOD_GRENADE_SPLASH");}}if(IS_TRUE(canExert)){if(RandomIntRange(0,1)==0){selfthreadzm_audio::playerExert("hitmed");//self thread zm_audio::create_and_play_dialog( "general", "hitmed" );}else{selfthreadzm_audio::playerExert("hitlrg");//self thread zm_audio::create_and_play_dialog( "general", "hitlrg" );}}}}//Audio(RG:2/1/2016) adding underwater drowning exert.if(isDefined(sMeansOfDeath)&&sMeansOfDeath=="MOD_DROWN"){selfthreadzm_audio::playerExert("drowning",true);self.voxDrowning=true;}if(isdefined(level.perk_damage_override)){foreach(funcinlevel.perk_damage_override){n_damage=self[[func]](eInflictor,eAttacker,iDamage,iDFlags,sMeansOfDeath,weapon,vPoint,vDir,sHitLoc,psOffsetTime);if(isdefined(n_damage)){iDamage=n_damage;}}}finalDamage=iDamage;// claymores and freezegun shatters, like bouncing betties, harm no playersif(zm_utility::is_placeable_mine(weapon)){return0;}if(isDefined(self.player_damage_override)){selfthread[[self.player_damage_override]](eInflictor,eAttacker,iDamage,iDFlags,sMeansOfDeath,weapon,vPoint,vDir,sHitLoc,psOffsetTime);}if(sMeansOfDeath=="MOD_PROJECTILE"||sMeansOfDeath=="MOD_PROJECTILE_SPLASH"||sMeansOfDeath=="MOD_GRENADE"||sMeansOfDeath=="MOD_GRENADE_SPLASH"||sMeansOfDeath=="MOD_EXPLOSIVE"){// player explosive splash damage (caps explosive damage), fixes raygun damage being fatal (or grenades) when damaging yourselfif(!IS_TRUE(self.is_zombie)){// Don't do this for projectile damage coming from zombiesif(!isdefined(eAttacker)||(!IS_TRUE(eAttacker.is_zombie)&&!IS_TRUE(eAttacker.b_override_explosive_damage_cap))){// Only do it for ray gunif(isdefined(weapon.name)&&((weapon.name=="ray_gun")||(weapon.name=="ray_gun_upgraded"))){// Clamp it, we don't want to increase the damage from player raygun splash damage or grenade splash damage// Don't create more damage than we are trying to applyif((self.health>25)&&(iDamage>25)){return25;}}elseif((self.health>75)&&(iDamage>75)){return75;}}}}if(iDamage<self.health){if(IsDefined(eAttacker)){if(IsDefined(level.custom_kill_damaged_VO)){eAttackerthread[[level.custom_kill_damaged_VO]](self);}else{eAttacker.sound_damage_player=self;}if(IS_TRUE(eAttacker.missingLegs)){selfzm_audio::create_and_play_dialog("general","crawl_hit");}}// MM (08/10/09)returnfinalDamage;}//player diedif(isdefined(eAttacker)){if(isDefined(eAttacker.animname)&&eAttacker.animname=="zombie_dog"){selfzm_stats::increment_client_stat("killed_by_zdog");selfzm_stats::increment_player_stat("killed_by_zdog");}elseif(IS_TRUE(eAttacker.is_avogadro)){selfzm_stats::increment_client_stat("killed_by_avogadro",false);selfzm_stats::increment_player_stat("killed_by_avogadro");}}selfthreadclear_path_timers();if(level.intermission){levelwaittill("forever");}// AR (3/7/12) - Keep track of which player killed player in Zombify modes like Cleansed / Turned// Confirmed with Alex if(level.scr_zm_ui_gametype=="zcleansed"&&iDamage>0){if(IsDefined(eAttacker)&&IsPlayer(eAttacker)&&eAttacker.team!=self.team&&((!IS_TRUE(self.laststand)&&!selflaststand::player_is_in_laststand())||!IsDefined(self.last_player_attacker))){// Restore Health To Zombie Player//--------------------------------if(IsDefined(eAttacker.maxhealth)&&IS_TRUE(eAttacker.is_zombie)){eAttacker.health=eAttacker.maxhealth;}//self.last_player_attacker = eAttacker;if(IsDefined(level.player_kills_player)){selfthread[[level.player_kills_player]](eInflictor,eAttacker,iDamage,iDFlags,sMeansOfDeath,weapon,vPoint,vDir,sHitLoc,psOffsetTime);}}}if(self.lives>0&&selfHasPerk(PERK_WHOSWHO)){self.lives--;if(IsDefined(level.whoswho_laststand_func)){selfthread[[level.whoswho_laststand_func]]();return0;}}players=GetPlayers();count=0;for(i=0;i<players.size;i++){if(players[i]==self||players[i].is_zombie||players[i]laststand::player_is_in_laststand()||players[i].sessionstate=="spectator"){count++;}}if(count<players.size||(isDefined(level._game_module_game_end_check)&&![[level._game_module_game_end_check]]())){if(IsDefined(self.lives)&&self.lives>0&&IS_TRUE(level.force_solo_quick_revive)&&selfHasPerk(PERK_QUICK_REVIVE)){selfthreadwait_and_revive();}// MM (08/10/09)returnfinalDamage;}// PORTIZ 7/27/16: added level.no_end_game_check here, because if it's true by this point, this function will end up returning finalDamage anyway. additionally, // no_end_game_check has been updated to support incrementing/decrementing, which makes it more robust than a single level.check_end_solo_game_override as more// mechanics are introduced that require solo players to go into last stand instead of losing the game immediatelyif(players.size==1&&levelflag::get("solo_game")){if(IS_TRUE(level.no_end_game_check)||(isdefined(level.check_end_solo_game_override)&&[[level.check_end_solo_game_override]]())){returnfinalDamage;}elseif(self.lives==0||!selfHasPerk(PERK_QUICK_REVIVE)){self.intermission=true;}}// WW (01/05/11): When a two players enter a system link game and the client drops the host will be treated as if it was a solo game// when it wasn't. This led to SREs about undefined and int being compared on death (self.lives was never defined on the host). While// adding the check for the solo game flag we found that we would have to create a complex OR inside of the if check below. By breaking// the conditions out in to their own variables we keep the complexity without making it look like a mess.solo_death=(players.size==1&&levelflag::get("solo_game")&&(self.lives==0||!selfHasPerk(PERK_QUICK_REVIVE)));// there is only one player AND the flag is set AND self.lives equals 0non_solo_death=((count>1||(players.size==1&&!levelflag::get("solo_game")))/*&& !level.is_zombie_level*/);// the player size is greater than one OR ( players.size equals 1 AND solo flag isn't set ) AND not a zombify game levelif((solo_death||non_solo_death)&&!IS_TRUE(level.no_end_game_check))// if only one player on their last life or any game that started with more than one player{levelnotify("stop_suicide_trigger");selfAllowProne(true);//just in caseselfthreadzm_laststand::PlayerLastStand(eInflictor,eAttacker,iDamage,sMeansOfDeath,weapon,vDir,sHitLoc,psOffsetTime);if(!isdefined(vDir)){vDir=(1.0,0.0,0.0);}selfFakeDamageFrom(vDir);levelnotify("last_player_died");if(isdefined(level.custom_player_fake_death))selfthread[[level.custom_player_fake_death]](vDir,sMeansOfDeath);elseselfthreadplayer_fake_death();}if(count==players.size&&!IS_TRUE(level.no_end_game_check)){if(players.size==1&&levelflag::get("solo_game")){if(self.lives==0||!selfHasPerk(PERK_QUICK_REVIVE))// && !self laststand::player_is_in_laststand(){self.lives=0;levelnotify("pre_end_game");util::wait_network_frame();if(levelflag::get("dog_round")){increment_dog_round_stat("lost");}levelnotify("end_game");}else{returnfinalDamage;}}else{levelnotify("pre_end_game");util::wait_network_frame();if(levelflag::get("dog_round")){increment_dog_round_stat("lost");}levelnotify("end_game");}return0;// MM (09/16/09) Need to return something}else{// MM (08/10/09)surface="flesh";returnfinalDamage;}}functionno_fall_damage(){levelflag::wait_till("all_players_connected");// wait some time to overwrite the original level.overridePlayerDamage=&player_damage_override;}
2) Place this in function main() of your mapname.gsc :
levelthreadno_fall_damage();
Edit: Something is pretty wacked out with the copy and paste of code. Here is the 2 functions in a paste link
ModmeBot:
Reply By: ByKris
natesmithzombiesYou need to override the stock player_damage_override function. To do so:
1) paste this at the bottom of your mapname.gsc
functionplayer_damage_override(eInflictor,eAttacker,iDamage,iDFlags,sMeansOfDeath,weapon,vPoint,vDir,sHitLoc,psOffsetTime){iDamage=selfcheck_player_damage_callbacks(eInflictor,eAttacker,iDamage,iDFlags,sMeansOfDeath,weapon,vPoint,vDir,sHitLoc,psOffsetTime);if(sMeansOfDeath=="MOD_FALLING")// No Fall Damagereturn0;if(self.scene_takedamage===false){return0;}if(IS_TRUE(self.use_adjusted_grenade_damage)){self.use_adjusted_grenade_damage=undefined;if((self.health>iDamage)){returniDamage;}}if(!iDamage){return0;}// WW (8/20/10) - Sledgehammer fix for Issue 43492. This should stop the player from taking any damage while in laststandif(selflaststand::player_is_in_laststand()){return0;}if(isDefined(eInflictor)){if(IS_TRUE(eInflictor.water_damage)){return0;}}if(isDefined(eAttacker)){if(IS_EQUAL(eAttacker.owner,self)){return0;}if(isDefined(self.ignoreAttacker)&&self.ignoreAttacker==eAttacker){return0;}// AR (5/30/12) - Stop Zombie players from damaging other Zombie playersif(IS_TRUE(self.is_zombie)&&IS_TRUE(eAttacker.is_zombie)){return0;}if((isDefined(eAttacker.is_zombie)&&eAttacker.is_zombie)){self.ignoreAttacker=eAttacker;selfthreadremove_ignore_attacker();if(isdefined(eAttacker.custom_damage_func)){iDamage=eAttacker[[eAttacker.custom_damage_func]](self);}}eAttackernotify("hit_player");if(isdefined(eAttacker)&&isdefined(eAttacker.func_mod_damage_override)){sMeansOfDeath=eAttacker[[eAttacker.func_mod_damage_override]](eInflictor,sMeansOfDeath,weapon);}if(sMeansOfDeath!="MOD_FALLING"){selfthreadplaySwipeSound(sMeansOfDeath,eattacker);if(IS_TRUE(eattacker.is_zombie)||IsPlayer(eAttacker))selfPlayRumbleOnEntity("damage_heavy");if(IS_TRUE(eattacker.is_zombie)){selfzm_audio::create_and_play_dialog("general","attacked");}canExert=true;if(IS_TRUE(level.pers_upgrade_flopper)){// If the player has persistent flopper power, then no exert on explosionif(IS_TRUE(self.pers_upgrades_awarded["flopper"])){canExert=(sMeansOfDeath!="MOD_PROJECTILE_SPLASH"&&sMeansOfDeath!="MOD_GRENADE"&&sMeansOfDeath!="MOD_GRENADE_SPLASH");}}if(IS_TRUE(canExert)){if(RandomIntRange(0,1)==0){selfthreadzm_audio::playerExert("hitmed");//self thread zm_audio::create_and_play_dialog( "general", "hitmed" );}else{selfthreadzm_audio::playerExert("hitlrg");//self thread zm_audio::create_and_play_dialog( "general", "hitlrg" );}}}}//Audio(RG:2/1/2016) adding underwater drowning exert.if(isDefined(sMeansOfDeath)&&sMeansOfDeath=="MOD_DROWN"){selfthreadzm_audio::playerExert("drowning",true);self.voxDrowning=true;}if(isdefined(level.perk_damage_override)){foreach(funcinlevel.perk_damage_override){n_damage=self[[func]](eInflictor,eAttacker,iDamage,iDFlags,sMeansOfDeath,weapon,vPoint,vDir,sHitLoc,psOffsetTime);if(isdefined(n_damage)){iDamage=n_damage;}}}finalDamage=iDamage;// claymores and freezegun shatters, like bouncing betties, harm no playersif(zm_utility::is_placeable_mine(weapon)){return0;}if(isDefined(self.player_damage_override)){selfthread[[self.player_damage_override]](eInflictor,eAttacker,iDamage,iDFlags,sMeansOfDeath,weapon,vPoint,vDir,sHitLoc,psOffsetTime);}if(sMeansOfDeath=="MOD_PROJECTILE"||sMeansOfDeath=="MOD_PROJECTILE_SPLASH"||sMeansOfDeath=="MOD_GRENADE"||sMeansOfDeath=="MOD_GRENADE_SPLASH"||sMeansOfDeath=="MOD_EXPLOSIVE"){// player explosive splash damage (caps explosive damage), fixes raygun damage being fatal (or grenades) when damaging yourselfif(!IS_TRUE(self.is_zombie)){// Don't do this for projectile damage coming from zombiesif(!isdefined(eAttacker)||(!IS_TRUE(eAttacker.is_zombie)&&!IS_TRUE(eAttacker.b_override_explosive_damage_cap))){// Only do it for ray gunif(isdefined(weapon.name)&&((weapon.name=="ray_gun")||(weapon.name=="ray_gun_upgraded"))){// Clamp it, we don't want to increase the damage from player raygun splash damage or grenade splash damage// Don't create more damage than we are trying to applyif((self.health>25)&&(iDamage>25)){return25;}}elseif((self.health>75)&&(iDamage>75)){return75;}}}}if(iDamage<self.health){if(IsDefined(eAttacker)){if(IsDefined(level.custom_kill_damaged_VO)){eAttackerthread[[level.custom_kill_damaged_VO]](self);}else{eAttacker.sound_damage_player=self;}if(IS_TRUE(eAttacker.missingLegs)){selfzm_audio::create_and_play_dialog("general","crawl_hit");}}// MM (08/10/09)returnfinalDamage;}//player diedif(isdefined(eAttacker)){if(isDefined(eAttacker.animname)&&eAttacker.animname=="zombie_dog"){selfzm_stats::increment_client_stat("killed_by_zdog");selfzm_stats::increment_player_stat("killed_by_zdog");}elseif(IS_TRUE(eAttacker.is_avogadro)){selfzm_stats::increment_client_stat("killed_by_avogadro",false);selfzm_stats::increment_player_stat("killed_by_avogadro");}}selfthreadclear_path_timers();if(level.intermission){levelwaittill("forever");}// AR (3/7/12) - Keep track of which player killed player in Zombify modes like Cleansed / Turned// Confirmed with Alex if(level.scr_zm_ui_gametype=="zcleansed"&&iDamage>0){if(IsDefined(eAttacker)&&IsPlayer(eAttacker)&&eAttacker.team!=self.team&&((!IS_TRUE(self.laststand)&&!selflaststand::player_is_in_laststand())||!IsDefined(self.last_player_attacker))){// Restore Health To Zombie Player//--------------------------------if(IsDefined(eAttacker.maxhealth)&&IS_TRUE(eAttacker.is_zombie)){eAttacker.health=eAttacker.maxhealth;}//self.last_player_attacker = eAttacker;if(IsDefined(level.player_kills_player)){selfthread[[level.player_kills_player]](eInflictor,eAttacker,iDamage,iDFlags,sMeansOfDeath,weapon,vPoint,vDir,sHitLoc,psOffsetTime);}}}if(self.lives>0&&selfHasPerk(PERK_WHOSWHO)){self.lives--;if(IsDefined(level.whoswho_laststand_func)){selfthread[[level.whoswho_laststand_func]]();return0;}}players=GetPlayers();count=0;for(i=0;i<players.size;i++){if(players[i]==self||players[i].is_zombie||players[i]laststand::player_is_in_laststand()||players[i].sessionstate=="spectator"){count++;}}if(count<players.size||(isDefined(level._game_module_game_end_check)&&![[level._game_module_game_end_check]]())){if(IsDefined(self.lives)&&self.lives>0&&IS_TRUE(level.force_solo_quick_revive)&&selfHasPerk(PERK_QUICK_REVIVE)){selfthreadwait_and_revive();}// MM (08/10/09)returnfinalDamage;}// PORTIZ 7/27/16: added level.no_end_game_check here, because if it's true by this point, this function will end up returning finalDamage anyway. additionally, // no_end_game_check has been updated to support incrementing/decrementing, which makes it more robust than a single level.check_end_solo_game_override as more// mechanics are introduced that require solo players to go into last stand instead of losing the game immediatelyif(players.size==1&&levelflag::get("solo_game")){if(IS_TRUE(level.no_end_game_check)||(isdefined(level.check_end_solo_game_override)&&[[level.check_end_solo_game_override]]())){returnfinalDamage;}elseif(self.lives==0||!selfHasPerk(PERK_QUICK_REVIVE)){self.intermission=true;}}// WW (01/05/11): When a two players enter a system link game and the client drops the host will be treated as if it was a solo game// when it wasn't. This led to SREs about undefined and int being compared on death (self.lives was never defined on the host). While// adding the check for the solo game flag we found that we would have to create a complex OR inside of the if check below. By breaking// the conditions out in to their own variables we keep the complexity without making it look like a mess.solo_death=(players.size==1&&levelflag::get("solo_game")&&(self.lives==0||!selfHasPerk(PERK_QUICK_REVIVE)));// there is only one player AND the flag is set AND self.lives equals 0non_solo_death=((count>1||(players.size==1&&!levelflag::get("solo_game")))/*&& !level.is_zombie_level*/);// the player size is greater than one OR ( players.size equals 1 AND solo flag isn't set ) AND not a zombify game levelif((solo_death||non_solo_death)&&!IS_TRUE(level.no_end_game_check))// if only one player on their last life or any game that started with more than one player{levelnotify("stop_suicide_trigger");selfAllowProne(true);//just in caseselfthreadzm_laststand::PlayerLastStand(eInflictor,eAttacker,iDamage,sMeansOfDeath,weapon,vDir,sHitLoc,psOffsetTime);if(!isdefined(vDir)){vDir=(1.0,0.0,0.0);}selfFakeDamageFrom(vDir);levelnotify("last_player_died");if(isdefined(level.custom_player_fake_death))selfthread[[level.custom_player_fake_death]](vDir,sMeansOfDeath);elseselfthreadplayer_fake_death();}if(count==players.size&&!IS_TRUE(level.no_end_game_check)){if(players.size==1&&levelflag::get("solo_game")){if(self.lives==0||!selfHasPerk(PERK_QUICK_REVIVE))// && !self laststand::player_is_in_laststand(){self.lives=0;levelnotify("pre_end_game");util::wait_network_frame();if(levelflag::get("dog_round")){increment_dog_round_stat("lost");}levelnotify("end_game");}else{returnfinalDamage;}}else{levelnotify("pre_end_game");util::wait_network_frame();if(levelflag::get("dog_round")){increment_dog_round_stat("lost");}levelnotify("end_game");}return0;// MM (09/16/09) Need to return something}else{// MM (08/10/09)surface="flesh";returnfinalDamage;}}functionno_fall_damage(){levelflag::wait_till("all_players_connected");// wait some time to overwrite the original level.overridePlayerDamage=&player_damage_override;}
2) Place this in function main() of your mapname.gsc :
levelthreadno_fall_damage();
Edit: Something is pretty wacked out with the copy and paste of code. Here is the 2 functions in a paste link