From 56d6c6ea60eb8c0b8c1f8c712e7978c53f46753e Mon Sep 17 00:00:00 2001 From: Christopher Date: Thu, 29 Jul 2021 15:16:27 +0000 Subject: [PATCH] =?UTF-8?q?=E2=80=9EChris.MultiNPC.lsl=E2=80=9C=20=C3=A4nd?= =?UTF-8?q?ern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Chris.MultiNPC.lsl | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Chris.MultiNPC.lsl b/Chris.MultiNPC.lsl index 4804e89..26f9595 100644 --- a/Chris.MultiNPC.lsl +++ b/Chris.MultiNPC.lsl @@ -173,6 +173,32 @@ integer script_walk(integer slot, key npc, list command) return TRUE; } +integer script_fly(integer slot, key npc, list command) +{ + vector targetPosition = <0, 0, 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_FLY); + + m_npcdata = setDataEntryInDataList(m_npcdata, "npc." + slot + ".state", "walk"); + m_npcdata = setDataEntryInDataList(m_npcdata, "npc." + slot + ".targetPosition", targetPosition); + return TRUE; +} + integer script_touch(integer slot, key npc, list command) { list objects = osGetSearchableObjectList(llList2String(command, 1)); @@ -354,6 +380,10 @@ doNextScriptStep() if(!script_walk(currentNPCSlot, currentNPCKey, lineCommandData)) llSay(0, "Script execution in '" + llList2String(lineCommandData, 0) + "' in nc '"+ currentncname +"' on line '" + currentLine + "' failed."); break; + case "fly": + if(!script_fly(currentNPCSlot, currentNPCKey, lineCommandData)) + llSay(0, "Script execution in '" + llList2String(lineCommandData, 0) + "' in nc '"+ currentncname +"' on line '" + currentLine + "' failed."); + break; case "include": if(!script_include(currentNPCSlot, currentNPCKey, lineCommandData)) llSay(0, "Script execution in '" + llList2String(lineCommandData, 0) + "' in nc '"+ currentncname +"' on line '" + currentLine + "' failed.");