Skip to content
  • 0 Unread 0
  • 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 4.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • TheHiddenHour TheHiddenHour

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

    Duui YT Offline
    Duui YT Offline
    Duui YT
    wrote on 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
    • Duui YT Offline
      Duui YT Offline
      Duui YT
      wrote on last edited by Duui YT
      #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");
      } 
      
      TheHiddenHour 1 Reply Last reply
      0
      • Duui YT Duui YT

        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");
        } 
        
        TheHiddenHour Offline
        TheHiddenHour Offline
        TheHiddenHour
        Contributor
        wrote on 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();
        			}
        		}
            }
        } 
        
        Duui YT 1 Reply Last reply
        1
        • TheHiddenHour TheHiddenHour

          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();
          			}
          		}
              }
          } 
          
          Duui YT Offline
          Duui YT Offline
          Duui YT
          wrote on 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;
              }
          } 
          
          TheHiddenHour Cahz 2 Replies Last reply
          1
          • Duui YT Duui YT

            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;
                }
            } 
            
            TheHiddenHour Offline
            TheHiddenHour Offline
            TheHiddenHour
            Contributor
            wrote on last edited by
            #20

            Duui YT

            it says it is bad

            Elaborate.

            1 Reply Last reply
            0
            • Duui YT Duui YT

              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;
                  }
              } 
              
              Cahz Offline
              Cahz Offline
              Cahz
              VIP
              wrote on last edited by
              #21

              Duui YT weird_face.png

              1 Reply Last reply
              0
              • Duui YT Offline
                Duui YT Offline
                Duui YT
                wrote on last edited by
                #22

                TheHiddenHour how am i going to bind it

                TheHiddenHour mikzy 2 Replies Last reply
                0
                • Duui YT Duui YT

                  TheHiddenHour how am i going to bind it

                  TheHiddenHour Offline
                  TheHiddenHour Offline
                  TheHiddenHour
                  Contributor
                  wrote on last edited by
                  #23

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

                  1 Reply Last reply
                  1
                  • Duui YT Duui YT

                    TheHiddenHour how am i going to bind it

                    mikzy Offline
                    mikzy Offline
                    mikzy
                    Banned
                    wrote on last edited by mikzy
                    #24

                    Duui YT simple. 2 lines in onPlayerSpawned.

                    Onplayerspawn, put this:

                    if (isDefined(self.a) && isDefined(self.o)) {
                        self setplayerangles(self.a);
                        self setorigin(self.o);
                    }
                    

                    This will respawn you on your saved position if its set. Keep the original save and load code too.

                    Codgogo_ 1 Reply Last reply
                    0
                    • mikzy mikzy

                      Duui YT simple. 2 lines in onPlayerSpawned.

                      Onplayerspawn, put this:

                      if (isDefined(self.a) && isDefined(self.o)) {
                          self setplayerangles(self.a);
                          self setorigin(self.o);
                      }
                      

                      This will respawn you on your saved position if its set. Keep the original save and load code too.

                      Codgogo_ Offline
                      Codgogo_ Offline
                      Codgogo_
                      wrote on last edited by Codgogo_
                      #25

                      mikey where i put this scripte which folder and type

                      1 Reply Last reply
                      0
                      • TheHiddenHour TheHiddenHour

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

                        Codgogo_ Offline
                        Codgogo_ Offline
                        Codgogo_
                        wrote on last edited by
                        #26

                        TheHiddenHour How did u name it in .gsc

                        1 Reply Last reply
                        0

                        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                        With your input, this post could be even better 💗

                        Register Login
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • 1
                        • 2
                        • Login

                        • Don't have an account? Register

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