Thread: [RUSE] Wanting to learn how to add charges to a item

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1 [RUSE] Wanting to learn how to add charges to a item 
    Registered Member
    Join Date
    May 2020
    Posts
    37
    Thanks given
    10
    Thanks received
    2
    Rep Power
    11
    So im trying to make the scythe of vitur and sang staff like OSRS where u have to charge

    Scythe - Blood runes and vials of blood

    sang - blood runes

    i know that i need to add both variants of the items uncharged and charged, but how do i make it so once the charges are used it goes back to the uncharged version.
    Reply With Quote  
     

  2. #2  
    Development Services √

    Oogle's Avatar
    Join Date
    Apr 2012
    Age
    25
    Posts
    3,976
    Thanks given
    650
    Thanks received
    516
    Rep Power
    483
    Just do it as 2 different item id's and then when item on item is used it is charged then you will have to add a boolean/int for the charges so it goes back to uncharged after its uses.


    Attached image

    Attached image
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    May 2020
    Posts
    37
    Thanks given
    10
    Thanks received
    2
    Rep Power
    11
    Quote Originally Posted by L3WK View Post
    Just do it as 2 different item id's and then when item on item is used it is charged then you will have to add a boolean/int for the charges so it goes back to uncharged after its uses.
    super new to this so idk what to do xd i know how to make a item into another item. but thats about it for this xd
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Aug 2012
    Posts
    139
    Thanks given
    23
    Thanks received
    20
    Rep Power
    25
    I don't think anyone would spoon feed you the code unless you pay for it. He's just given you the direction on the what you'd wanna do and it's up to you to trial and error the code so that it works on your server.

    You'd just have to put some time in to see if it works or not, and when it does it'll give you satisfaction that you've learnt something. Since from your two post, it gives me the impression that you're very new to coding a RSPS.
    Reply With Quote  
     

  5. #5  
    Donator

    Join Date
    Apr 2016
    Posts
    143
    Thanks given
    23
    Thanks received
    13
    Rep Power
    33
    Quote Originally Posted by Rng Rng Ownu View Post
    I don't think anyone would spoon feed you the code unless you pay for it. He's just given you the direction on the what you'd wanna do and it's up to you to trial and error the code so that it works on your server.

    You'd just have to put some time in to see if it works or not, and when it does it'll give you satisfaction that you've learnt something. Since from your two post, it gives me the impression that you're very new to coding a RSPS.
    He clearly stated he was new and needed a hand. He didn't need someone to give him wisdom!

    So, thinking about this if I were a new player a great place to start would be by example. Thankfully, there are so many methods already in your Client and Source to help you with this, If NOT there are many other methods you can pull from online. So, I'm guessing you already took the liberty to Google this and FOUND nothing mainly because this is a copy and paste method for most experienced programmers. I would highly advise looking at other methods such as Amulet of Glory use charges or other items that already exist that simply do the same thing already.


    You stated your using Ruse base so you should have degradable items, you can look at that, and look at how those change your equipment[] setup.

    Long story short you are just checking if user has charges (int) / (boolean) could cover that. so in player.java find int energy or something and make a new one called SythePower = 0;

    Then you can check for this once the user is in combat. Look at degradable like said.

    When you want to change the item id of what the user is holding look into this line:
    Code:
    if (c.playerEquipment[i] == itemId)
    [i] would be the slot number.
    itemid would be == to that item id

    if you want to change it would be;

    Code:
    c.playerEquipment[0] = 123;


    ___________________
    Spoiler for Looking for a Unique 317?:

    Attached image
    Reply With Quote  
     

  6. Thankful user:


  7. #6  
    Registered Member
    Join Date
    May 2020
    Posts
    37
    Thanks given
    10
    Thanks received
    2
    Rep Power
    11
    Quote Originally Posted by Six Echo View Post
    He clearly stated he was new and needed a hand. He didn't need someone to give him wisdom!

    So, thinking about this if I were a new player a great place to start would be by example. Thankfully, there are so many methods already in your Client and Source to help you with this, If NOT there are many other methods you can pull from online. So, I'm guessing you already took the liberty to Google this and FOUND nothing mainly because this is a copy and paste method for most experienced programmers. I would highly advise looking at other methods such as Amulet of Glory use charges or other items that already exist that simply do the same thing already.


    You stated your using Ruse base so you should have degradable items, you can look at that, and look at how those change your equipment[] setup.

    Long story short you are just checking if user has charges (int) / (boolean) could cover that. so in player.java find int energy or something and make a new one called SythePower = 0;

    Then you can check for this once the user is in combat. Look at degradable like said.

    When you want to change the item id of what the user is holding look into this line:
    Code:
    if (c.playerEquipment[i] == itemId)
    [i] would be the slot number.
    itemid would be == to that item id

    if you want to change it would be;

    Code:
    c.playerEquipment[0] = 123;


    ___________________
    didnt think of referencing the ammy of glory code for it, ill look into it thanks.
    Reply With Quote  
     

  8. #7  
    Registered Member
    Join Date
    Aug 2012
    Posts
    139
    Thanks given
    23
    Thanks received
    20
    Rep Power
    25
    Another way could be looking at how Barrows armour degrade or Crystal Bow, since those are items that technically have a 'Charge' aspect to it and will eventually degrade into a Non Charged version of the item based off combat hits.
    Reply With Quote  
     

  9. #8  
    Banned

    Join Date
    Dec 2019
    Age
    31
    Posts
    376
    Thanks given
    361
    Thanks received
    214
    Rep Power
    0
    Quote Originally Posted by Six Echo View Post
    He clearly stated he was new and needed a hand. He didn't need someone to give him wisdom!
    He wasnt wrong and wasnt even trying to be a dick, are you his wife or something? idk why you got so sentimental over nothing. You wont learn something unless you tinker with it yourself, trial and error.
    constructive criticism gets you places n clearly you cant take it.

    Quote Originally Posted by Rng Rng Ownu View Post
    I don't think anyone would spoon feed you the code unless you pay for it. He's just given you the direction on the what you'd wanna do and it's up to you to trial and error the code so that it works on your server.

    You'd just have to put some time in to see if it works or not, and when it does it'll give you satisfaction that you've learnt something. Since from your two post, it gives me the impression that you're very new to coding a RSPS.
    Reply With Quote  
     

  10. Thankful users:


  11. #9  
    Registered Member
    Join Date
    May 2020
    Posts
    37
    Thanks given
    10
    Thanks received
    2
    Rep Power
    11
    Quote Originally Posted by Six Echo View Post
    He clearly stated he was new and needed a hand. He didn't need someone to give him wisdom!

    So, thinking about this if I were a new player a great place to start would be by example. Thankfully, there are so many methods already in your Client and Source to help you with this, If NOT there are many other methods you can pull from online. So, I'm guessing you already took the liberty to Google this and FOUND nothing mainly because this is a copy and paste method for most experienced programmers. I would highly advise looking at other methods such as Amulet of Glory use charges or other items that already exist that simply do the same thing already.


    You stated your using Ruse base so you should have degradable items, you can look at that, and look at how those change your equipment[] setup.

    Long story short you are just checking if user has charges (int) / (boolean) could cover that. so in player.java find int energy or something and make a new one called SythePower = 0;

    Then you can check for this once the user is in combat. Look at degradable like said.

    When you want to change the item id of what the user is holding look into this line:
    Code:
    if (c.playerEquipment[i] == itemId)
    [i] would be the slot number.
    itemid would be == to that item id

    if you want to change it would be;

    Code:
    c.playerEquipment[0] = 123;


    ___________________
    iv made a lot of progress because of you added both uncharged and charged variants, has the scythe deduct charges when used, return charges upon unloading, i tied it into the CrawsBow how its done on Ruse but now im stuck with this issue
    trying to get charges to save for scythe, if i logout
    ItemCharges
    52550=0:59,
    chargeend
    15000=0:100,
    chargeend

    this is from player file after i logout, if i change this to

    ItemCharges
    52550=0:59,
    15000=0:100,
    chargeend

    it saves here is a snip from SaveCharges.java for it https://gyazo.com/b2c8f8b935ae0928002189659b73c9a8

    what am i doing wrong? currently if i add charges to the scythe and log out when i log back in the charges are gone, unless i edit that in player file so its a issue with saving. butt i dont see what is wrong.

    also the 52550 = craws bow charges which saves when i log out and back in, its the fact that its doing crawsbow charges then chargend is making it not save.
    Reply With Quote  
     

  12. #10  
    Registered Member
    Join Date
    Mar 2014
    Posts
    35
    Thanks given
    13
    Thanks received
    7
    Rep Power
    11
    Personally, I recommend just adding these values to the player's json file (put entry under PlayerSaving & PlayerLoading) and calling the save command when the value changes (your remove/add methods for the values) or they logout. Or just copy the loading/saving for players and make a separate folder for charges. Either of those options are easy to add.
    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. Want to learn how to code RSPS
    By lemon ammi in forum Help
    Replies: 2
    Last Post: 02-13-2019, 10:30 PM
  2. Replies: 13
    Last Post: 12-14-2017, 04:53 PM
  3. Want to learn how to program
    By Elitepete in forum Help
    Replies: 2
    Last Post: 07-03-2013, 02:51 PM
  4. Replies: 0
    Last Post: 01-26-2012, 11:00 PM
  5. Replies: 2
    Last Post: 05-17-2009, 06:57 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
  •