Thread: how to change the object loaded in on log in?

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1 how to change the object loaded in on log in? 
    Registered Member
    Join Date
    Apr 2013
    Posts
    63
    Thanks given
    3
    Thanks received
    2
    Rep Power
    36
    Coding Desert Treasure:

    I'm coding the part where the player adds the diamonds to the obelisk and it requires a change in objectID. I am able to change it when the item is used, but I am wondering how to update the player files or what not to make it permanent so that it doesn't resort back to the default.

    Code:
    case 6482:
    			if(itemId == 4670) { //blood pillar
    				c.getItemAssistant().deleteItem(4670, 1);
    			c.getActionSender().sendMessage("The diamond is absorbed into the pillar...");
    				Objects o = (Objects) Server.objectHandler.getObjectByPosition(3220, 2909);
    				Server.objectHandler.removeObject(o);
    				Server.objectHandler.createAnObject(6484,3220, 2909);
    			}
    			
    		case 6491:
    			if(itemId == 4673) { //shadow pillar
    				c.getItemAssistant().deleteItem(4673, 1);
    			c.getActionSender().sendMessage("The diamond is absorbed into the pillar...");
    				Objects o = (Objects) Server.objectHandler.getObjectByPosition(3220, 2885);
    				Server.objectHandler.removeObject(o);
    				Server.objectHandler.createAnObject(6493, 3220, 2885);
    			}
    		case 6488:
    			if(itemId == 4671) { //ice pillar
    			c.getItemAssistant().deleteItem(4671, 1);
    			c.getActionSender().sendMessage("The diamond is absorbed into the pillar...");
    				Objects o = (Objects) Server.objectHandler.getObjectByPosition(3244, 2885);
    				Server.objectHandler.removeObject(o);
    				Server.objectHandler.createAnObject(6490, 3244, 2885);
    			}
    			break;
    			
    		case 6485:
    			if(itemId == 4672) { //smoke pillar
    				c.getItemAssistant().deleteItem(4672, 1);
    			c.getActionSender().sendMessage("The diamond is absorbed into the pillar...");
    				Objects o = (Objects) Server.objectHandler.getObjectByPosition(3244, 2909);
    				Server.objectHandler.removeObject(o);
    				Server.objectHandler.createAnObject(6487, 3244, 2909);
    			}
    			break;
    However, obviously, when i log out and back in, it resorts back to the default load ins. How can i change it such that the players progress in adding the diamonds is saved?

    cheers!
    Reply With Quote  
     

  2. #2  
    Respected Member


    Kris's Avatar
    Join Date
    Jun 2016
    Age
    26
    Posts
    3,638
    Thanks given
    820
    Thanks received
    2,642
    Rep Power
    5000
    This is actually done through varbits, not by manual object spawning. Only the user who actually adds the crystal can see it being there.
    North-east pillar: 387
    South-west pillar: 388
    South-east pillar: 389
    North-west pillar: 390

    These varbits are meant to be serialized on the character file, and should be sent to the client again upon login.
    The varbit ids can be found within object definitions(in the cache). Alternatively, you can look them up here(note: may take a few seconds to load, lots of text)
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Apr 2013
    Posts
    63
    Thanks given
    3
    Thanks received
    2
    Rep Power
    36
    Quote Originally Posted by Kris View Post
    This is actually done through varbits, not by manual object spawning. Only the user who actually adds the crystal can see it being there.
    North-east pillar: 387
    South-west pillar: 388
    South-east pillar: 389
    North-west pillar: 390

    These varbits are meant to be serialized on the character file, and should be sent to the client again upon login.
    The varbit ids can be found within object definitions(in the cache). Alternatively, you can look them up here(note: may take a few seconds to load, lots of text)
    I looked up the ids you had and they are not the pillars.

    Code:
    [387]
    name=Bookshelves
    sizeh=1
    sizev=2
    model1=1954
    
    [388]
    name=Wardrobe
    sizeh=1
    sizev=1
    model1=1951
    model2=5531
    op1=Open
    
    [389]
    name=Wardrobe
    sizeh=1
    sizev=1
    model1=1953
    model2=5531
    op2=Search
    op3=Close
    
    [390]
    name=Wardrobe
    sizeh=1
    sizev=1
    model1=1949
    model2=5531
    op2=Search
    op3=Close
    Also im pretty new to varbits. How would i go about coding this? I understand you said to seralize it to the character file and send it to the client upon login, but is there an example code I can use to get started because
    I have not much of an idea where to start
    Reply With Quote  
     

  4. Thankful user:


  5. #4  
    Respected Member


    Kris's Avatar
    Join Date
    Jun 2016
    Age
    26
    Posts
    3,638
    Thanks given
    820
    Thanks received
    2,642
    Rep Power
    5000
    Quote Originally Posted by gilbo184 View Post
    I looked up the ids you had and they are not the pillars.

    Code:
    [387]
    name=Bookshelves
    sizeh=1
    sizev=2
    model1=1954
    
    [388]
    name=Wardrobe
    sizeh=1
    sizev=1
    model1=1951
    model2=5531
    op1=Open
    
    [389]
    name=Wardrobe
    sizeh=1
    sizev=1
    model1=1953
    model2=5531
    op2=Search
    op3=Close
    
    [390]
    name=Wardrobe
    sizeh=1
    sizev=1
    model1=1949
    model2=5531
    op2=Search
    op3=Close
    Also im pretty new to varbits. How would i go about coding this? I understand you said to seralize it to the character file and send it to the client upon login, but is there an example code I can use to get started because
    I have not much of an idea where to start
    The ids I gave are the varbit ids, not the pillar ids. There's a packet that's used in things like farming and whatnot, for transmit a varbit value to the client. That specific packet is what'll transform the object for that specific player.
    It also works for npcs(e.g. quest npcs) and is used for some interfaces to toggle buttons.
    Reply With Quote  
     

  6. #5  
    Registered Member
    Join Date
    Apr 2013
    Posts
    63
    Thanks given
    3
    Thanks received
    2
    Rep Power
    36
    Quote Originally Posted by Kris View Post
    The ids I gave are the varbit ids, not the pillar ids. There's a packet that's used in things like farming and whatnot, for transmit a varbit value to the client. That specific packet is what'll transform the object for that specific player.
    It also works for npcs(e.g. quest npcs) and is used for some interfaces to toggle buttons.
    ahh okay.

    That makes sense.

    I cant seem to find anywhere varbit code though. I tried looking in the client.java (server side) and player.java (server side)
    Reply With Quote  
     

  7. #6  
    Respected Member


    Kris's Avatar
    Join Date
    Jun 2016
    Age
    26
    Posts
    3,638
    Thanks given
    820
    Thanks received
    2,642
    Rep Power
    5000
    Quote Originally Posted by gilbo184 View Post
    ahh okay.

    That makes sense.

    I cant seem to find anywhere varbit code though. I tried looking in the client.java (server side) and player.java (server side)
    I can't help with that. It might be under "varp" as well. Varbits are just a sub-section of varps, using up a certain amount of bits from the whole 32 that a varp transmits.
    My only suggestions is to try and look for existing code that would use varbits, so things like farming, any quest npc, poison health orb, barrows doors, prayer interface etc.
    Reply With Quote  
     

  8. #7  
    Registered Member
    Join Date
    Apr 2013
    Posts
    63
    Thanks given
    3
    Thanks received
    2
    Rep Power
    36
    Quote Originally Posted by Kris View Post
    I can't help with that. It might be under "varp" as well. Varbits are just a sub-section of varps, using up a certain amount of bits from the whole 32 that a varp transmits.
    My only suggestions is to try and look for existing code that would use varbits, so things like farming, any quest npc, poison health orb, barrows doors, prayer interface etc.
    Most the time time these are just variables.

    i.e. player.isPoison = 1 and in the character file is has it in there.
    Reply With Quote  
     

  9. #8  
    Respected Member


    Kris's Avatar
    Join Date
    Jun 2016
    Age
    26
    Posts
    3,638
    Thanks given
    820
    Thanks received
    2,642
    Rep Power
    5000
    Quote Originally Posted by gilbo184 View Post
    Most the time time these are just variables.

    i.e. player.isPoison = 1 and in the character file is has it in there.
    Yes, but in order for the client to turn your health orb green, the server must send the corresponding varbit/varp to inform it of the character being poisoned(so the client can change the orb to green).
    Follow these variable and see how they're being used.
    Reply With Quote  
     

  10. #9  
    Registered Member
    Join Date
    Apr 2013
    Posts
    63
    Thanks given
    3
    Thanks received
    2
    Rep Power
    36
    Quote Originally Posted by Kris View Post
    Yes, but in order for the client to turn your health orb green, the server must send the corresponding varbit/varp to inform it of the character being poisoned(so the client can change the orb to green).
    Follow these variable and see how they're being used.
    EDIT: figured it out how it sends to client and char files. Now I have the issue below:

    So when i log in i added this code:

    Code:
    if(bloodPillar) {
    				Objects o = (Objects) Server.objectHandler.getObjectByPosition(3220, 2909);
    				Server.objectHandler.removeObject(o);
    				Server.objectHandler.createAnObject(6484,3220, 2909);
    			}
    			if(shadowPillar) {
    				Objects o = (Objects) Server.objectHandler.getObjectByPosition(3220, 2885);
    				Server.objectHandler.removeObject(o);
    				Server.objectHandler.createAnObject(6493, 3220, 2885);
    			}
    			if(icePillar) {
    				Objects o = (Objects) Server.objectHandler.getObjectByPosition(3244, 2885);
    				Server.objectHandler.removeObject(o);
    				Server.objectHandler.createAnObject(6490, 3244, 2885);
    			}
    			if(smokePillar) {
    				Objects o = (Objects) Server.objectHandler.getObjectByPosition(3244, 2909);
    				Server.objectHandler.removeObject(o);
    				Server.objectHandler.createAnObject(6487, 3244, 2909);
    			}
    This works when i log in and out, but now im having issues with region changes. So if i tele out and come back its back to the default. What class normally deals with dynamic loading?
    Reply With Quote  
     

  11. #10  
    Respected Member


    Kris's Avatar
    Join Date
    Jun 2016
    Age
    26
    Posts
    3,638
    Thanks given
    820
    Thanks received
    2,642
    Rep Power
    5000
    Quote Originally Posted by gilbo184 View Post
    EDIT: figured it out how it sends to client and char files. Now I have the issue below:

    So when i log in i added this code:

    Code:
    if(bloodPillar) {
    				Objects o = (Objects) Server.objectHandler.getObjectByPosition(3220, 2909);
    				Server.objectHandler.removeObject(o);
    				Server.objectHandler.createAnObject(6484,3220, 2909);
    			}
    			if(shadowPillar) {
    				Objects o = (Objects) Server.objectHandler.getObjectByPosition(3220, 2885);
    				Server.objectHandler.removeObject(o);
    				Server.objectHandler.createAnObject(6493, 3220, 2885);
    			}
    			if(icePillar) {
    				Objects o = (Objects) Server.objectHandler.getObjectByPosition(3244, 2885);
    				Server.objectHandler.removeObject(o);
    				Server.objectHandler.createAnObject(6490, 3244, 2885);
    			}
    			if(smokePillar) {
    				Objects o = (Objects) Server.objectHandler.getObjectByPosition(3244, 2909);
    				Server.objectHandler.removeObject(o);
    				Server.objectHandler.createAnObject(6487, 3244, 2909);
    			}
    This works when i log in and out, but now im having issues with region changes. So if i tele out and come back its back to the default. What class normally deals with dynamic loading?
    You are not supposed to use object spawning. There is no way to patch that to look nice, it was never intended that way.
    Will have to wait for someone else to show how varbits are sent in 317s.
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 2
    Last Post: 11-19-2016, 10:22 PM
  2. Replies: 9
    Last Post: 10-07-2013, 09:27 PM
  3. Replies: 1
    Last Post: 03-01-2012, 10:43 PM
  4. Replies: 0
    Last Post: 11-24-2009, 07:05 AM
  5. how to change the ip on your client
    By LastResortpkz in forum Tutorials
    Replies: 10
    Last Post: 07-27-2008, 01:36 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •