diff --git a/Chris.MultiNPC.lsl b/Chris.MultiNPC.lsl index ade77d7..4804e89 100644 --- a/Chris.MultiNPC.lsl +++ b/Chris.MultiNPC.lsl @@ -149,15 +149,22 @@ integer script_wait(integer slot, key npc, list command) integer script_walk(integer slot, key npc, list command) { - list objects = osGetSearchableObjectList(llList2String(command, 1)); - if(llGetListLength(objects) == 0) - { - llSay(0, "Cant find the walk target '" + llList2String(command, 1) + "'."); - return FALSE; - } + vector targetPosition = <0, 0, 0>; - list targetDataList = llGetObjectDetails(llList2Key(objects, 0), [OBJECT_POS]); - vector targetPosition = llList2Vector(targetDataList, 0); + if(llList2Vector(command, 1) == <0, 0, 0>) + { + list objects = osGetSearchableObjectList(llList2String(command, 1)); + if(llGetListLength(objects) == 0) + { + llSay(0, "Cant find the walk target '" + llList2String(command, 1) + "'."); + return FALSE; + } + + list targetDataList = llGetObjectDetails(llList2Key(objects, 0), [OBJECT_POS]); + targetPosition = llList2Vector(targetDataList, 0); + }else{ + targetPosition = llList2Vector(command, 1); + } osNpcMoveToTarget(npc, targetPosition, OS_NPC_NO_FLY); @@ -354,7 +361,6 @@ doNextScriptStep() case "touch": if(!script_touch(currentNPCSlot, currentNPCKey, lineCommandData)) llSay(0, "Script execution in '" + llList2String(lineCommandData, 0) + "' in nc '"+ currentncname +"' on line '" + currentLine + "' failed."); - currentNPCSlot--; break; case "goto": @@ -468,10 +474,7 @@ removeOldNPC() list npcdata = llCSV2List(osGetPrivateDataValue("tmpNPCList." + llGetKey())); integer count = llGetListLength(npcdata); - while(count--) - { - osNpcRemove(llList2Key(npcdata, count)); - } + while(count--)osNpcRemove(llList2Key(npcdata, count)); } //Generic Helpers @@ -502,6 +505,5 @@ list setDataEntryInDataList(list _dataList, string _key, string _value) _dataList += [_key, _value]; return _dataList; } - return llListReplaceList(_dataList, [_value], _inListPosition + 1, _inListPosition + 1); } \ No newline at end of file