• 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!

Frestorm Event problem with dead players

jareczekjsp

Member
Joined
Jan 30, 2023
Messages
188
Reaction score
9
GitHub
Jarek123
Hello I have problem with fire storm event Tfs 0.4 when player died lose Level and I have error in console like that

[4:4:24] [Error - CreatureScript Interface]
[4:4:24] data/creaturescripts/scripts/deathbroadcast.lua:eek:nDeath
[4:4:24] Description:
[4:4:24] (LuaInterface::luaGetCreatureName) Creature not found

[4:4:25] [Error - CreatureScript Interface]
[4:4:25] data/creaturescripts/scripts/deathbroadcast.lua:eek:nDeath
[4:4:25] Description:
[4:4:25] data/creaturescripts/scripts/deathbroadcast.lua:5: attempt to concatenate a boolean value
[4:4:25] stack traceback:
[4:4:25] data/creaturescripts/scripts/deathbroadcast.lua:5: in function <data/creaturescripts/scripts/deathbroadcast.lua:1>
function onDeath(cid, corpse, deathList)
if isPlayer(deathList[1]) then
return true,doBroadcastMessage(" The player ".. getCreatureName(cid) .. " [Level: " .. getPlayerLevel(cid) .. "] Was killed by the player " .. getCreatureName(deathList[1]) .. " [Level: " .. getPlayerLevel(deathList[1]) .. "]",20)
end
return doBroadcastMessage(" The player ".. getCreatureName(cid) .. " [Level: " .. getPlayerLevel(cid) .. "] Was killed by the monster " .. getCreatureName(deathList[1]) .. ".",20)
end

Can somebody help me?please
 
Lua:
function onDeath(cid, corpse, deathList)
  if not isPlayer(cid) then
    return true
  end

  local killer = deathList[1]
  local playerName = getCreatureName(cid)
  local playerLevel = getPlayerLevel(cid)
 
  if not isCreature(killer) then
    doBroadcastMessage("The player " .. playerName .. " [Level: " .. playerLevel .. "] was killed by an unknown entity.", 20)
    return true
  end

  local killerName = getCreatureName(killer)

  if isPlayer(killer) then
    doBroadcastMessage("The player " .. playerName .. " [Level: " .. playerLevel .. "] was killed by the player " .. killerName .. " [Level: " .. getPlayerLevel(killer) .. "]", 20)
  elseif isMonster(killer) then
    doBroadcastMessage("The player " .. playerName .. " [Level: " .. playerLevel .. "] was killed by the monster " .. killerName .. ".", 20)
  end
  return true
end
 
Last edited:
[19:20:45] [Error - LuaInterface::loadFile] data/creaturescripts/scripts/deathbroadcast.lua:23: unexpected symbol near '/'
[19:20:45] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/deathbroadcast.lua)
[19:20:45] data/creaturescripts/scripts/deathbroadcast.lua:23: unexpected symbol near '/'

Now is Like that error
 
It should work, but I'm not sure. Test it there.

Lua:
function onDeath(cid, corpse, deathList)
    if isPlayer(deathList[1]) then
        doBroadcastMessage("The player " .. getCreatureName(cid) .. " [Level: " .. getPlayerLevel(cid) .. "] was killed by the player " .. getCreatureName(deathList[1]) .. " [Level: " .. getPlayerLevel(deathList[1]) .. "]", 20)
    else
        doBroadcastMessage("The player " .. getCreatureName(cid) .. " [Level: " .. getPlayerLevel(cid) .. "] was killed by the monster " .. getCreatureName(deathList[1]) .. ".", 20)
    end
    return true
end

or

Lua:
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
    if isPlayer(cid) then
        local messagePvP = "PvP: The player "..getCreatureName(cid).." [level: "..getPlayerLevel(cid).."] was killed by "..getCreatureName(lastHitKiller[1]).." [level: "..getPlayerLevel(lastHitKiller[1]).."]."
        local messagePvM = "PvM: The player "..getCreatureName(cid).." [level: "..getPlayerLevel(cid).."] was killed by "..getCreatureName(lastHitKiller[1]).."."
        
        if isPlayer(lastHitKiller[1]) and isPlayer(getCreatureMaster(lastHitKiller[1])) then
            doBroadcastMessage(messagePvP, MESSAGE_STATUS_CONSOLE_ORANGE)
        elseif not isPlayer(lastHitKiller[1]) and not isPlayer(getCreatureMaster(lastHitKiller[1])) then
            doBroadcastMessage(messagePvM, MESSAGE_STATUS_CONSOLE_ORANGE)
        end
    end
    
    return true
end
 
Last edited:
Thanks gentlemen, the error is no longer in the console, but the player still loses the level when he dies at the event
Firestorm Creaturescripts
function onStatsChange(cid, attacker, type, combat, value)
if type == 1 and getCreatureHealth(cid) <= value then
if isInRange(getThingPos(cid), {x = 532, y = 703, z = 7}, {x = 588, y = 741, z = 7}) then
doCreatureAddMana(cid, - getCreatureMana(cid))
doItemSetAttribute(doCreateItem(3058, 1, getPlayerPosition(cid)), "description", "You recognize " .. getCreatureName(cid) .. ". He was killed by Fire.")
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, 'You loss.')
return false
end
end
return true
end
 
Thanks gentlemen, the error is no longer in the console, but the player still loses the level when he dies at the event
Firestorm Creaturescripts
I would like to know which script is working, mine or the guy's?



I haven't tested it yet
Lua:
function onStatsChange(cid, attacker, type, combat, value)
    if type == 1 and getCreatureHealth(cid) <= value then
        if isInRange(getThingPos(cid), {x = 532, y = 703, z = 7}, {x = 588, y = 741, z = 7}) then
            doCreatureAddMana(cid, -getCreatureMana(cid))
            doItemSetAttribute(doCreateItem(3058, 1, getPlayerPosition(cid)), "description", "You recognize " .. getCreatureName(cid) .. ". He was killed by Fire.")
            doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
            doCreatureAddHealth(cid, -(getCreatureHealth(cid) - 1))
            doCreatureAddMana(cid, -(getCreatureMana(cid) - 1))
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, 'You lost.')
            return false
        end
    end
    return true
end
 
Last edited:
function onDeath(cid, corpse, deathList)
if not isPlayer(cid) then
return true
end

local killer = deathList[1]
local playerName = getCreatureName(cid)
local playerLevel = getPlayerLevel(cid)

if not isCreature(killer) then
doBroadcastMessage("The player " .. playerName .. " [Level: " .. playerLevel .. "] was killed by an unknown entity.", 20)
return true
end

local killerName = getCreatureName(killer)

if isPlayer(killer) then
doBroadcastMessage("The player " .. playerName .. " [Level: " .. playerLevel .. "] was killed by the player " .. killerName .. " [Level: " .. getPlayerLevel(killer) .. "]", 20)
elseif isMonster(killer) then
doBroadcastMessage("The player " .. playerName .. " [Level: " .. playerLevel .. "] was killed by the monster " .. killerName .. ".", 20)
end
return true
end
Post automatically merged:

this one
Post automatically merged:

Can you help me?
 
Last edited:
Thanks gentlemen, the error is no longer in the console, but the player still loses the level when he dies at the event
Firestorm Creaturescripts
You need to use onpreparedeath with something that gets if player is in event or not

If player die in event, then return false

Exemple:
Lua:
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
    if isPlayer(cid) then
        if isPlayerInEvent(cid) and isPlayer(lastHitKiller) then
            -- msgs and others code here
            return false --- player will not die, u need to add code above to restore HP, mana and teleport him back to start room or so
        end
    end
    
    return true -- player is not in event, then lets die
end
 
So I have change script Firestorm data/creaturescripts/Firestorm
from
function onStatsChange(cid, attacker, type, combat, value)
if type == 1 and getCreatureHealth(cid) <= value then
if isInRange(getThingPos(cid), {x = 532, y = 703, z = 7}, {x = 588, y = 741, z = 7}) then ---Room Event Position
doCreatureAddMana(cid, - getCreatureMana(cid))
doItemSetAttribute(doCreateItem(3058, 1, getPlayerPosition(cid)), "description", "You recognize " .. getCreatureName(cid) .. ". He was killed by Fire.")
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, 'You loss.')
return false
end
end
return true
end
To

function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
if isPlayer(cid) then
if isPlayerInEvent(cid) and isPlayer(lastHitKiller) then
if type == 1 and getCreatureHealth(cid) <= value then
if isInRange(getThingPos(cid), {x = 532, y = 703, z = 7}, {x = 588, y = 741, z = 7}) then
doCreatureAddMana(cid, - getCreatureMana(cid))
doItemSetAttribute(doCreateItem(3058, 1, getPlayerPosition(cid)), "description", "You recognize " .. getCreatureName(cid) .. ". He was killed by Fire.")
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, 'You loss.')
return false
end
end
return true
end
Yes bro?
 
So I have change script Firestorm data/creaturescripts/Firestorm
from

To


Yes bro?
No, what i give you is only an exemple, isPlayerInEvent doesnt exist, I only created this to give you an information about which type of function u need to add.. everything else is fine for me

I think your event use pos to determine who is in or out, so, try delete the second and third if
 
Back
Top