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

TFS v1.2 Boss Door

Hahstudios

New Member
Joined
Mar 11, 2010
Messages
49
Solutions
3
Reaction score
1
hello im needing a script for once you kill a boss you have X amount of time to go through the door.
and it drops the storage value either way after X amount of time.
 
Solution
Final solution.

data/creaturescripts/bossdoor.lua
Lua:
local storage = 69
local cdStorage = 10 * 1000 --remove storage after 10 secs (10 * 1000 = 10 seconds)
local bosses = {
    [1] = "strutz",
    [2] = "hahstudios",
}
local function revertStorage(creature, storage)
   local player = Player(creature)
   if player then
         player:setStorageValue(storage, -1)
   end
end
  
function onKill(creature, target)
    for i = 1, #bosses do,
        if target:getName():lower() == bosses[i]:lower() then
            creature:setStorageValue(storage, 1)
            addEvent(revertStorage, cdTime, creature:getName(), storage)
            return true
        end
    end
end

data/creaturescripts/creaturescripts.xml
Code:
<event type="kill"...
amended solution
You should have done a check, if the player does not exist (logged out mean while? killed by a player or a monster?) it will probably run a lua error

Lua:
local function revertStorage(creature, storage)
   local player = Player(creature)
   if player then
   player:setStorageValue(storage, -1)
   end
end
 
You should have done a check, if the player does not exist (logged out mean while? killed by a player or a monster?) it will probably run a lua error

Lua:
local function revertStorage(creature, storage)
   local player = Player(creature)
   if player then
   player:setStorageValue(storage, -1)
   end
end
lol oops it was early leave me alone
 
Back
Top