Thread: Command i have been stuck on for a while...

Results 1 to 10 of 10
  1. #1 Command i have been stuck on for a while... 
    Registered Member
    Join Date
    Aug 2020
    Posts
    7
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    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)

    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)
    					
    				}
    					
    			}
    		}
    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.

    i'd appreciate any help. thanks
    Reply With Quote  
     

  2. #2  
    Community Veteran


    arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,822
    Thanks given
    186
    Thanks received
    305
    Rep Power
    763
    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.


    "A fail act is something you do regular, but a dumb act is something you can learn from"
    Spoiler for Problem?:
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Aug 2020
    Posts
    7
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    Quote Originally Posted by arch337 View Post
    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.
    they aren't intended for both to be in the game, i thought that it may be useful to see the attempts i created. to clarify only one of the commands will remain after it functions correctly.
    Also, yes this is meant to be an admin command.
    Reply With Quote  
     

  4. #4  
    Donator
    Join Date
    Sep 2020
    Posts
    9
    Thanks given
    0
    Thanks received
    3
    Rep Power
    0
    Have a look at your NPCDrops.java class and see how the drops for each NPC are found.
    Reply With Quote  
     

  5. #5  
    Community Veteran


    arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,822
    Thanks given
    186
    Thanks received
    305
    Rep Power
    763
    Quote Originally Posted by rspsowner23614 View Post
    they aren't intended for both to be in the game, i thought that it may be useful to see the attempts i created. to clarify only one of the commands will remain after it functions correctly.
    Also, yes this is meant to be an admin command.
    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.


    "A fail act is something you do regular, but a dumb act is something you can learn from"
    Spoiler for Problem?:
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Aug 2020
    Posts
    7
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    Quote Originally Posted by arch337 View Post
    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 .
    Reply With Quote  
     

  7. #7  
    nice


    Join Date
    Jul 2014
    Posts
    641
    Thanks given
    271
    Thanks received
    300
    Rep Power
    2739
    u can check my code on how i properly simulated the drops, that code is kinda old tho and could be improved, but the simulation part is correct: [Only registered and activated users can see links. ]
    Reply With Quote  
     

  8. #8  
    Registered Member
    Join Date
    Sep 2020
    Posts
    1
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    Quote Originally Posted by Suic View Post
    u can check my code on how i properly simulated the drops, that code is kinda old tho and could be improved, but the simulation part is correct: [Only registered and activated users can see links. ]
    i'm op btw just on a new account because last account's name was a troll.

    yea i looked at this and it helped a lot, thanks
    Reply With Quote  
     

  9. #9  
    Registered Member

    Join Date
    Feb 2010
    Posts
    3,154
    Thanks given
    1,112
    Thanks received
    810
    Rep Power
    1401
    doesn't look like you understand loops
    Reply With Quote  
     

  10. #10  
    Diligence pays off.

    Venn's Avatar
    Join Date
    Nov 2012
    Age
    22
    Posts
    239
    Thanks given
    204
    Thanks received
    61
    Rep Power
    88
    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
    Quote Originally Posted by Therandomkid View Post
    if you wanna hate just remember i fucked your mom
    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: 2
    Last Post: 08-18-2015, 08:47 PM
  2. Been Stuck on this for hours!
    By stewiee in forum Help
    Replies: 5
    Last Post: 06-13-2013, 01:15 AM
  3. Some Drumstep I have been working on :)
    By Impulser in forum Literature & Language Arts
    Replies: 6
    Last Post: 03-16-2013, 01:04 PM
  4. Replies: 7
    Last Post: 08-11-2010, 09:43 PM
  5. Replies: 51
    Last Post: 08-27-2009, 04:57 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
  •