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

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. [Support] Code for distance meter for trickshots?

[Support] Code for distance meter for trickshots?

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
27 Posts 10 Posters 1.2k 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.
  • undefined Offline
    undefined Offline
    Duui YT
    wrote on Jun 15, 2020, 3:29 AM last edited by Duui YT Jun 15, 2020, 6:30 AM
    #21

    so i did do some research on it but can't get it. so this what happens when i die it says (X m away) and not when i kill someone so when i die it says it so how can i make it not say it when i die and i did try calling it on onplayerdamge but that did not work

    undefined 1 Reply Last reply Jun 15, 2020, 1:08 PM
    0
    • undefined Offline
      undefined Offline
      Sass Plutonium Staff
      replied to Duui YT on Jun 15, 2020, 1:08 PM last edited by
      #22

      If you want it to show when you kill someone, then don't remove attacker, simple as that. If you want it to show for everyone, maybe do something like a foreach(player in level.players) and use player instead of attacker ?

      I don't know, there are plenty of ways to do this, you have to give it more thought than that.

      1 Reply Last reply
      3
      • undefined Offline
        undefined Offline
        Duui YT
        wrote on Jun 15, 2020, 4:17 PM last edited by
        #23

        so i did do some research on how to use foreach. so i did it like this still the same thing

        onPlayerKilled(einflictor, attacker, idamage, smeansofdeath, sweapon, vdir, shitloc, psoffsettime, deathanimduration)
        {
            foreach(player in level.players)
            {
                thread [[level.onkillscore]] (einflictor, attacker, idamage, smeansofdeath, sweapon, vdir, shitloc, psoffsettime, deathanimduration);
                // ^ this is here so you can still score normally
        
                player iPrintLn(int(distance(self.origin, attacker.origin) * 0.0254) + "m away");
            }
        } 
        
        undefined 1 Reply Last reply Jun 15, 2020, 6:07 PM
        0
        • undefined Offline
          undefined Offline
          Sass Plutonium Staff
          replied to Duui YT on Jun 15, 2020, 6:07 PM last edited by Sass Jun 15, 2020, 9:18 PM
          #24

          The script you've made gives point to every player once you get a kill... This isn't about "doing research" at this point, this is about knowing how to script at all.

          The following should work, but PLEASE take some time to LEARN how to do such simple tweaks :

          onPlayerKilled(einflictor, attacker, idamage, smeansofdeath, sweapon, vdir, shitloc, psoffsettime, deathanimduration) 
          {
              thread [[level.onkillscore]](einflictor, attacker, idamage, smeansofdeath, sweapon, vdir, shitloc, psoffsettime, deathanimduration);
              foreach(player in level.players)
              	player iPrintLn( attacker.name + " killed " + self.name + " from " + int(distance(self.origin, attacker.origin)*0.0254) + "m away");
          }
          
          1 Reply Last reply
          2
          • undefined Offline
            undefined Offline
            gunji Contributor
            wrote on Jan 12, 2021, 5:26 AM last edited by
            #25
            This post is deleted!
            undefined undefined 2 Replies Last reply Jan 12, 2021, 9:14 PM
            0
            • undefined Offline
              undefined Offline
              birchy
              replied to gunji on Jan 12, 2021, 9:14 PM last edited by
              #26

              gunji you can check on player kill whether or not the player/teams score is equal to that of the score required to win the mode.

              1 Reply Last reply
              0
              • undefined Offline
                undefined Offline
                mikzy Banned
                replied to gunji on Jan 16, 2021, 8:03 PM last edited by
                #27

                gunji you just check if the attacker is on last, nothing to do with the gameended notify

                1 Reply Last reply
                0

                • 1
                • 2
                • Login

                • Don't have an account? Register

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