What I need to do is when monster skeleton_ghost kill any champion wearing item called false_amulet, then cinematic start to play.
I have created party ondie hook
cloneObject{
name = "party",
baseObject = "party",
onDie = function()
murderMystery.checkWhoDidIt()
end,
}
and script which which will start cinematic if ANY member is killed, no matter if that amulet is equiped or not
Code: Select all
suspectedMurderer = "skeleton_ghost"
function checkWhoDidIt()
local x = ""
local y = ""
for i=1,4 do
if i==1 then
x = party.x+1
elseif i == 3 then
x = party.x-1
else
x = party.x
end
if i==2 then
y = party.y+1
elseif i == 4 then
y = party.y-1
else
y = party.y
end
for j in entitiesAt(party.level, x, y) do
if j.name == suspectedMurderer then
completeGame("mod_assets/cinematics/ending2.lua")
return
end
end
end
endfunction itemCheck(item)
for champ = 1,4 do
for slot = x do (do not know which slot is equiped amulet now)
local x = party:getChampion(champ):getItem(slot)
if x ~= nil then
if x.name == "false_amulet" then
....
Hope its understable.
[/spoiler]