I tracked this bug down last night but didn't have time to fully go into finding a solution, and am not sure what the proper solution would be offhand. Not going to have time to really look into it again personally for a few days so figured I'd post the information here in case someone saw a quick fix for it.
The crash itself only happens when there are 5 XTargets, and only when messing with information on the 5th xtarget. So passing the ID of 5 to the xtarget like ${Me.XTarget[5].Type}
It's only happening to me in one particular loop, and others have said they have loops that work fine with 5 XTargets, so it could be something related to the sequence of information accessed about the XTarget, as I said I haven't had time to do more tracking or testing yet.
This Function:
Code: Select all
bool MQ2XTargetType::GETMEMBER()
{
if(!VarPtr.Ptr)
return false;
if(PMQ2TYPEMEMBER pMember=MQ2XTargetType::FindMember(Member))
{
PXTARGETDATA xtd = (PXTARGETDATA)VarPtr.Ptr;
switch((xTargetMembers)pMember->ID)
{
case Type:
{
char *pType = GetXtargetType(xtd->xTargetType);
Dest.Ptr = pType[0] ? pType : "UNKNOWN";
Dest.Type = pStringType;
return true;
}
case ID:
Dest.DWord = xtd->SpawnID;
Dest.Type = pIntType;
return true;
case Name:
Dest.Ptr = xtd->Name[0] ? xtd->Name : "NULL";
Dest.Type = pStringType;
return true;
}
}
return false;
};
Code: Select all
Dest.Ptr = pType[0] ? pType : "UNKNOWN";
Code: Select all
First-chance exception at 0x02b242b6 (MQ2Main.dll) in eqgame.exe: 0xC0000005: Access violation reading location 0x00000000.
Code: Select all
:nextAdd
/varset sID 0
/varset nCount ${Math.Calc[${nCount}+1]}
/if (!${xTargetOnly} && ${lTargCount} >= ${haterCount}) {
/varcalc nNCount ${nCount} - ${haterCount}
/if (${nNCount} < 0) /varset nNCount 0
/if (${checkID} == ${Me.ID}) {
/varset sID ${Me.NearestSpawn[${nNCount},npc radius ${cDist} range ${minMobLvl} ${maxMobLvl} los noalert ${alertList}].ID}
} else {
/varset sID ${Spawn[${checkID}].NearestSpawn[${nNCount},npc radius ${cDist} range ${minMobLvl} ${maxMobLvl} noalert ${alertList}].ID}
}
} else {
/varset nNCount ${nCount}
/if (${Me.XTarget[${nCount}].Type.Equal[Auto Hater]} && ${nCount} < 6) {
/if (${Me.XTarget[${nCount}].ID} && ${Spawn[${Me.XTarget[${nCount}].ID}].Distance} < ${cDist} && ${Spawn[${Me.XTarget[${nCount}].ID}].LineOfSight}) {
/varset sID ${Me.XTarget[${nCount}].ID}
} else /if (${Me.XTarget[${nCount}].ID}) {
/goto :nextAdd
}
} else /if (${nCount} < 6) {
/goto :nextAdd
} else /if (${xTargetOnly}) {
/call CorpseCheck
/return
}
}
${lTargCount} is determined in the CorpseCheck routine and is the number of currently live targets being tracked as adds.
I think the other variables are self explanatory by their context. If you need more information from me, just ask! And if no one has time before Wednesday or Friday I will go back to hunting the solution myself and if I find one will post it here for others.
Dev


