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.
|
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.
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:
[i] would be the slot number.Code:if (c.playerEquipment[i] == itemId)
itemid would be == to that item id
if you want to change it would be;
Code:c.playerEquipment[0] = 123;
___________________
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.
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.
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.
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.
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |