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.
  • undefined Offline
    undefined Offline
    Unfunny_Umi
    wrote on Jul 1, 2022, 9:54 AM last edited by
    #1

    This is my first time actively trying to write and use a script, so I'm brand new to this. Not exactly sure what it is I'm doing wrong. I've gotten the game to load and the bootstrapper is telling me that it's able to execute the script (it doesn't kick me out of the game or anything). But the player sprint is still default, in-game. They sprint for a few seconds and then stop, as usual.
    Anyone know how I can fix this?
    This is the script.
    Screenshot (214).png

    undefined 1 Reply Last reply Mar 19, 2024, 1:44 AM
    0
    • undefined Offline
      undefined Offline
      Xerxes Plutonium Staff
      wrote on Jul 1, 2022, 10:04 AM last edited by
      #2

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

      undefined 1 Reply Last reply Jul 1, 2022, 5:49 PM
      1
      • undefined Offline
        undefined Offline
        Unfunny_Umi
        replied to Xerxes on Jul 1, 2022, 5:49 PM last edited by
        #3

        Xerxes Thank you. Could you give me an example?

        undefined 1 Reply Last reply Jul 1, 2022, 5:56 PM
        0
        • undefined Offline
          undefined Offline
          Resxt Plutonium Staff
          replied to Unfunny_Umi on Jul 1, 2022, 5:56 PM last edited by Resxt Jul 1, 2022, 8:57 PM
          #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

          undefined 1 Reply Last reply Jul 1, 2022, 8:50 PM
          2
          • undefined Offline
            undefined Offline
            Unfunny_Umi
            replied to Resxt on Jul 1, 2022, 8:50 PM 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
            • undefined Offline
              undefined Offline
              Eleven111
              replied to Unfunny_Umi on Mar 19, 2024, 1:44 AM last edited by Eleven111 Mar 19, 2024, 3:45 AM
              #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");

              }

              undefined 1 Reply Last reply Mar 19, 2024, 9:26 AM
              0
              • undefined Offline
                undefined Offline
                Resxt Plutonium Staff
                replied to Eleven111 on Mar 19, 2024, 9:26 AM 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

                undefined 1 Reply Last reply Mar 19, 2024, 8:54 PM
                0
                • undefined Offline
                  undefined Offline
                  Eleven111
                  replied to Resxt on Mar 19, 2024, 8:54 PM last edited by Eleven111 Mar 19, 2024, 11:05 PM
                  #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

                  undefined 1 Reply Last reply Mar 20, 2024, 1:31 AM
                  0
                  • undefined Offline
                    undefined Offline
                    Resxt Plutonium Staff
                    replied to Eleven111 on Mar 20, 2024, 1:31 AM last edited by
                    #9

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

                    1 Reply Last reply
                    0
                    • undefined Offline
                      undefined Offline
                      Eleven111
                      wrote on Mar 20, 2024, 12:22 PM last edited by
                      #10

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

                      undefined 1 Reply Last reply Mar 22, 2024, 3:19 PM
                      0
                      • undefined Offline
                        undefined Offline
                        Deicide
                        replied to Eleven111 on Mar 22, 2024, 3:19 PM last edited by Deicide Mar 22, 2024, 5:21 PM
                        #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