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

CreatureEvent [TFS 1.1] Revive System

Wouldn't the "Kill Me" option be just like dying? I don't get why you can "Teleport to town for free" or "Pay X item to be revived" - So when you die, you can just die where you are, login in the temple with the "kill me" - or you can die where you are, but teleport to town for free, but still die?
 
Well the "kill me" option actually kills you. The "pay x item" heals you and give the posibility to keep fighting in the same place you got the modal window. And the "teleport to town" heals you and teleport to the selected town.
The options in the script are just ideas, as I said before, my scripts are POC, not just a Copy&Paste thing. You have to edit whatever you like/dislike so the system becomes suitable for you.

Why someone will select the "kill me" option if you can revive in town for free?

Maybe I just didn't get what you were trying to say.
 
There is a problem with this script if using the latest TFS 1.1.

Somthing to do with the libs. I'll get an error and post it but it was saying somthing about "STORAGE = nil"
 
There is a problem with this script if using the latest TFS 1.1.

Somthing to do with the libs. I'll get an error and post it but it was saying somthing about "STORAGE = nil"
Can you post the error? I haven't update my TFS in a while... :D
 
Can you post the error? I haven't update my TFS in a while... :D

Heres the error.


Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/custom/revive.lua:onPrepareDeath
data/creaturescripts/scripts/custom/revive.lua:17: attempt to index global 'STORAGE' (a nil value)
stack traceback:
        [C]: ?
        data/creaturescripts/scripts/custom/revive.lua:17: in function 'applyDeathAttributes'
        data/creaturescripts/scripts/custom/revive.lua:89: in function <data/creaturescripts/scripts/custom/revive.lua:84>

its caused by your allow movement funcion.. its changed.

This is from the lib

Code:
-- Player --
function Player.allowMovement(self, allow)
    return self:setStorageValue(STORAGE.blockMovementStorage, allow and -1 or 1)
end

disabling these in your script fixes it but you can walk around.

Code:
self:allowMovement(false)

I have played around but failing miserably lol



THIS ALSO STUFFS UP YOUR CRAFTING SYSTEM!! ;) Which is what that other guy was talking about


Just wanted to add i removed the funcion from my lib and the script is now working. but yeah id love to know how to use it haha
 
Last edited:
Oh but that's not a TFS error, is because I used two different functions with the same name...
I think the one used in this script is better tho.
 
Oh but that's not a TFS error, is because I used two different functions with the same name...
I think the one used in this script is better tho.

So you think just delete the function out of my lib?
 
Yeah just delete it, I'm guessing that you'll have to delete it from the movements too.
 
Yeah just delete it, I'm guessing that you'll have to delete it from the movements too.

nah jsut lib ;) I really got to start working on this spell lol
 
Is not that hard, just check for the group id of the target (the dead one) and if is group 4 then revive him, using the same codes on the script, just need to move them to a lib file or copy them to the spell.
 
Is not that hard, just check for the group id of the target (the dead one) and if is group 4 then revive him, using the same codes on the script, just need to move them to a lib file or copy them to the spell.

i know every time i start it though i get distracted haha
 
HI, great system.. well .. im having the same problem as beastn had about the modal getting town.. im using tfs 1.2 and the changes made are here nothing more..

if player log out after battle time and log again the cuar will be alive ... also the player keep all items, nothing drops, shouldnt the player drop backpack and items? w/o the system it works normal, i mean the losing things...

Code:
local deathStorage = 49898
local deathGroupId = 66
local deathItemRevive = 2151

with your code i get the error

Code:
Lua Script Error: [Main Interface]
in a timer event called from:
(Unknown scriptfile)
data/creaturescripts/scripts/modaldeath.lua:94: attempt to index a nil value
stack traceback:
        [C]: in function '__index'
        data/creaturescripts/scripts/modaldeath.lua:94: in function 'buildModalWindow'
        data/creaturescripts/scripts/modaldeath.lua:55: in function <data/creaturescripts/scripts/modaldeath.lua:48>

and when i add 2, making it like this
Code:
for i = 1,2, #Game.getTowns() do
     modal:addChoice(i, Town(i):getName())
   end

the error disapear and im able to see the window, but theres only 1 city and i really dont know how to add more, i mean i have 6 cities but only 1 appear in the windows to chose .. im totally noob about.. tried to understand but its too complicated .. at least this one.. could anyone be little more clear about how to add or how to make it work properly?
 
Last edited:
HI, great system.. well .. im having the same problem as beastn had about the modal getting town.. im using tfs 1.2 and the changes made are here nothing more..

if player log out after battle time and log again the cuar will be alive ... also the player keep all items, nothing drops, shouldnt the player drop backpack and items? w/o the system it works normal, i mean the losing things...

Code:
local deathStorage = 49898
local deathGroupId = 66
local deathItemRevive = 2151

with your code i get the error

Code:
Lua Script Error: [Main Interface]
in a timer event called from:
(Unknown scriptfile)
data/creaturescripts/scripts/modaldeath.lua:94: attempt to index a nil value
stack traceback:
        [C]: in function '__index'
        data/creaturescripts/scripts/modaldeath.lua:94: in function 'buildModalWindow'
        data/creaturescripts/scripts/modaldeath.lua:55: in function <data/creaturescripts/scripts/modaldeath.lua:48>

and when i add 2, making it like this
Code:
for i = 1,2, #Game.getTowns() do
     modal:addChoice(i, Town(i):getName())
   end

the error disapear and im able to see the window, but theres only 1 city and i really dont know how to add more, i mean i have 6 cities but only 1 appear in the windows to chose .. im totally noob about.. tried to understand but its too complicated .. at least this one.. could anyone be little more clear about how to add or how to make it work properly?
http://www.lua.org/pil/4.3.4.html said:
The for statement has two variants: the numeric for and the generic for.

A numeric for has the following syntax:

for var=exp1,exp2,exp3 do
something
end

That loop will execute something for each value of var from exp1 to exp2, using exp3 as the step to increment var. This third expression is optional; when absent, Lua assumes one as the step value. As typical examples of such loops, we have
for i=1,f(x) do print(i) end

for i=10,1,-1 do print(i) end
 
make like thisput number of town Town(1)
modal:addChoice(1, Town(1):getName())
modal:addChoice(2, Town(2):getName())

Thanks once again for helping.. do you may know why backpack/bag isnt being dropped when i chose to be killed? if not its okay you already made my day twice with this one, some scripts are easy to understand but some others are quite hard :) starting to learn ^^

man you must understand that if i was asking is cuz that i really dont know.. i even 'told' that im a totally noob about.. and i saw the previews comments.. but nothing..
 
Last edited:
show me droploot.lua # dkangel83

Code:
function onDeath(player, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
    if getPlayerFlagValue(player, PlayerFlag_NotGenerateLoot) or player:getVocation():getId() == VOCATION_NONE then
        return true
    end

    local amulet = player:getSlotItem(CONST_SLOT_NECKLACE)
    if amulet and amulet.itemid == ITEM_AMULETOFLOSS and not isInArray({SKULL_RED, SKULL_BLACK}, player:getSkull()) then
        local isPlayer = false
        if killer:isPlayer() then
            isPlayer = true
        else
            local master = killer:getMaster()
            if master and master:isPlayer() then
                isPlayer = true
            end
        end

        if not isPlayer or not player:hasBlessing(5) then
            player:removeItem(ITEM_AMULETOFLOSS, 1, -1, false)
        end
    else
        for i = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
            local item = player:getSlotItem(i)
            if item then
                if isInArray({SKULL_RED, SKULL_BLACK}, player:getSkull()) or math.random(item:isContainer() and 100 or 1000) <= player:getLossPercent() then
                    if not item:moveTo(corpse) then
                        item:remove()
                    end
                end
            end
        end
    end

    if not player:getSlotItem(CONST_SLOT_BACKPACK) then
        player:addItem(ITEM_BAG, 1, false, CONST_SLOT_BACKPACK)
    end
    return true
end
 
Back
Top