Why have two commands that initiate the same way?
Also I would make a list of the drops then have it display on the interface, instead of adding it to the bank.
Unless of course you want this to be a admin command, in which case it should be fine.
|
Hey,
I'm currently stuck on this command where basically you simulate the loot of a npc or boss and send it to your bank, no real purpose it's just for fun.
Example : ::loot (NPCID) (AMOUNT)
Currently using a ruse base & these are my two attempts. i have looked through the forum and haven't really found anything that supplies an answer. a pretty noob issue more than likely.Code:if (command[0].equals("loot")) { int npcId = Integer.parseInt(command[1]); int amount = Integer.parseInt(command[2]); for(int i = 0; i <= amount; i++) { } NPCDrops.dropItems(player, npc); //Item item = new Item(id, 1000); player.getBank().add(item), true); } if (command[0].equals("loot")) { int npcId = Integer.parseInt(command[1]); int amount = Integer.parseInt(command[2]); for (int i = 0; i < amount; i++) { for (NPCDrops drop : NpcDropItem[npcId]) { player.getBank().addItems(npcId, refresh) } } }
i'd appreciate any help. thanks![]()
Why have two commands that initiate the same way?
Also I would make a list of the drops then have it display on the interface, instead of adding it to the bank.
Unless of course you want this to be a admin command, in which case it should be fine.
Have a look at your NPCDrops.java class and see how the drops for each NPC are found.
Seperate them then if you wish to show us your attempt and do not forget a time stamp or some indication what you have tried at first, second etc.
What I mean is have some order so the person reading understands it is different attempts and just not two codes of the same.
What you need to do is find out how your drop system operates and have that inside your command based on the npcid.
How you do this is totally depending on YOUR SOURCE's system. If you are not happy with it, just rewrite it.
Well, i did say that they are 2 different attempts in the thread, "Currently using a ruse base & these are my two attempts", however i should have put more of a visual indication in the code.
And thanks, i have taken a look at my drop system and changed a few things and i have the command functioning .
doesn't look like you understand loops
Look through your source code and find the function for when an NPC drops items on death. Either use that method, or create another method that does the same function but accessible from where the original drop function was called, and also where you call your command (to limit redundancy). Not sure what framework you're using, but I think you'll have some success with finding what you need by searching throughout the entire project in your IDE.
If you need more assistance my discord is Venn#0193![]()
« wind strike on npc is does not cast spell it just attacks. | Took a break » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |