• 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"...
Didn't test it but should work lol post any errors here.

Code:
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)
    creature:setStorageValue(storage, 0)
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, storage)
            return true
        end
    end
end
 
sealed against unwanted intruders
okay sawheet! so basically if you go to data/actions/scripts/doors.lua you will find this chunk of code:

Code:
    local itemId = item:getId()
    if isInArray(questDoors, itemId) then
        if player:getStorageValue(item.actionid) ~= -1 then
            item:transform(itemId + 1)
            player:teleportTo(toPosition, true)
        elseif item.actionid == 2362 then
            item:transform(itemId + 1)
            player:teleportTo(toPosition, true)
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
        end
        return true
end

What its saying is if the player has this action id let the player in. (this is very blunt lol)

SO! What you need to do is instead of setting a "Uid" on the door, You need to set an "Aid" and it must be the same as the storage you are giving to the player. So in my example we are using storage "69" so you would need to set "aid" 69 on the door.

Make sense?
 
still says its sealed against unwanted in truders
hmmm? So in the first onKill script i gave you. What did you set the storage too? what ever that storage is is what you need to set on the door.

Also make sure you reload creaturescripts and relog your char then rekill w/e boss you're killing
 
well for testing purposes i set it as a normal creature for the time being. and i reloaded the entire server just to be safe on it

<event type="kill" name="Mole" script="bossdoor.lua" />


local storage = 609
local cdStorage = 10 * 1000 --remove portal after 10 secs (10 * 1000 = 10 seconds)

local bosses = {
[1] = "mole",
}

local function revertStorage(creature, storage)
creature:setStorageValue(storage, 0)
end

function onKill(creature, target)
for i = 1, #bosses do
if target:getName():lower() == bosses:lower() then
creature:setStorageValue(storage, 1)
addEvent(revertStorage, cdTime, creature, storage) --remove storage after 10 secs (10 * 1000 = 10 seconds)
return true
end
end
end
 
Last edited by a moderator:
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" name="bossdoor" script="bossdoor" />

data/creaturescripts/scripts/login.lua
Code:
player:registerEvent(bossdoor)
 
Last edited:
Solution
Back
Top