1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Resolved (RS3) Cow NPCDefinition is null

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

  1. Ozzy

    Joined:
    Nov 5, 2014
    Messages:
    505
    Likes Received:
    162
    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. Overflow

    Joined:
    Mar 26, 2014
    Messages:
    33
    Likes Received:
    4
    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. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    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. Ozzy

    Joined:
    Nov 5, 2014
    Messages:
    505
    Likes Received:
    162
    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...