„Chris.MultiNPC.lsl“ ändern

This commit is contained in:
Christopher 2021-08-01 15:04:08 +00:00
parent c3a178644a
commit 8289b22344
1 changed files with 14 additions and 1 deletions

View File

@ -161,6 +161,19 @@ doNextScriptStep()
if(llGetListLength(currentNPCDataList) == 0)
hardReset("target '"+targetKey+"' not found");
if(llVecDist(currentNPCPosition, lastPosition) <= 0.1)
{
currentStuck++;
if(currentStuck >= 5)
osTeleportAgent(currentNPCKey, targetPosition, <0, 0, 0>);
}else{
currentStuck = 0;
}
m_npcdata = setDataEntryInDataList(m_npcdata, "npc." + currentNPCSlot + ".lastPos", currentNPCPosition);
m_npcdata = setDataEntryInDataList(m_npcdata, "npc." + currentNPCSlot + ".stuckCounter", currentStuck);
if(llVecDist(currentNPCPosition, targetPosition) <= 1)
{
list newPathList = llDeleteSubList(llCSV2List(getDataEntryFromDataList(m_npcdata, "npc." + currentNPCSlot + ".walkPath")), 0, 0);
@ -193,7 +206,7 @@ doNextScriptStep()
currentStuck++;
if(currentStuck >= 5)
hardReset("npc stuck");
osTeleportAgent(currentNPCKey, targetPosition, <0, 0, 0>);
}else{
currentStuck = 0;
}