Resolved (RS3) Cow NPCDefinition is null

Discussion in 'Client & Site Support' started by Ozzy, Jul 21, 2015.

  1. I had a few people mention that my fighter was having trouble with cows and after looking into it you can see in the image below cows and cow calfs seem to have a null name in their definition, any idea what's up with this? @Cloud

    Here's my game pack id if that helps at all: 2e345db6

    [​IMG]

     
    #1 Ozzy, Jul 21, 2015
    Last edited: Jul 21, 2015
  2. Best Answer:
    Post #3 by Cloud, Jul 21, 2015
  3. Code (Text):
    1.  
    2. NpcComposite{id=12362, name='null', options=[null, Attack, Tip, null, Examine], combatLevel=4, visibleOnMinimap=true, varpId=-1, varpbitId=27348, childIds=[20972, 20969, 20969, 20969, 20969, 20973, 20972], params={2848=3, 2865=130, 641=120, 2849=80, 2850=70, 2851=60, 2852=50, 26=1, 29=130, 14=4}}
    3.  
    They seem to have moved some of the cows to dynamic npcs,The main id is merely a container to redirect to child definitions based on varps. You will need to use the method getLocalState() within the NpcDefinition class

    If your interested this is how it works, the code is from my cache reader based on client code
    Code (Text):
    1.     public final NpcComposite getChildComposite(VarpDataAccessor accessor) {
    2.         int index = -1;
    3.         if (varpbitId != -1) {
    4.             VarBit varBitDefinition = compositeList.getCacheReader().<VarBitList>getList(ConfigListType.VARBIT).get(varpbitId);
    5.             if (varBitDefinition != null)
    6.                 index = varBitDefinition.getValue(accessor.getIndexValue(varBitDefinition.varType.varId));
    7.         } else if (varpId != -1) {
    8.             VarPlayerType varPlayerType = compositeList.getCacheReader().<VarPlayerTypeList>getVarList(VarDomainType.PLAYER).get(varpId);
    9.             if (varPlayerType != null)
    10.                 index = accessor.getIndexValue(varPlayerType.varId);
    11.         }
    12.         if (index < 0 || index >= childIds.length - 1) {
    13.             int childId = childIds[childIds.length - 1];
    14.             if (childId != -1)
    15.                 return compositeList.get(childId);
    16.             return null;
    17.         }
    18.         if (childIds[index] == -1)
    19.             return null;
    20.         return compositeList.get(childIds[index]);
    21.     }
     
  4. Overflow is right, look into the getLocalState() method. If you scroll down in the dev toolkit you'd see that it has local state data below.
     
  5. Ah okay thank you both for the info, I did notice the local state but wasn't sure what it meant, I'll make the necessary changes.
     

Share This Page

Loading...