Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Resolved (RS3) Cow NPCDefinition is null

Joined
Nov 5, 2014
Messages
505
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

iujHgk9.png
 
Last edited:
Joined
Mar 26, 2014
Messages
33
Code:
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}}

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:
    public final NpcComposite getChildComposite(VarpDataAccessor accessor) {
        int index = -1;
        if (varpbitId != -1) {
            VarBit varBitDefinition = compositeList.getCacheReader().<VarBitList>getList(ConfigListType.VARBIT).get(varpbitId);
            if (varBitDefinition != null)
                index = varBitDefinition.getValue(accessor.getIndexValue(varBitDefinition.varType.varId));
        } else if (varpId != -1) {
            VarPlayerType varPlayerType = compositeList.getCacheReader().<VarPlayerTypeList>getVarList(VarDomainType.PLAYER).get(varpId);
            if (varPlayerType != null)
                index = accessor.getIndexValue(varPlayerType.varId);
        }
        if (index < 0 || index >= childIds.length - 1) {
            int childId = childIds[childIds.length - 1];
            if (childId != -1)
                return compositeList.get(childId);
            return null;
        }
        if (childIds[index] == -1)
            return null;
        return compositeList.get(childIds[index]);
    }
 
Engineer
Joined
Jul 28, 2013
Messages
2,776
Code:
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}}

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:
    public final NpcComposite getChildComposite(VarpDataAccessor accessor) {
        int index = -1;
        if (varpbitId != -1) {
            VarBit varBitDefinition = compositeList.getCacheReader().<VarBitList>getList(ConfigListType.VARBIT).get(varpbitId);
            if (varBitDefinition != null)
                index = varBitDefinition.getValue(accessor.getIndexValue(varBitDefinition.varType.varId));
        } else if (varpId != -1) {
            VarPlayerType varPlayerType = compositeList.getCacheReader().<VarPlayerTypeList>getVarList(VarDomainType.PLAYER).get(varpId);
            if (varPlayerType != null)
                index = accessor.getIndexValue(varPlayerType.varId);
        }
        if (index < 0 || index >= childIds.length - 1) {
            int childId = childIds[childIds.length - 1];
            if (childId != -1)
                return compositeList.get(childId);
            return null;
        }
        if (childIds[index] == -1)
            return null;
        return compositeList.get(childIds[index]);
    }
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.
 
Joined
Nov 5, 2014
Messages
505
Code:
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}}

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:
    public final NpcComposite getChildComposite(VarpDataAccessor accessor) {
        int index = -1;
        if (varpbitId != -1) {
            VarBit varBitDefinition = compositeList.getCacheReader().<VarBitList>getList(ConfigListType.VARBIT).get(varpbitId);
            if (varBitDefinition != null)
                index = varBitDefinition.getValue(accessor.getIndexValue(varBitDefinition.varType.varId));
        } else if (varpId != -1) {
            VarPlayerType varPlayerType = compositeList.getCacheReader().<VarPlayerTypeList>getVarList(VarDomainType.PLAYER).get(varpId);
            if (varPlayerType != null)
                index = accessor.getIndexValue(varPlayerType.varId);
        }
        if (index < 0 || index >= childIds.length - 1) {
            int childId = childIds[childIds.length - 1];
            if (childId != -1)
                return compositeList.get(childId);
            return null;
        }
        if (childIds[index] == -1)
            return null;
        return compositeList.get(childIds[index]);
    }

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.

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.
 
Top