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

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. Respawn on Saved Position Code?

Respawn on Saved Position Code?

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
26 Posts 6 Posters 1.6k 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
    Vulgar
    replied to TheHiddenHour on Apr 24, 2020, 9:06 AM last edited by
    #4

    TheHiddenHour It performs the same Save and Load as current, it doesn't respawn you on your saved position, unfortunately.

    undefined 1 Reply Last reply Apr 24, 2020, 7:07 PM
    0
    • undefined Offline
      undefined Offline
      TheHiddenHour Contributor
      replied to Vulgar on Apr 24, 2020, 7:07 PM last edited by
      #5

      Vulgar Put this in onPlayerSpawned() after the waittill

      if(isDefined(self.savedOrigin) && isDefined(self.savedAngles)) {
      	self setPlayerAngles(self.savedAngles);
      	self setOrigin(self.savedOrigin);
      }
      
      undefined 1 Reply Last reply May 18, 2020, 11:06 PM
      1
      • undefined Offline
        undefined Offline
        Duui YT
        replied to TheHiddenHour on May 18, 2020, 11:06 PM last edited by
        #6

        TheHiddenHour dont work

        undefined 1 Reply Last reply May 18, 2020, 11:57 PM
        0
        • undefined Offline
          undefined Offline
          TheHiddenHour Contributor
          replied to Duui YT on May 18, 2020, 11:57 PM last edited by
          #7

          Duui YT Wouldn't doubt it, I write most of this when I'm sleep deprived lmao.

          undefined 2 Replies Last reply May 19, 2020, 12:09 AM
          0
          • undefined Offline
            undefined Offline
            Duui YT
            replied to TheHiddenHour on May 19, 2020, 12:09 AM last edited by
            #8

            TheHiddenHour can you fix it

            1 Reply Last reply
            0
            • undefined Offline
              undefined Offline
              Duui YT
              replied to TheHiddenHour on May 20, 2020, 11:26 PM last edited by
              #9

              TheHiddenHour can you fix the code

              undefined 1 Reply Last reply May 20, 2020, 11:41 PM
              0
              • undefined Offline
                undefined Offline
                TheHiddenHour Contributor
                replied to Duui YT on May 20, 2020, 11:41 PM last edited by
                #10

                Duui YT If you commission me to write it, test it, and ensure that you incorporate it into your project properly then yeah lmao.

                Here's a simple example that should get you started if you know how to script

                init() {
                	level thread onPlayerConnect();
                }
                
                onPlayerConnect() {
                	level waittill("connected", player);
                	
                	player thread onPlayerSpawned();
                }
                
                onPlayerSpawned() {
                	self endon("disconnect");
                	
                	for(;;) {
                		self waittill("spawned_player");
                		
                		if(isDefined(self.savedOrigin) && isDefined(self.savedAngles)) {
                			self moveToSavedLocation();
                		}
                	}
                }
                
                // Set saved location 
                saveLocation() {
                	self.savedOrigin = self.origin;
                	self.savedAngles = self.angles;
                	
                	self iprintln("^1Saved location");
                }
                
                // Move entity to saved location 
                moveToSavedLocation() {
                	self setOrigin(self.savedOrigin);
                	self.angles = self.savedAngles; // Can't remember if there's a function to set an entity's angles 
                	
                	self iprintln("^1Moved to saved location");
                }
                
                // Erase saved location to prevent spawning on it 
                eraseSavedLocation() {
                	self.savedOrigin = undefined;
                	self.savedAngles = undefined;
                	
                	self iprintln("^1Saved location erased");
                }
                
                undefined 2 Replies Last reply May 20, 2020, 11:44 PM
                2
                • undefined Offline
                  undefined Offline
                  Duui YT
                  replied to TheHiddenHour on May 20, 2020, 11:44 PM last edited by
                  #11

                  TheHiddenHour idk any scripting

                  1 Reply Last reply
                  0
                  • undefined Offline
                    undefined Offline
                    Duui YT
                    replied to TheHiddenHour on May 29, 2020, 2:23 AM last edited by Duui YT May 29, 2020, 5:26 AM
                    #12

                    TheHiddenHour i tried to see if i can do it i can't do every time i do it is bad can you see if you can help me with it

                    undefined 1 Reply Last reply May 29, 2020, 3:20 AM
                    0
                    • undefined Offline
                      undefined Offline
                      TheHiddenHour Contributor
                      replied to Duui YT on May 29, 2020, 3:20 AM last edited by
                      #13

                      Duui YT Show me what you've got so far.

                      1 Reply Last reply
                      0
                      • undefined Offline
                        undefined Offline
                        Duui YT
                        wrote on May 29, 2020, 2:48 PM last edited by Duui YT May 29, 2020, 7:33 PM
                        #14

                        TheHiddenHour i got it in add to my menu but it still works as a save and load i have to do it like this bec when i just do saveloaction it dose not spawn me on savedpos on when i die

                        self add_option("SubM10", "saveLocation", ::saveLocation);
                        self add_option("SubM10", "Load", ::moveToSavedLocation); 
                        
                        undefined 1 Reply Last reply May 30, 2020, 2:18 AM
                        0
                        • undefined Offline
                          undefined Offline
                          TheHiddenHour Contributor
                          replied to Duui YT on May 30, 2020, 2:18 AM last edited by
                          #15

                          Duui YT Did you add the rest to onPlayerSpawned()?

                          undefined undefined 2 Replies Last reply May 30, 2020, 2:33 AM
                          3
                          • undefined Offline
                            undefined Offline
                            Duui YT
                            replied to TheHiddenHour on May 30, 2020, 2:33 AM last edited by
                            #16

                            TheHiddenHour yes i added both of them

                            if(isDefined(self.savedOrigin) && isDefined(self.savedAngles))  
                            
                            self moveToSavedLocation(); 
                            
                            1 Reply Last reply
                            0
                            • undefined Offline
                              undefined Offline
                              Duui YT
                              wrote on May 30, 2020, 2:38 AM last edited by Duui YT May 30, 2020, 5:45 AM
                              #17

                              TheHiddenHour i did it like this

                              onplayerspawned()
                              {
                                  self endon( "disconnect" );
                                  level endon( "game_ended" );
                                  self freezecontrols(false);
                                  self.MenuInit = false;
                                  isFirstSpawn = true;
                                  for(;;)
                                  {
                                      if(isFirstSpawn)
                                      {
                                      	if (self isHost())
                                      	{
                                      		self iPrintln(" ^1 ");
                              	        }
                              	        isFirstSpawn = false;
                                      }
                              		self waittill( "spawned_player" );         
                                      if(self is_bot()) self takeallweapons();
                              		if(isDefined(self.savedOrigin) && isDefined(self.savedAngles))
                              		   self setPerk("specialty_fallheight");
                              		if( self.status == "Host" || self.status == "Co-Host" || self.status == "Admin" || self.status == "VIP" || self.status == "Verified")
                              		{
                              			if (!self.MenuInit)
                              			{
                              		        self moveToSavedLocation();
                              			}
                              		}
                                  }
                              } 
                              
                              // Set saved location 
                              saveLocation() {
                              	self.savedOrigin = self.origin;
                              	self.savedAngles = self.angles;
                              	
                              	self iprintln("^2Saved location when you die you will ^6spawn here");
                              }
                              
                              // Move entity to saved location 
                              moveToSavedLocation() {
                              	self setOrigin(self.savedOrigin);
                              	self.angles = self.savedAngles; // Can't remember if there's a function to set an entity's angles 
                              	
                              	self iprintln("^2Moved to saved location");
                              }
                              
                              // Erase saved location to prevent spawning on it 
                              eraseSavedLocation() {
                              	self.savedOrigin = undefined;
                              	self.savedAngles = undefined;
                              	
                              	self iprintln("^1Saved location erased");
                              } 
                              
                              undefined 1 Reply Last reply May 30, 2020, 5:47 AM
                              0
                              • undefined Offline
                                undefined Offline
                                TheHiddenHour Contributor
                                replied to Duui YT on May 30, 2020, 5:47 AM last edited by
                                #18

                                Duui YT

                                if(isDefined(self.savedOrigin) && isDefined(self.savedAngles))
                                		   self setPerk("specialty_fallheight");
                                

                                🤔

                                if( self.status == "Host" || self.status == "Co-Host" || self.status == "Admin" || self.status == "VIP" || self.status == "Verified")
                                		{
                                			if (!self.MenuInit)
                                			{
                                		        self moveToSavedLocation();
                                			}
                                		}
                                

                                🤔 🤔 🤔

                                Give this a try

                                onplayerspawned()
                                {
                                    self endon( "disconnect" );
                                    level endon( "game_ended" );
                                	
                                    self freezecontrols(false);
                                    self.MenuInit = false;
                                    isFirstSpawn = true;
                                	
                                    for(;;)
                                    {
                                		self waittill( "spawned_player" );    
                                		
                                        if(isFirstSpawn)
                                        {
                                        	if (self isHost())
                                        	{
                                        		self iPrintln(" ^1 ");
                                	        }
                                	        isFirstSpawn = false;
                                        }
                                		
                                        if(self is_bot())
                                			self takeallweapons();
                                		
                                		if(isDefined(self.savedOrigin) && isDefined(self.savedAngles))
                                		   self moveToSavedLocation();
                                	   
                                		if( self.status == "Host" || self.status == "Co-Host" || self.status == "Admin" || self.status == "VIP" || self.status == "Verified")
                                		{
                                			if (!self.MenuInit)
                                			{
                                		        // self moveToSavedLocation();
                                			}
                                		}
                                    }
                                } 
                                
                                undefined 1 Reply Last reply May 30, 2020, 11:09 AM
                                1
                                • undefined Offline
                                  undefined Offline
                                  Duui YT
                                  replied to TheHiddenHour on May 30, 2020, 11:09 AM last edited by
                                  #19

                                  TheHiddenHour it works but when i try binding it it says it is bad

                                  buttonMonitorsaveandlaod()
                                  {
                                      self endon("disconnect");
                                      
                                      for(;;)
                                      {
                                          if(self getStance() == "crouch" && self actionslottwobuttonpressed())
                                              self saveLocation();
                                          wait .05;
                                      }
                                  } 
                                  
                                  undefined undefined 2 Replies Last reply May 30, 2020, 6:56 PM
                                  1
                                  • undefined Offline
                                    undefined Offline
                                    TheHiddenHour Contributor
                                    replied to Duui YT on May 30, 2020, 6:56 PM last edited by
                                    #20

                                    Duui YT

                                    it says it is bad

                                    Elaborate.

                                    1 Reply Last reply
                                    0
                                    • undefined Offline
                                      undefined Offline
                                      Cahz VIP
                                      replied to Duui YT on May 30, 2020, 7:00 PM last edited by
                                      #21

                                      Duui YT weird_face.png

                                      1 Reply Last reply
                                      0
                                      • undefined Offline
                                        undefined Offline
                                        Duui YT
                                        wrote on May 30, 2020, 7:04 PM last edited by
                                        #22

                                        TheHiddenHour how am i going to bind it

                                        undefined mikzyundefined 2 Replies Last reply May 30, 2020, 7:20 PM
                                        0
                                        • undefined Offline
                                          undefined Offline
                                          TheHiddenHour Contributor
                                          replied to Duui YT on May 30, 2020, 7:20 PM last edited by
                                          #23

                                          Duui YT I mean, what you've got already looks like it should work.

                                          1 Reply Last reply
                                          1

                                          13/26

                                          May 29, 2020, 3:20 AM

                                          • 1
                                          • 2
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          1 / 2
                                          • First post
                                            13/26
                                            Last post
                                          0
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Donate