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.8k 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.
  • Duui YTundefined Offline
    Duui YTundefined 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");
    } 
    
    TheHiddenHourundefined 1 Reply Last reply
    0
    • TheHiddenHourundefined Offline
      TheHiddenHourundefined Offline
      TheHiddenHour Contributor
      replied to Duui YT 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 YTundefined 1 Reply Last reply
      1
      • Duui YTundefined Offline
        Duui YTundefined Offline
        Duui YT
        replied to TheHiddenHour 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;
            }
        } 
        
        TheHiddenHourundefined Cahzundefined 2 Replies Last reply
        1
        • TheHiddenHourundefined Offline
          TheHiddenHourundefined Offline
          TheHiddenHour Contributor
          replied to Duui YT on last edited by
          #20

          Duui YT

          it says it is bad

          Elaborate.

          1 Reply Last reply
          0
          • Cahzundefined Offline
            Cahzundefined Offline
            Cahz VIP
            replied to Duui YT on last edited by
            #21

            Duui YT weird_face.png

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

              TheHiddenHour how am i going to bind it

              TheHiddenHourundefined mikzyundefined 2 Replies Last reply
              0
              • TheHiddenHourundefined Offline
                TheHiddenHourundefined Offline
                TheHiddenHour Contributor
                replied to Duui YT on last edited by
                #23

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

                1 Reply Last reply
                1
                • mikzyundefined Offline
                  mikzyundefined Offline
                  mikzy Banned
                  replied to Duui YT 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_undefined 1 Reply Last reply
                  0
                  • Codgogo_undefined Offline
                    Codgogo_undefined Offline
                    Codgogo_
                    replied to mikzy on last edited by Codgogo_
                    #25

                    mikey where i put this scripte which folder and type

                    1 Reply Last reply
                    0
                    • Codgogo_undefined Offline
                      Codgogo_undefined Offline
                      Codgogo_
                      replied to TheHiddenHour on last edited by
                      #26

                      TheHiddenHour How did u name it in .gsc

                      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