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

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. Having trouble making a script that gives the player Unlimited sprint on player spawn.

Having trouble making a script that gives the player Unlimited sprint on player spawn.

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
11 Posts 5 Posters 433 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.
  • Xerxesundefined Offline
    Xerxesundefined Offline
    Xerxes Plutonium Staff
    wrote on last edited by
    #2

    You have to call your function on the player entity. Like welcome.

    Unfunny_Umiundefined 1 Reply Last reply
    1
    • Unfunny_Umiundefined Offline
      Unfunny_Umiundefined Offline
      Unfunny_Umi
      replied to Xerxes on last edited by
      #3

      Xerxes Thank you. Could you give me an example?

      Resxtundefined 1 Reply Last reply
      0
      • Resxtundefined Offline
        Resxtundefined Offline
        Resxt Plutonium Staff
        replied to Unfunny_Umi on last edited by Resxt
        #4

        Unfunny_Umi "like welcome" so just do the same
        In code there is always two steps:

        • Declaring a piece of code to make it available
        • Calling that piece of code (function) to actually use it

        Right now you're declaring the unlimited_sprint function, it exists, but it is never called/used on any entity.
        It just sits there but it's never used. Declaring a function doesn't do anything more than making it available.

        You added thread unlimited_sprint() but you don't thread on any object.
        You need to call the function on something (the level, a player etc.)

        So move this below player thread welcome() like Xerxes said.

        for (;;)
        {
            level waittill("connecting", player);
            player thread welcome();
            player thread unlimited_sprint();
        }
        

        This way you are saying "when a player connects thread the unlimited_sprint function on him on that particular player

        Unfunny_Umiundefined 1 Reply Last reply
        2
        • Unfunny_Umiundefined Offline
          Unfunny_Umiundefined Offline
          Unfunny_Umi
          replied to Resxt on last edited by
          #5

          Resxt You guys are the best. Genuinely, thank you so much.
          I got it working! Much Love!

          1 Reply Last reply
          1
          • Eleven111undefined Offline
            Eleven111undefined Offline
            Eleven111
            replied to Unfunny_Umi on last edited by Eleven111
            #6

            Unfunny_Umi hey I've tried using your script but it did not work here is the script can you tell if it's correct I
            have no experience with coding

            init()
            {
            thread unlimited_sprint();
            for (;;)
            {
            level waittill("connecting", player);
            player thread welcome();
            player thread unlimited_sprint();
            }
            }

            unlimited_sprint()
            {
            self waittill("spawned_player");
            self setperk("specialty_unlimitedsprint");
            }
            welcome()

            {
            self endon("disconnect");
            self waittill("spawned_player");

            }

            Resxtundefined 1 Reply Last reply
            0
            • Resxtundefined Offline
              Resxtundefined Offline
              Resxt Plutonium Staff
              replied to Eleven111 on last edited by
              #7

              Eleven111 the guy was asking for help coz his script didn't work so copy pasting it will obviously not work. Read the answers

              Eleven111undefined 1 Reply Last reply
              0
              • Eleven111undefined Offline
                Eleven111undefined Offline
                Eleven111
                replied to Resxt on last edited by Eleven111
                #8

                Resxt I understand but you helped him with the code and he said it worked for him that's why I was asking him about it, because I tried using the code and I added that correct code that u mentioned and still did not work. any help would be appreciated

                Resxtundefined 1 Reply Last reply
                0
                • Resxtundefined Offline
                  Resxtundefined Offline
                  Resxt Plutonium Staff
                  replied to Eleven111 on last edited by
                  #9

                  Eleven111 the code you've shown does not contain the modified code

                  1 Reply Last reply
                  0
                  • Eleven111undefined Offline
                    Eleven111undefined Offline
                    Eleven111
                    wrote on last edited by
                    #10

                    would you please help with the code. I'm illiterate when it comes to coding

                    Deicideundefined 1 Reply Last reply
                    0
                    • Deicideundefined Offline
                      Deicideundefined Offline
                      Deicide
                      replied to Eleven111 on last edited by Deicide
                      #11

                      Eleven111 I myself was confused from the jump as to how OP got the beginning code he posted. Most .gsc contain three main functions and they call like such.

                      init()
                      {
                          level thread onPlayerConnect();
                      }
                      
                      onPlayerConnect()
                      {
                          for(;;)
                          {
                              level waittill("connected", player); //waits until you are connected to the server, before you spawn in.
                              player thread onPlayerSpawned();
                          }
                      }
                      
                      onPlayerSpawned()
                      {
                          self endon("disconnect");
                          level endon("game_ended");
                          for(;;)
                          {
                              self waittill("spawned_player"); //anything after this happens after you spawn in. You cannot set perks on a player that is not spawned in yet.
                          }
                      }
                      

                      Simply set the perk after said player spawns in. That's really where your problem lies. 😊

                      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