[Support] Help with script for certain map
-
Greetings, I would like to know how I can make a script only work in town/farm/bus depot survival. What do I have to use alongside level.script == "transit" to make it work only on survival maps?
-
Also, any idea why the following script doesn't work (it is supposed to double headshot damage to mimck the perma perk on maps that don't have it.
#include maps/mp/zombies/_zm; #include maps/mp/zombies/_zm_utility; #include maps/mp/gametypes_zm/_weapons; init() { if (level.script == "zm_nuked" || level.script == "zm_tomb" || level.script == "zm_prison") //plus town survival { replaceFunc(maps/mp/zombies/_zm::actor_damage_override, actor_damage_overoverride); } } actor_damage_overoverride( inflictor, attacker, damage, flags, meansofdeath, weapon, vpoint, vdir, shitloc, psoffsettime, boneindex ) { if ( !isdefined( self ) || !isdefined( attacker ) ) return damage; if ( weapon == "tazer_knuckles_zm" || weapon == "jetgun_zm" ) self.knuckles_extinguish_flames = 1; else if ( weapon != "none" ) self.knuckles_extinguish_flames = undefined; if ( isdefined( attacker.animname ) && attacker.animname == "quad_zombie" ) { if ( isdefined( self.animname ) && self.animname == "quad_zombie" ) return 0; } if ( !isplayer( attacker ) && isdefined( self.non_attacker_func ) ) { if ( isdefined( self.non_attack_func_takes_attacker ) && self.non_attack_func_takes_attacker ) return self [[ self.non_attacker_func ]]( damage, weapon, attacker ); else return self [[ self.non_attacker_func ]]( damage, weapon ); } if ( !isplayer( attacker ) && !isplayer( self ) ) return damage; if ( !isdefined( damage ) || !isdefined( meansofdeath ) ) return damage; if ( meansofdeath == "" ) return damage; old_damage = damage; final_damage = damage; if ( isdefined( self.actor_damage_func ) ) final_damage = [[ self.actor_damage_func ]]( inflictor, attacker, damage, flags, meansofdeath, weapon, vpoint, vdir, shitloc, psoffsettime, boneindex ); if ( attacker.classname == "script_vehicle" && isdefined( attacker.owner ) ) attacker = attacker.owner; if ( isdefined( self.in_water ) && self.in_water ) { if ( int( final_damage ) >= self.health ) self.water_damage = 1; } attacker thread maps/mp/gametypes_zm/_weapons::checkhit( weapon ); if(maps/mp/zombies/_zm_utility::is_headshot(weapon, shitloc, meansofdeath)) { if(meansofdeath == "MOD_PISTOL_BULLET" || meansofdeath == "MOD_RIFLE_BULLET") { if(!isSubStr(weaponClass(weapon), "spread") || maps/mp/zombies/_zm_weapons::get_base_weapon_name(weapon, 1) == "ksg_zm") { final_damage *= 2; } } } }
-
@P00DL3W0Lf_GR You can get the dvar "g_gametype" and the location dvar "ui_zm_mapstartlocation". On Survival maps the g_gametype is "zstandard" and the location is "transit" for Bus Depot, "town" for Town, and "farm" for Farm.
-
is_classic()
for classic maps
!is_classic()
for non classic maps
-
Thanks for the help, I made it so that some of my scripts work only on survival maps. However, I cannot for the life of me get the script I posted (double headshot damage) to work, tried a lot of stuff but nothing. I just went off from the stock script but I cannot figure out what I'm doing wrong...
-
@P00DL3W0Lf_GR I don't think replaceFunc() in T6 works on function pointers. You can just set the function pointer that actor_damage_override is stored in to your function.
-
JezuzLizard Ok then, I'll see what I can do. Thnak you.