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

*NEW* Zombie Event [TFS 1.x]

It seems you use TFS 1.0, either update to latest TFS. or you need put this under the function which cast player as nil:
Code:
local player = Player(player)

But i recommend to update to latest tfs.
 
Suggestions: (or option for auto use)
Code:
-Global Time for the Event so a GM doesn't have to start it, I Believe it's better to let the game Control itself.
-A "Spawned" Teleport to enter instead of Command. (That you can have in the Event Room/Area)

I am using your event for Rookville, thank you Printer.

Kind Regards,
Eldin
 
Suggestions: (or option for auto use)
Code:
-Global Time for the Event so a GM doesn't have to start it, I Believe it's better to let the game Control itself.
-A "Spawned" Teleport to enter instead of Command. (That you can have in the Event Room/Area)

I am using your event for Rookville, thank you Printer.

Kind Regards,
Eldin
Just take the onSay code and put it in an event script... of course changes will need to be made, but they are minor... now get back to work on Eldin's World! :)
 
@Printer doesn't this work for tfs 1.2? When im doing !zombie it does nothing it doesn't give errors either

Yes, this works with 1.2.. Can you give more info on what is not working? !zombie start, min,max,start time
 
Last edited:
@Printer Im getting these errors (im using TFS 1.2)
21m6mmf.jpg


data/creaturescripts/creaturescripts.lua
Code:
    <!-- Zombie Event -->
    <event type="preparedeath" name="ZombiePlayerDeath" script="player/zombieEventDeath.lua" />
    <event type="death" name="ZombieOnDeath" script="player/zombieEventDeath.lua" />

data/creaturescripts/scripts/zombieEventDeath.lua
Code:
function onDeath(monster, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
    -- Send text and effect
    monster:say("I WILL BE BACK!", TALKTYPE_MONSTER_YELL)
    monster:getPosition():sendMagicEffect(CONST_ME_MORTAREA)

    -- Remove zombie count, when it dies
    Game.setStorageValue(ze_zombieCountGlobalStorage, getZombieEventZombieCount() - 1)

    -- Store player kills
    local killerId = killer:getId()
    if zombieKillCount[killerId] ~= nil then
        zombieKillCount[killerId] = zombieKillCount[killerId] + 1
    else
        zombieKillCount[killerId] = 1
    end

    return true
end

function onPrepareDeath(player, killer)
    -- Remove player from count
    local count = getZombieEventJoinedCount()
    Game.setStorageValue(ze_joinCountGlobalStorage, count - 1)

    -- Reset player after death
    player:teleportTo(player:getTown():getTemplePosition())
    player:setStorageValue(ze_joinStorage, 0)
    player:addHealth(player:getMaxHealth())
    player:addMana(player:getMaxMana())
    player:unregisterEvent("ZombiePlayerDeath")

    -- Let's reward the 3 last players
    if count <= 3 then
        local playerName =  player:getName()

        local trophy = ze_trophiesTable[count]
        local item = player:addItem(trophy.itemid, 1)
        if item then
            item:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, string.format("%s %s\n%s.", playerName, trophy.description, os.date("%x")))
        end

        -- Store kill count and remove from table to avoid memory leak
        local playerId, killCount = player:getId(), 0
        if zombieKillCount[playerId] ~= nil then
            killCount = zombieKillCount[playerId]
            zombieKillCount[playerId] = nil
        end

        -- Broadcast
        Game.broadcastMessage(string.format("%d place goes to %s of Zombie Event versus %d Zombies and slained %d Zombies.", count, playerName, getZombieEventZombieCount(), killCount))

        -- The last player died, let's reset the event
        if count <= 1 then
            resetZombieEvent()
        end
    end

    return false
end
 
@Printer Im getting these errors (im using TFS 1.2)
21m6mmf.jpg


data/creaturescripts/creaturescripts.lua
Code:
    <!-- Zombie Event -->
    <event type="preparedeath" name="ZombiePlayerDeath" script="player/zombieEventDeath.lua" />
    <event type="death" name="ZombieOnDeath" script="player/zombieEventDeath.lua" />

data/creaturescripts/scripts/zombieEventDeath.lua
Code:
function onDeath(monster, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
    -- Send text and effect
    monster:say("I WILL BE BACK!", TALKTYPE_MONSTER_YELL)
    monster:getPosition():sendMagicEffect(CONST_ME_MORTAREA)

    -- Remove zombie count, when it dies
    Game.setStorageValue(ze_zombieCountGlobalStorage, getZombieEventZombieCount() - 1)

    -- Store player kills
    local killerId = killer:getId()
    if zombieKillCount[killerId] ~= nil then
        zombieKillCount[killerId] = zombieKillCount[killerId] + 1
    else
        zombieKillCount[killerId] = 1
    end

    return true
end

function onPrepareDeath(player, killer)
    -- Remove player from count
    local count = getZombieEventJoinedCount()
    Game.setStorageValue(ze_joinCountGlobalStorage, count - 1)

    -- Reset player after death
    player:teleportTo(player:getTown():getTemplePosition())
    player:setStorageValue(ze_joinStorage, 0)
    player:addHealth(player:getMaxHealth())
    player:addMana(player:getMaxMana())
    player:unregisterEvent("ZombiePlayerDeath")

    -- Let's reward the 3 last players
    if count <= 3 then
        local playerName =  player:getName()

        local trophy = ze_trophiesTable[count]
        local item = player:addItem(trophy.itemid, 1)
        if item then
            item:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, string.format("%s %s\n%s.", playerName, trophy.description, os.date("%x")))
        end

        -- Store kill count and remove from table to avoid memory leak
        local playerId, killCount = player:getId(), 0
        if zombieKillCount[playerId] ~= nil then
            killCount = zombieKillCount[playerId]
            zombieKillCount[playerId] = nil
        end

        -- Broadcast
        Game.broadcastMessage(string.format("%d place goes to %s of Zombie Event versus %d Zombies and slained %d Zombies.", count, playerName, getZombieEventZombieCount(), killCount))

        -- The last player died, let's reset the event
        if count <= 1 then
            resetZombieEvent()
        end
    end

    return false
end
??????????????????????????????????????????????
player/zombieEventDeath.lua
change it to just zombieEventDeath.lua lol
 
kkkk srry wasn't paying attention >.<
hehe thanks anyway

??????????????????????????????????????????????
player/zombieEventDeath.lua
change it to just zombieEventDeath.lua lol
Thank you! But now I have another problem when im using !zombie start,1,2,60 (because there are 2 people online) nothing happens. The teleport does not spawn and there is no message or anything. Also if someone says !zombie join they can enter the waiting room even when the event isn't started yet and when the first one enters the waiting room it says
Undead Mage has joined the Zombie Event! [0/30].

and when you keep spamming !zombie join (even when you're already inside the waiting room) you will get this
Undead Mage has joined the Zombie Event! [1/30].
Undead Mage has joined the Zombie Event! [2/30].
Undead Mage has joined the Zombie Event! [3/30].
Undead Mage has joined the Zombie Event! [4/30].

I am using tfs 1.2 and im not getting any errors.
 
Back
Top