Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate
Collapse

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. [Support] Help with script for certain map

[Support] Help with script for certain map

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
7 Posts 3 Posters 109 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z3NlTH-Dr4G0Nundefined Offline
    Z3NlTH-Dr4G0Nundefined Offline
    Z3NlTH-Dr4G0N
    wrote on last edited by
    #1

    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?

    JezuzLizardundefined 1 Reply Last reply
    0
    • Z3NlTH-Dr4G0Nundefined Offline
      Z3NlTH-Dr4G0Nundefined Offline
      Z3NlTH-Dr4G0N
      wrote on last edited by
      #2

      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;
      				}
      			}
      		}
      }
      
      
      1 Reply Last reply
      0
      • JezuzLizardundefined Offline
        JezuzLizardundefined Offline
        JezuzLizard Plutonium Staff
        replied to Z3NlTH-Dr4G0N on last edited by
        #3

        @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.

        1 Reply Last reply
        1
        • Meat Missileundefined Offline
          Meat Missileundefined Offline
          Meat Missile
          wrote on last edited by Meat Missile
          #4
          is_classic() 
          

          for classic maps

          !is_classic()
          

          for non classic maps

          1 Reply Last reply
          0
          • Z3NlTH-Dr4G0Nundefined Offline
            Z3NlTH-Dr4G0Nundefined Offline
            Z3NlTH-Dr4G0N
            wrote on last edited by
            #5

            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...

            JezuzLizardundefined 1 Reply Last reply
            0
            • JezuzLizardundefined Offline
              JezuzLizardundefined Offline
              JezuzLizard Plutonium Staff
              replied to Z3NlTH-Dr4G0N on last edited by
              #6

              @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.

              Z3NlTH-Dr4G0Nundefined 1 Reply Last reply
              0
              • Z3NlTH-Dr4G0Nundefined Offline
                Z3NlTH-Dr4G0Nundefined Offline
                Z3NlTH-Dr4G0N
                replied to JezuzLizard on last edited by
                #7

                JezuzLizard Ok then, I'll see what I can do. Thnak you.

                1 Reply Last reply
                0

                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Donate