Look at the code that handles the order based on your combat level. Copy it and make a condition that has to be met for that rule to apply.
|
racoonleftclick.PNG
I'd like to prioritize "Walk here" as the left click option. How would I go about doing this? I've added the "Interact" option in the client, so that's a custom right-click option on the raccoon. I'll post any code from my client if needed. I'm using pretty much a half non-renamed, half renamed client. This was what I added in EntityDef.java for the right-click option:
Code:if(i == 3286) { entityDef.actions = new String[5]; entityDef.actions[4] = "Interact"; }
Last edited by runefreak10; 03-17-2023 at 01:37 PM.
Look at the code that handles the order based on your combat level. Copy it and make a condition that has to be met for that rule to apply.
So this got me a little bit closer! Here's what I was able to do so far
almostcorrect.jpg
It seems to be sending the action twice now, and I can't seem to figure out how to make that top action disappear. Here's what I added so far:
interactcode.PNG
(Here's the actual pasted code if needed)
Any thoughts?Code:if(entityDef.actions != null) { for(int i1 = 4; i1 >= 0; i1--) if(entityDef.actions[i1] != null && entityDef.actions[i1].equalsIgnoreCase("attack") || entityDef.actions[i1] != null && entityDef.actions[i1].equalsIgnoreCase("interact")) { char c = '\0'; if((entityDef.combatLevel > myPlayer.combatLevel) || entityDef.name.equalsIgnoreCase("Raccoon")) c = '\u07D0'; menuActionName[menuActionRow] = entityDef.actions[i1] + " @yel@" + s; if(i1 == 0) menuActionID[menuActionRow] = 20 + c; if(i1 == 1) menuActionID[menuActionRow] = 412 + c; if(i1 == 2) menuActionID[menuActionRow] = 225 + c; if(i1 == 3) menuActionID[menuActionRow] = 965 + c; if(i1 == 4) menuActionID[menuActionRow] = 478 + c; menuActionCmd1[menuActionRow] = i; menuActionCmd2[menuActionRow] = k; menuActionCmd3[menuActionRow] = j; menuActionRow++; } }
Declare:
Code:public static int npcPetId = -1;underneath the } else{Code:for (int l = 4; l >= 0; l--) { // Is not an attack option. if (npcDefinition.actions[l] != null) { if (npcDefinition.actions[l].equalsIgnoreCase("Pick-up")) { //System.out.println("npcPetId = "+npcPetId+" vs index: "+npcIndex); if (npcPetId != npcIndex) { return; } } } } }
You'll need a packet to send what is/isn't a pet from your Server, my codes been leaked many of times for my Server, I'm sure you can find it, but I've refactored much of the Server/Client at this point, I'm not comfortable with sharing it, I know I've not refactored this code as of yet, had no need to.Code:boolean isPet = false; if (npcDefinition.actions != null) { for (int l = 4; l >= 0; l--) { // Is not an attack option. if (npcDefinition.actions[l] != null && !npcDefinition.actions[l].equalsIgnoreCase("attack")) { if (npcDefinition.actions[l].contains("Pick-up")) { isPet = true; } char c = '\0'; if (isPet && setting.shift_pet_options) { c = '\u07D0'; } menuActionText[menuActionRow] = npcDefinition.actions[l] + " <col=ffff00>" + name; if (l == 0) menuActionTypes[menuActionRow] = 20 + c; if (l == 1) menuActionTypes[menuActionRow] = 412 + c; if (l == 2) menuActionTypes[menuActionRow] = 225 + c; if (l == 3) menuActionTypes[menuActionRow] = 965 + c; if (l == 4) menuActionTypes[menuActionRow] = 478 + c; selectedMenuActions[menuActionRow] = npcIndex; firstMenuAction[menuActionRow] = npcArrayIndex; secondMenuAction[menuActionRow] = j; menuActionRow++; } } }
So I added this:
However it still seems to be sending the interact option twice. I can't seem to remove that top optionCode:if(entityDef.actions != null) { for(int i1 = 4; i1 >= 0; i1--) if(entityDef.actions[i1] != null && entityDef.actions[i1].equalsIgnoreCase("interact")) { char c = '\0'; if(entityDef.name.equalsIgnoreCase("Raccoon")) c = '\u07D0'; menuActionName[menuActionRow] = entityDef.actions[i1] + " @yel@" + s; if(i1 == 0) menuActionID[menuActionRow] = 20 + c; if(i1 == 1) menuActionID[menuActionRow] = 412 + c; if(i1 == 2) menuActionID[menuActionRow] = 225 + c; if(i1 == 3) menuActionID[menuActionRow] = 965 + c; if(i1 == 4) menuActionID[menuActionRow] = 478 + c; menuActionCmd1[menuActionRow] = i; menuActionCmd2[menuActionRow] = k; menuActionCmd3[menuActionRow] = j; menuActionRow++; } }
Wait I see you changed your post. Let me try that
Try it without the raccoon being the in the code;
Code:if(entityDef.actions != null) { for(int i1 = 4; i1 >= 0; i1--) if(entityDef.actions[i1] != null && entityDef.actions[i1].equalsIgnoreCase("Interact")) {// Interact was lowercase "interact" in your snippet char c = '\u07D0'; //we don't want to tie this just to raccoon, because well, how many NPC's in OSRS have "Interact" as an option? menuActionName[menuActionRow] = entityDef.actions[i1] + " @yel@" + s; if(i1 == 0) menuActionID[menuActionRow] = 20 + c; if(i1 == 1) menuActionID[menuActionRow] = 412 + c; if(i1 == 2) menuActionID[menuActionRow] = 225 + c; if(i1 == 3) menuActionID[menuActionRow] = 965 + c; if(i1 == 4) menuActionID[menuActionRow] = 478 + c; menuActionCmd1[menuActionRow] = i; menuActionCmd2[menuActionRow] = k; menuActionCmd3[menuActionRow] = j; menuActionRow++; } }
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |