Thread: could anyone help me making a lil code

Results 1 to 3 of 3
  1. #1 could anyone help me making a lil code 
    Registered Member risgaard's Avatar
    Join Date
    Jul 2013
    Posts
    648
    Thanks given
    12
    Thanks received
    16
    Rep Power
    13
    well all i want is abit help of making a enum class. or a good setup for slayer monsters like


    npc id, item req, to attack em because i want it like on rs you need let's say mirrior shield for basilisk and nose peg for aberret spectres

    i am not ask for spoon feede but a lil startup or explain because iam totally new at enums
    my grammar. aint pefect. but atleast you understand me

    did i help you ?
    i am not asking for rep but you can atleast say thanks
    Reply With Quote  
     

  2. #2  
    Donator
    Darkness's Avatar
    Join Date
    Nov 2012
    Age
    26
    Posts
    876
    Thanks given
    121
    Thanks received
    75
    Rep Power
    47
    100% Credit to jakeHop22 for this, Modified his thread a bit, he's my coding partner so I guess he won't mind :

    Combatassistant.java
    Here there's only two in the format but you can add more :

    Code:
    public int[][] slayerReqItems = {{NPCID,ITEMID}, {NPCID,ITEMID}};
    Then :

    Code:
    	public boolean needThatItem(int i) {
    		for (int j = 0; j < slayerReqItems.length; j++) {
    			if (slayerReqItems[j][0] == Server.npcHandler.npcs[i].npcType) {
    				if (!c.getItems().playerHasItem(slayerReqItems[j][1],1)) {
    					if (slayerReqItems[j][1] == 4587) {
    					c.slayerIName = "Dragon Scimitar";
    					}
    					c.sendMessage("You need a " + c.slayerIName + " to attack this NPC.");
    					return false;
    				}
    			}
    		}
    		return true;
    	}
    Then under
    Code:
    			if (!goodSlayer(i)) {
    				resetPlayerAttack();
    				return;
    			}
    Add
    Code:
    			if (!needThatItem(i)) {
    				resetPlayerAttack();
    				return;
    			}
    Player.java
    Code:
    public String slayerIName;
    I didn't link you to his thread because I wanted to modify this part so it handled all items name from the item list ;
    Code:
    					if (slayerReqItems[j][1] == 4587) {
    					c.slayerIName = "Dragon Scimitar";
    					}
    					c.sendMessage("You need a " + c.slayerIName + " to attack this NPC.");
    But finaly im lazy
    Attached image
    Reply With Quote  
     

  3. #3  
    Registered Member risgaard's Avatar
    Join Date
    Jul 2013
    Posts
    648
    Thanks given
    12
    Thanks received
    16
    Rep Power
    13
    i think i love you thanks bro

    2 small questions more,

    1 what will i do if i want it to support 2 diffrint options like kurash can be harmed by broad-bolts and broad-arrows,

    and are there a way to shut down the name metode because if i am using all the slayer items in game, it will be a dmn long code


    btw did you make this for its not spoon feede because i noticed a lil bug, i can still attack monsters without the dragon scimitar but if i equip d scimitar it stops my attack
    my grammar. aint pefect. but atleast you understand me

    did i help you ?
    i am not asking for rep but you can atleast say thanks
    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: 10
    Last Post: 09-25-2013, 06:20 AM
  2. could anyone help me trying to make a php page like this
    By oblivion742 in forum Application Development
    Replies: 1
    Last Post: 04-29-2013, 09:31 PM
  3. Could anyone help me add a new model header?
    By Sillhouette in forum Models
    Replies: 3
    Last Post: 12-27-2011, 12:00 AM
  4. Replies: 4
    Last Post: 12-16-2010, 12:12 PM
  5. Replies: 1
    Last Post: 08-16-2008, 12:19 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
  •