I saw Azzkabans post, but it was about a monster having half hp, so I thought instead of bumping it I'll make another.
I just started using this script, it creates a portal for x seconds when I kill a monster.
So, what I'm wondering is, can I add more more monsters in this, and just add the event in monstername.xml. I'm thinking of having alot of these quests so, would be cool if I could do something like this:
to avoit making a new register in login.lua and a totally new lua creature script (just copy/paste, but still)
I have no idea howto add more monsters, I just.. made an example here because I think it should just be adidng a "," but I have no clue
I just started using this script, it creates a portal for x seconds when I kill a monster.
Lua:
function onKill(cid, target, lastHit)
local m = {
["Angry Snowman"] = {
time = 10, -- Seconds
to = { x = 1011, y = 347, z = 7 }, -- Where Teleport Goes
tp = { x = 996, y = 343, z = 6 } -- Where Teleport Creates
}
}
local monster = m[getCreatureName(target)]
local function deleteTeleport()
local teleport = getTileItemById(monster.tp, 1387)
if(teleport.uid > 0) then
doRemoveItem(teleport.uid)
doSendMagicEffect(monster.tp, CONST_ME_POFF)
doSendAnimatedText(monster.tp, "Closed", TEXTCOLOR_RED)
end
return true
end
if(monster) then
doCreateTeleport(1387, monster.to, monster.tp)
addEvent(deleteTeleport, monster.time * 1000)
doCreatureSay(cid, "You have " .. monster.time .. " seconds to escape!", TALKTYPE_ORANGE_1)
end
return true
end
So, what I'm wondering is, can I add more more monsters in this, and just add the event in monstername.xml. I'm thinking of having alot of these quests so, would be cool if I could do something like this:
Lua:
function onKill(cid, target, lastHit)
local m = {
["Angry Snowman"] = {
time = 10, -- Seconds
to = { x = 1011, y = 347, z = 7 }, -- Where Teleport Goes
tp = { x = 996, y = 343, z = 6 } -- Where Teleport Creates
},
["Devilatus"] = {
time = 10, -- Seconds
to = { x = xxx, y = xxx, z = x }, -- Where Teleport Goes
tp = { x = xxxx, y = xxx, z = x } -- Where Teleport Creates
}
}
local monster = m[getCreatureName(target)]
local function deleteTeleport()
local teleport = getTileItemById(monster.tp, 1387)
if(teleport.uid > 0) then
doRemoveItem(teleport.uid)
doSendMagicEffect(monster.tp, CONST_ME_POFF)
doSendAnimatedText(monster.tp, "Closed", TEXTCOLOR_RED)
end
return true
end
if(monster) then
doCreateTeleport(1387, monster.to, monster.tp)
addEvent(deleteTeleport, monster.time * 1000)
doCreatureSay(cid, "You have " .. monster.time .. " seconds to escape!", TALKTYPE_ORANGE_1)
end
return true
end
to avoit making a new register in login.lua and a totally new lua creature script (just copy/paste, but still)
I have no idea howto add more monsters, I just.. made an example here because I think it should just be adidng a "," but I have no clue