„Chris.MultiNPC.lsl“ ändern

This commit is contained in:
Christopher 2021-07-29 15:16:27 +00:00
parent 4de8c8b88f
commit 56d6c6ea60
1 changed files with 30 additions and 0 deletions

View File

@ -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.");