Thread: RUSE Pet Perk "System" [BASE]

Results 1 to 9 of 9
  1. #1 RUSE Pet Perk "System" [BASE] 
    Registered Member

    Join Date
    Oct 2016
    Posts
    158
    Thanks given
    76
    Thanks received
    39
    Rep Power
    105
    This is only one small part but will give you something to build off of. There's a few things that you will have to do, that I wont completely walk you through.
    FIRST: have to add a perk id to all the pets
    SECOND: add perk id getters and setters to the player
    THIRD: make the pet spawn method set the perk id to the player
    FOURTH: make pet spawn id getters and setters to the player
    FIFTH: check to see if the player logs out with the perk active / logins with an active perk (So it pauses the time and picks it back up)

    Code:
    public static void petPerk(Player player) {
    if (perk == 22 && player.getInventory().getAmount(CURRENCY) >= COST) { //Pet baby blue dragon
        			player.getInventory().delete(CURRENCY, COST);
        			int id = 52; // Wild baby blue dragon
        			NPC npc = new NPC(id, new Position(player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ()));
        			World.register(npc);
        			player.getPacketSender().sendMessage("You use your Hard earned Saevio Dust to spawn a wild monster.");
        			player.getPacketSender().sendMessage("Spawn Lasts for Ten Minutes!");
        			player.getPacketSender().sendMessage("This spawn costs-"+COST+"!");
        			Player.setPetSpawnId(id);
        			Timer timer = new Timer();
        			timer.schedule(new TimerTask() {
    
    					@Override
    					public void run() {
    						World.deregister(npc);
    						player.getPacketSender().sendMessage("<img=10> <shad=0>@red@Your wild monster spawn timer has ran out!");
    	    	   			player.getPacketSender().sendMessage("<img=10> <shad=0>@red@Better dig up some more Saevio Dust!");
    	    	   			player.getSkillManager().addExperience(Skill.ZOO, 1);
    	    	   			Player.setPetSpawnId(-1);
    	    	   			World.savePlayers();
    	    	   			
    						//  Always gonna remember this right here. Ever have to time something, do it this way! It so much easier and IMO cleaner than ruse's built in stop watch (That wouldnt work for me here)
    						
    					}
        				
        			}, 600000);
        			return;
        		}
    }
    If I forgot anything I'll add it when it gets brought to my attention.
    Reply With Quote  
     

  2. #2  
    nice


    Join Date
    Jul 2014
    Posts
    740
    Thanks given
    382
    Thanks received
    562
    Rep Power
    4239
    Why are u saving every single player. Also what even is the difference between setPetSpawn and setPetSpawnId.
    And this doesn't even look anything close to a system.
    Last edited by Suic; 11-22-2019 at 03:43 AM. Reason: Misspelled something
    Reply With Quote  
     

  3. #3  
    Registered Member

    Join Date
    Oct 2016
    Posts
    158
    Thanks given
    76
    Thanks received
    39
    Rep Power
    105
    AS I stated above it's a system to build off of. I have perks for all 50 pets I have in my server. I hadn't seen that, I built the first 10, and Only_Kruse (my other developer that is on break due to a car wreck (hes a irl friend)) finished the system. That is something that does not belong to the original 10, and will have to see why he did that as it is not needed, the login method calls the petspawnid. I will fix that or figure out what the difference is as it only resets the petspawnid and not the other. This was the first coding project he'd worked on, so I think he tried to experiment without knowing what he was doing.


    EDIT: After speaking with him, he said "I thought it was one of the things that needed done" -_-
    Last edited by Jrage; 11-22-2019 at 11:37 AM. Reason: Got a response on the diffrence
    Reply With Quote  
     

  4. #4  
    nice


    Join Date
    Jul 2014
    Posts
    740
    Thanks given
    382
    Thanks received
    562
    Rep Power
    4239
    Quote Originally Posted by Jrage View Post
    AS I stated above it's a system to build off of. I have perks for all 50 pets I have in my server. I hadn't seen that, I built the first 10, and Only_Kruse (my other developer that is on break due to a car wreck (hes a irl friend)) finished the system. That is something that does not belong to the original 10, and will have to see why he did that as it is not needed, the login method calls the petspawnid. I will fix that or figure out what the difference is as it only resets the petspawnid and not the other. This was the first coding project he'd worked on, so I think he tried to experiment without knowing what he was doing.


    EDIT: After speaking with him, he said "I thought it was one of the things that needed done" -_-
    "It's a system to build off of" doesn't even look close to it? all i see is an if statement, that executes some code.

    and: "It so much easier and IMO cleaner than ruse's built in stop watch (That wouldnt work for me here)", if ur referring to the Task class, it is fully working unless someone edited and broke it, also care to elaborate why using the Timer/TimerTask class, is "easier and cleaner"?

    ot: not hating on this or anything.
    Last edited by Suic; 11-22-2019 at 06:01 PM. Reason: an instead of a
    Reply With Quote  
     

  5. #5  
    Registered Member

    Join Date
    Sep 2016
    Posts
    181
    Thanks given
    84
    Thanks received
    74
    Rep Power
    452
    Sorry but this is not a snippet. Nobody has a Zoo skill, the code isn't even explanatory to what you named the thread. Half the methods aren't standard and you don't provide them, additionally we don't know what they even do. The hardcoding of all these numbers is terrible and "system" is completely incorrect. What is perk == 22, int id = 52. This is neither maintainable nor extensible. I don't even know what this code is supposed to do. It would be faster to just code from scratch whatever you had in mind if somebody was to do this themselves. Sorry for the negativity but there's nothing useful here.

    How about you tell us what the idea of the perk system is? What does this particular perk 22 do?
    Reply With Quote  
     

  6. #6  
    Registered Member

    Join Date
    Oct 2016
    Posts
    158
    Thanks given
    76
    Thanks received
    39
    Rep Power
    105
    Quote Originally Posted by knd6060 View Post
    Sorry but this is not a snippet. Nobody has a Zoo skill, the code isn't even explanatory to what you named the thread. Half the methods aren't standard and you don't provide them, additionally we don't know what they even do. The hardcoding of all these numbers is terrible and "system" is completely incorrect. What is perk == 22, int id = 52. This is neither maintainable nor extensible. I don't even know what this code is supposed to do. It would be faster to just code from scratch whatever you had in mind if somebody was to do this themselves. Sorry for the negativity but there's nothing useful here.

    How about you tell us what the idea of the perk system is? What does this particular perk 22 do?
    I'll roll with suic, the question they asked were rather constructive. If you read the code, its simple to figure out what it does. If you read where I list the few things that must be done, it would be easy to figure out what "perk" means.
    FIRST: have to add a perk id to all the pets
    It is checking to see if
    Code:
    perk == 22
    so obviously the 22 is probably the perk id.
    Yes, I'm rather certain no one has a Zookeeping skill, as that's something I've been working on for about 3 Months (May be longer, have to go look and see for an exact date). I left as inspiration to others, if you cant use it or don't want to take the inspiration, simply delete it. Figuring out what the code does is rather easy. READ what the messages say, and the couple comments I put into it tells which pet that perk is assigned to, and what the ID 52 is. See the code
    Code:
    int id = 52; // Wild baby blue dragon
    So How is it hard to figure that out? Also, the code damn near tells what it is. I'm not gonna spoon feed the crap out anyone. If you don't want to use that SNIPPET of code as a beginning perk, than the top of the page still tells how to get started (Which seems like it could be helpful to a lot of people). Not trying to be an ass, but the way you came off is more along the lines of wanting to leech something. As for this "not being a snippet", here is a quote from the guidelines thread on posting snippets that Scu originally posted in 2011
    The snippets sub-forum is designed for you to paste small amounts of code to edit a server. These snippets should not include a large amount of code, and should only be for smaller edits. For a large edit that includes guides on implementation, please use the tutorial sub-forum. This code does not necessarily have to work, but must bare some resemblance and helpfulness to progression within Rs2-Servers
    I feel this matches that rather accurately. So to reiterate, read the entire post, and read each line of code, it tells what it does.



    @Suic I appreciate you pushing me to make this better and at the same time, asking meaningful question. No, I was referring to the stopwatch class that came with the ruse base I started with. I also tried the task class, both of which I spent two days trying to get to work in the fashion in which I needed it to, which neither wanted to. The task system works great for other things I'm doing (My pet battles work great using it), and the stop watch works great for my random events, but in this instance they just wouldn't work (Could very well be operator error (I can be a scatter brain at times, so its possible)). The timer task was cleaner and easier for me as it took a mater of maybe a whole 3 minutes to get it to work the way I was intending this to work compared to the two days of time spent with the others.


    A question from me for both of you, Can you please explain to me how it is not a system? The definition of system can vary a slight bit but the most common are "a set of things working together as parts of a mechanism or an interconnecting network." and "The definition of a system is a set of rules, an arrangement of things, or a group of related things that work toward a common goal." With the entirety of things, I truly feel this is a system as there are multiple parts that work together to make the common goal happen. Not trying to be a smartass by any means, but if I'm mistaken, please inform me.
    Last edited by Jrage; 11-28-2019 at 10:46 PM. Reason: forgot to space a couple things out, added a question of my own.
    Reply With Quote  
     

  7. #7  
    Registered Member

    Join Date
    Sep 2016
    Posts
    181
    Thanks given
    84
    Thanks received
    74
    Rep Power
    452
    When people make a system it's usually very easy to make changes without having to redo lots of code. You just have a bunch of if statements and hardcoding each case into it. We know what those numbers do, but why are they there rather than together in some cohesive data structure. You could at least use an enum in this.

    I could write my own system if I wanted to faster than I could use this and fix it. I don't run a custom server though and don't want pet perks anyway.
    Reply With Quote  
     

  8. #8  
    nice


    Join Date
    Jul 2014
    Posts
    740
    Thanks given
    382
    Thanks received
    562
    Rep Power
    4239
    Quote Originally Posted by Jrage View Post
    I'll roll with suic, the question they asked were rather constructive. If you read the code, its simple to figure out what it does. If you read where I list the few things that must be done, it would be easy to figure out what "perk" means.

    It is checking to see if
    Code:
    perk == 22
    so obviously the 22 is probably the perk id.
    Yes, I'm rather certain no one has a Zookeeping skill, as that's something I've been working on for about 3 Months (May be longer, have to go look and see for an exact date). I left as inspiration to others, if you cant use it or don't want to take the inspiration, simply delete it. Figuring out what the code does is rather easy. READ what the messages say, and the couple comments I put into it tells which pet that perk is assigned to, and what the ID 52 is. See the code
    Code:
    int id = 52; // Wild baby blue dragon
    So How is it hard to figure that out? Also, the code damn near tells what it is. I'm not gonna spoon feed the crap out anyone. If you don't want to use that SNIPPET of code as a beginning perk, than the top of the page still tells how to get started (Which seems like it could be helpful to a lot of people). Not trying to be an ass, but the way you came off is more along the lines of wanting to leech something. As for this "not being a snippet", here is a quote from the guidelines thread on posting snippets that Scu originally posted in 2011 I feel this matches that rather accurately. So to reiterate, read the entire post, and read each line of code, it tells what it does.



    @Suic I appreciate you pushing me to make this better and at the same time, asking meaningful question. No, I was referring to the stopwatch class that came with the ruse base I started with. I also tried the task class, both of which I spent two days trying to get to work in the fashion in which I needed it to, which neither wanted to. The task system works great for other things I'm doing (My pet battles work great using it), and the stop watch works great for my random events, but in this instance they just wouldn't work (Could very well be operator error (I can be a scatter brain at times, so its possible)). The timer task was cleaner and easier for me as it took a mater of maybe a whole 3 minutes to get it to work the way I was intending this to work compared to the two days of time spent with the others.


    A question from me for both of you, Can you please explain to me how it is not a system? The definition of system can vary a slight bit but the most common are "a set of things working together as parts of a mechanism or an interconnecting network." and "The definition of a system is a set of rules, an arrangement of things, or a group of related things that work toward a common goal." With the entirety of things, I truly feel this is a system as there are multiple parts that work together to make the common goal happen. Not trying to be a smartass by any means, but if I'm mistaken, please inform me.
    "how it is not a system?"
    because this is just a if statement, for 5 pets u'd have to add 5 more if checks, that's not a system, i wrote my own pet perk system a few weeks ago for some1 which took me 10mins, and it has several features / easy to use, can show u some of the code if u want
    Reply With Quote  
     

  9. Thankful user:


  10. #9  
    Registered Member

    Join Date
    Oct 2016
    Posts
    158
    Thanks given
    76
    Thanks received
    39
    Rep Power
    105
    Quote Originally Posted by Suic View Post
    "how it is not a system?"
    because this is just a if statement, for 5 pets u'd have to add 5 more if checks, that's not a system, i wrote my own pet perk system a few weeks ago for some1 which took me 10mins, and it has several features / easy to use, can show u some of the code if u want
    "can show u some of the code if u want"
    If you would, that would be awesome, maybe help me understand better why you don't consider it one. I guess I'm just not understanding.
    Reply With Quote  
     


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: 16
    Last Post: 11-29-2019, 04:50 AM
  2. Replies: 24
    Last Post: 07-30-2017, 05:52 AM
  3. [PI] Pet's system
    By Shaloxis in forum Tutorials
    Replies: 36
    Last Post: 06-28-2017, 12:06 PM
  4. [Ruse] Pets bug fix
    By Swiffy in forum Snippets
    Replies: 7
    Last Post: 12-01-2015, 10:48 AM
  5. Perk System for PvP
    By Aconitic in forum RS2 Server
    Replies: 10
    Last Post: 03-20-2010, 09:39 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
  •