Thread: Pet system

Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 34
  1. #21  
    Banned

    Join Date
    Oct 2012
    Posts
    4,710
    Thanks given
    1,679
    Thanks received
    1,105
    Rep Power
    0
    Quote Originally Posted by arham 4 View Post
    Then make a seperate data set ://
    Like Kris said and i tried to say before there is no need.

    I disagree with Arham about putting morphing stuff in the enum. They're so unique and there's only like 2 pets that have morphing options. Storing it in the enum is pointless IMO. Can be done but it really won't be any help. Morphism has unique settings (For example a small chance of morphing your pet into a golden version or whatever).. which'd need to be written separately anyways.
    Reply With Quote  
     

  2. #22  
    (Official) Thanksgiver

    Arham's Avatar
    Join Date
    Jan 2013
    Age
    23
    Posts
    3,415
    Thanks given
    7,254
    Thanks received
    1,938
    Rep Power
    3905
    Quote Originally Posted by _Patrick_ View Post
    Like Kris said and i tried to say before there is no need.
    Ok u don't need to keep quoting things I've already read. Adding it to a separate data set just makes it easier for future reference and it just looks too hardcode-y right now.
    Attached image
    Attached image
    Quote Originally Posted by MrClassic View Post
    Arham is the official thanker!
    List of my work here!
    Reply With Quote  
     

  3. Thankful user:


  4. #23  
    Banned

    Join Date
    Oct 2012
    Posts
    4,710
    Thanks given
    1,679
    Thanks received
    1,105
    Rep Power
    0
    Quote Originally Posted by arham 4 View Post
    Ok u don't need to keep quoting things I've already read. Adding it to a separate data set just makes it easier for future reference and it just looks too hardcode-y right now.
    Ah i understand what you mean, but that is personal preference.
    Reply With Quote  
     

  5. #24  
    Respected Member


    Kris's Avatar
    Join Date
    Jun 2016
    Age
    26
    Posts
    3,638
    Thanks given
    820
    Thanks received
    2,642
    Rep Power
    5000
    I hadn't really read your method for the morphing. I agree with Arham, it's a bit much rn. Personally I'd make a little immutable map and store it in there. E.g. map.get(orange_vetion_id) would return purple and vice versa. Of course the only exception would be the golden version but that is just one/two lines.
    I also advise you not to make a new object over and over. There's simply no point. Referring to:
    Code:
    if (new Random().nextInt(1000) == 0) {
    Just make a final static object in the class and refer to the same random object.

    Code:
    private static final Random RANDOM = new Random();
    
    method() {
    if (pet == Pet.CHIN && RANDOM.nextInt(1000) == 0) {
    morphId = goldenId;
    return;
    }
    morphId = IMMUTABLE_MAP.get(petId);
    }
    Attached image
    Reply With Quote  
     

  6. Thankful users:


  7. #25  
    (Official) Thanksgiver

    Arham's Avatar
    Join Date
    Jan 2013
    Age
    23
    Posts
    3,415
    Thanks given
    7,254
    Thanks received
    1,938
    Rep Power
    3905
    Quote Originally Posted by Kris View Post
    I hadn't really read your method for the morphing. I agree with Arham, it's a bit much rn. Personally I'd make a little immutable map and store it in there. E.g. map.get(orange_vetion_id) would return purple and vice versa. Of course the only exception would be the golden version but that is just one/two lines.
    I also advise you not to make a new object over and over. There's simply no point. Referring to:
    Code:
    if (new Random().nextInt(1000) == 0) {
    Just make a final static object in the class and refer to the same random object.

    Code:
    private static final Random RANDOM = new Random();
    
    method() {
    if (pet == Pet.CHIN && RANDOM.nextInt(1000) == 0) {
    morphId = goldenId;
    return;
    }
    morphId = IMMUTABLE_MAP.get(petId);
    }
    Yeah, can populate that map with an enum's values() from "static {}"
    Attached image
    Attached image
    Quote Originally Posted by MrClassic View Post
    Arham is the official thanker!
    List of my work here!
    Reply With Quote  
     

  8. #26  
    Banned

    Join Date
    Oct 2012
    Posts
    4,710
    Thanks given
    1,679
    Thanks received
    1,105
    Rep Power
    0
    Quote Originally Posted by Kris View Post
    If this is the case, he should've stored that data inside the enum. Just like I've done it: https://i.imgur.com/ghrD4Q4.png
    Hey looking back @ this what is the second and third value in your enum?
    Reply With Quote  
     

  9. #27  
    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 _Patrick_ View Post
    Hey looking back @ this what is the second and third value in your enum?
    private Pet(final int itemId, final int npcId, final int hiddenNpcId, final Class<? extends Dialogue> dialogue)

    First is regular npc id - the one with right click options. The second is the npc without the right click options.
    Basically the pet will only show the right click options to its owner - the rest of the player won't even be able to examine the pets. That's how it is in OSRS.
    Attached image
    Reply With Quote  
     

  10. Thankful user:


  11. #28  
    Banned

    Join Date
    Oct 2012
    Posts
    4,710
    Thanks given
    1,679
    Thanks received
    1,105
    Rep Power
    0
    Quote Originally Posted by Kris View Post
    private Pet(final int itemId, final int npcId, final int hiddenNpcId, final Class<? extends Dialogue> dialogue)

    First is regular npc id - the one with right click options. The second is the npc without the right click options.
    Basically the pet will only show the right click options to its owner - the rest of the player won't even be able to examine the pets. That's how it is in OSRS.
    Always wondered why there was two npc id's of each pet! So how would you show the secondary id to other players except the owner, he'll see the first one with options?
    Reply With Quote  
     

  12. #29  
    Registered Member

    Join Date
    Oct 2017
    Posts
    649
    Thanks given
    6
    Thanks received
    119
    Rep Power
    161
    thanks
    Reply With Quote  
     

  13. #30  
    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 _Patrick_ View Post
    Always wondered why there was two npc id's of each pet! So how would you show the secondary id to other players except the owner, he'll see the first one with options?
    NPC updating.
    Attached image

    By default (NPC class):
    Attached image

    For followers:
    Attached image
    Attached image
    Reply With Quote  
     

  14. Thankful user:


Page 3 of 4 FirstFirst 1234 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. Re-Organized Pet System (With Clipping, Enums, etc)
    By dead fury in forum Tutorials
    Replies: 31
    Last Post: 12-19-2015, 01:13 AM
  2. Boss Pets System
    By Certified in forum Selling
    Replies: 7
    Last Post: 11-16-2014, 12:06 AM
  3. [PI] Full Pets system
    By Corey in forum Buying
    Replies: 3
    Last Post: 08-02-2014, 12:57 PM
  4. Replies: 7
    Last Post: 03-18-2013, 01:04 AM
  5. [BattleScape317] Pet system
    By Flux in forum Snippets
    Replies: 3
    Last Post: 01-05-2012, 02:41 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •