• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Creature script? Or spell ?

clario

OTS based on Heroes III Might and Magic
Joined
Feb 4, 2018
Messages
98
Reaction score
5
Hello there! Im using TSF 0.4
I want to make rebirth spell for monster what im doing now :

local first_level = "Phoenix"
local second_level = "Phoenix Reb"
local rebirthEffect = CONST_ME_FLAM

function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
if getCreatureName(first_level) == true then
doSendMagicEffect(getCreaturePostion(cid, rebirthEffect)
doCreateCreature(second_level, getCreaturePosition(cid))
doCreatureSay(second_level, "CRAW!", RED)
end
return true
end

and i past this
<event type="monster event" name="phoenix" event="script" value="rebirth.lua"/>
in creaturescripts.xml

And here's log :
eu7CGn2.png


any sollution?
 
this is bad...
Code:
<event type="monster event" name="phoenix" event="script" value="rebirth.lua"/>

eventTypes:
Code:
login
  kill
  death
  preparedeath

this is also wrong
Code:
local first_level = "Phoenix"
local second_level = "Phoenix Reb"
local rebirthEffect = CONST_ME_FLAM

function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
if getCreatureName(first_level) == true then
doSendMagicEffect(getCreaturePostion(cid), rebirthEffect)
doCreateCreature(second_level, getCreaturePosition(cid))
doCreatureSay(second_level, "CRAW!", RED)
end
return true
end

;)

Maybe yes:
Code:
local first_level = "Phoenix"
local second_level = "Phoenix Reb"
local rebirthEffect = CONST_ME_FLAM

function onKill(cid, target)
if getCreatureName(target) == first_level then
  doSendMagicEffect(getCreaturePostion(target), rebirthEffect)
  local newCreature = doCreateMonster(second_level, getCreaturePosition(target))
  doCreatureSay(newCreature, "CRAW!", TALKTYPE_SAY)
end
return true
end

Code:
<event type="kill" name="killEventName" event="script" value="luaScriptName.lua"/>

add Login.lua
Code:
registerCreatureEvent(cid, "killEventName")
 
Code:
function onKill(cid, target)
if getCreatureName(target) == first_level then
  doSendMagicEffect(getCreaturePostion(target), rebirthEffect)
  local newCreature = doCreateMonster(second_level, getCreaturePosition(target))
  doCreatureSay(newCreature, "CRAW!", TALKTYPE_SAY)
end
return true
end

LUA:
local rebirth = {
    ["Phoenix"] = { to = "Phoenix Reb", effect = CONST_ME_FIREAREA, say = "CRAW!" },
    ["Phoenix Reb"] = { to = "Demon", effect = CONST_ME_FIREAREA, say = "CRAW! CRAW!"},
}
function onKill(cid, target)
    local event = rebirth[getCreatureName(target)]
    if event and next(event) then
        local position = getCreaturePosition(target)
        local x = doCreateMonster(event.to, position)
        if x then
            doSendMagicEffect(position, event.effect)
            doCreatureSay(x, event.say, TALKTYPE_SAY)
        end
    end
    return true
end
 
Back
Top