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

Lua [TFS 0.3.6] - Dungeon TP & Reward Chest - How to do?

Vivelo

New Member
Joined
Aug 30, 2018
Messages
34
Reaction score
3
Hello everybody!

I need two scripts for a dungeon:

1) In the first one, it is about a teleport that will allow only one person to enter the dungeon (and as long as "he" do not finish it (dont receive the reward) the other player won't be able to enter.

2) Reward Chest - The player who completes the dungeon will receive the reward (he can take it only once, BUT if he re-enters and completes the same dungeon, he will be able to collect the reward again) - and so an infinite number of times.

I've found something like this before ( Feature - Reward Chest & Boss Reward [TFS 1.2] (https://otland.net/threads/reward-chest-boss-reward-tfs-1-2.233397/) ), but it's for a different version of the T.F.S and it doesn't work exactly as I want. At least I think so, because I'm not that good at programming with LUA.

Anyone can help me with this? Please :D
Thanks!
 
Solution
Dungeon System created by me, specifically because of this thread. xD
You are not allowed to offer money in this board, Please read rules before posting such replies.
9. Monetary Offerings:
- Any offerings of money are not allowed in this section. If you want help, ask it but you don't have to offer anything in return other than thanks.
To hire someone or request a paid job you should post here
 
You are not allowed to offer money in this board, Please read rules before posting such replies.

To hire someone or request a paid job you should post here
Ohh my mistake! Sorry for this
 
that for solo dung if you want dung for party i can edit for you but test it first
creaturescripts.xml this script for count dung monster
<event type="kill" name="dungsystem" event="script" value="dung.lua"/>

in login.lua add
registerCreatureEvent(cid, "dungsystem")

dung.lua
Lua:
local config = {
{["name"] = "Name", ["storage"] = 1, ["count"] = 150, }, -- monster name for dung number 1
{["name"] = "name", ["storage"] = 1, ["count"] = 10}, -- monster name for dung number 2

}
--===============================================================================================
local pos1 = {x=33277, y=31592, z=11} -- where player will tp after end time
--===============================================================================================
local pos2 = {x=33277, y=31592, z=11} -- where player will tp after end time
--===============================================================================================
local pos3 = {x=33277, y=31592, z=11} -- where player will tp after end time
--===============================================================================================

function onKill(cid, target, lastHit)
     if isPlayer(target) then
         return true
     end

for i = 1, #config do
if getCreatureName(target):lower() == config[i].name:lower() then
if getPlayerStorageValue(cid, 242389) == config[i].storage then
if isInRange(getPlayerPosition(cid), {x = 16515, y = 16419, z = 9}, {x = 16753, y = 16641, z = 9}) then -- dung cordintaes up left to down right
setPlayerStorageValue(cid, 242589, getPlayerStorageValue(cid, 242589) + 1)
if getPlayerStorageValue(cid, 242589) < config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed " .. config[i].name .. " [" .. getPlayerStorageValue(cid, 242589) .. " / " .. config[i].count.."]")
elseif getPlayerStorageValue(cid, 242589) == config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed last " .. config[i].name .. ", go open the chest.")
setPlayerStorageValue(cid,242589,0)--Counting Again
doTeleportThing(cid, pos1)
setPlayerStorageValue(cid, 242389, 0)
doCreatureSetStorage(cid,987272, 0)
end
-----------------------------------------------------------Dung number 2--------------------------------------------------------------------------------------
-----------------------------------------------------------Dung number 2--------------------------------------------------------------------------------------
elseif isInRange(getPlayerPosition(cid), {x = 16515, y = 16419, z = 8}, {x = 16753, y = 16641, z = 8}) then -- dung cordintaes up left to down right
setPlayerStorageValue(cid, 242589, getPlayerStorageValue(cid, 242589) + 1)
if getPlayerStorageValue(cid, 242589) < config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed " .. config[i].name .. " [" .. getPlayerStorageValue(cid, 242589) .. " / " .. config[i].count.."]")
elseif getPlayerStorageValue(cid, 242589) == config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed last " .. config[i].name .. ", go open the chest.")
setPlayerStorageValue(cid,242589,0)--Counting Again
doTeleportThing(cid, pos2)
setPlayerStorageValue(cid, 242389, 0)
doCreatureSetStorage(cid,987272, 0)
end
-----------------------------------------------------------Dung number 3--------------------------------------------------------------------------------------
-----------------------------------------------------------Dung number 3-------------------------------------------------------------------------------------
elseif isInRange(getPlayerPosition(cid), {x = 16515, y = 16419, z = 7}, {x = 16753, y = 16641, z = 7}) then -- dung cordintaes up left to down right
setPlayerStorageValue(cid, 242589, getPlayerStorageValue(cid, 242589) + 1)
if getPlayerStorageValue(cid, 242589) < config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed " .. config[i].name .. " [" .. getPlayerStorageValue(cid, 242589) .. " / " .. config[i].count.."]")
elseif getPlayerStorageValue(cid, 242589) == config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed last " .. config[i].name .. ", go open the chest.")
setPlayerStorageValue(cid,242589,0)--Counting Again
doTeleportThing(cid, pos3)
setPlayerStorageValue(cid, 242389, 0)
doCreatureSetStorage(cid,987272, 0)
end
-----------------------------------------------------------End----------------------------------------------------------------------------------------------------
-----------------------------------------------------------End---------------------------------------------------------------------------------------------------
end
end
end
return true
end




globalevent.xml this script for check dung time
<globalevent name="checkdung" interval="1000" event="script" value="checkdung.lua"/>
checkdung.lua
Code:
--===============================================================================================
local pos1 = {x=33277, y=31592, z=11} -- where player will tp after end time
--===============================================================================================
local pos2 = {x=33277, y=31592, z=11} -- where player will tp after end time
--===============================================================================================
local pos3 = {x=33277, y=31592, z=11} -- where player will tp after end time
--===============================================================================================
function onThink(pid, interval)
  local  fromPosition = {x = 1003, y = 942, z = 15}
local toPosition = {x = 1009, y = 946, z = 15}
local pos = {x = math.random(fromPosition.x, toPosition.x), y = math.random(fromPosition.y, toPosition.y), z = math.random(fromPosition.z, toPosition.z)}
for _, pid in ipairs(getPlayersOnline()) do
if isInRange(getPlayerPosition(pid), {x = 16544, y = 16419, z = 9}, {x = 16753, y = 16641, z = 9}) then
if getPlayerStorageValue(pid, 987272) < os.time() then
setPlayerStorageValue(pid,242589,0) --Counting Again
doTeleportThing(pid, pos1)
setPlayerStorageValue(pid, 242389, 0)
doCreatureSetStorage(pid,987272, 0)
doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, 'Your time expired.')
elseif getPlayerStorageValue(pid, 987272) == os.time()+60 then
doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, "you will get teleport to Dung loot room in one minute.")
elseif getPlayerStorageValue(pid, 987272) < os.time()+10 then
doSendAnimatedText(getCreaturePosition(pid), ""..getPlayerStorageValue(pid, 987272)-os.time().." Sec.", TEXTCOLOR_RED)
                    end
                      end
--===============================================================================================
if isInRange(getPlayerPosition(pid), {x = 16544, y = 16419, z = 8}, {x = 16753, y = 16641, z = 8}) then
if getPlayerStorageValue(pid, 987272) < os.time() then
setPlayerStorageValue(pid,242589,0)--Counting Again
doTeleportThing(pid, pos2)
setPlayerStorageValue(pid, 242389, 0)
doCreatureSetStorage(pid,987272, 0)
doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, 'Your time expired.')  
elseif getPlayerStorageValue(pid, 987272) == os.time()+60 then
doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, "you will get teleport to Dung loot room in one minute.")
elseif getPlayerStorageValue(pid, 987272) < os.time()+10 then
doSendAnimatedText(getCreaturePosition(pid), ""..getPlayerStorageValue(pid, 987272)-os.time().." Sec.", TEXTCOLOR_RED)
                    end
                      end
--===============================================================================================
if isInRange(getPlayerPosition(pid), {x = 16544, y = 16419, z = 7}, {x = 16753, y = 16641, z = 7}) then
if getPlayerStorageValue(pid, 987272) < os.time() then
setPlayerStorageValue(pid,242589,0)--Counting Again
doTeleportThing(pid, pos3)
setPlayerStorageValue(pid, 242389, 0)
doCreatureSetStorage(pid,987272, 0)
doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, 'Your time expired.')  
elseif getPlayerStorageValue(pid, 987272) == os.time()+60 then
doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, "you will get teleport to Dung loot room in one minute.")
elseif getPlayerStorageValue(pid, 987272) < os.time()+10 then
doSendAnimatedText(getCreaturePosition(pid), ""..getPlayerStorageValue(pid, 987272)-os.time().." Sec.", TEXTCOLOR_RED)
                    end
                      end
--===============================================================================================
return true

end



movement.xml this script for check if there anyone in dung or no and set storage to start missions
<movevent type="StepIn" actionid="xxxx" event="script" value="dung.lua"/>

dung.lua
Code:
local function getPlayersInRange(position, radiusx, radiusy)
    local creaturesList = {}
    for x = -radiusx, radiusx do
        for y = -radiusy, radiusy do
            if not (x == 0 and y == 0) then
                local creature = getTopCreature({x = position.x+x, y = position.y+y, z = position.z})
                if creature.type == 1 then
                    table.insert(creaturesList, creature.uid)
                end
            end
        end
    end

    local creature = getTopCreature(position)
    if creature.type == 1 then
        if not(table.find(creaturesList, creature.uid)) then
            table.insert(creaturesList, creature.uid)
        end
    end
    return creaturesList
end

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local dung1 = getPlayersInRange({x=16640, y=16530, z=9}, 10, 10) -- pos to check if there other player in dung or no
local dung1tp = {x=16637, y=16467, z=9} -- where player will tp if dung empty

local dung2 = getPlayersInRange({x=16640, y=16530, z=8}, 10, 10) -- pos to check if there other player in dung or no
local dung2tp = {x=16637, y=16467, z=8} -- where player will tp if dung empty

local dung3 = getPlayersInRange({x=16640, y=16530, z=7}, 10, 10) -- pos to check if there other player in dung or no
local dung3tp = {x=16637, y=16467, z=7} -- where player will tp if dung empty


if #dung1 < 1 then
doTeleportThing(cid, dung1tp)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "set the msg here")
doCreatureSetStorage(cid,987272, os.time()+900) -- time for dung
setPlayerStorageValue(cid,242389,1) --for start count when killing dung monster
elseif #dung2 < 1 then
doTeleportThing(cid, dung2tp)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "set the msg here")
doCreatureSetStorage(cid,987272, os.time()+900) -- time for dung
setPlayerStorageValue(cid,242389,1) --for start count when killing dung monster
elseif #dung3 < 1 then
doTeleportThing(cid, dung3tp)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "set the msg here")
doCreatureSetStorage(cid,987272, os.time()+900) -- time for dung
setPlayerStorageValue(cid,242389,1) --for start count when killing dung monster
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "all dungs are token.")
     doTeleportThing(cid, fromPosition, true)
    end
    return true
end
 
Last edited:
Im try many options but script doesn't work. I can enter to the tp and start "dungeon" but nothing more. If i kill monster i dont have any message.

in the Server Log (Tibia) i got the information about killing two creatures, not one... (I kill one)
20:40 Loot of a rat: 3 worms, 4 gold coins.
20:40 Loot of a rat: cheese

If i using command "print" in code i see this:

dung.lua ---> in movements
Lua:
local function getPlayersInRange(position, radiusx, radiusy)
    local creaturesList = {}
    for x = -radiusx, radiusx do
        for y = -radiusy, radiusy do
            if not (x == 0 and y == 0) then
                local creature = getTopCreature({x = position.x+x, y = position.y+y, z = position.z})
                if creature.type == 1 then
                    table.insert(creaturesList, creature.uid)
                end
            end
        end
    end

    local creature = getTopCreature(position)
    if creature.type == 1 then
        if not(table.find(creaturesList, creature.uid)) then
            table.insert(creaturesList, creature.uid)
        end
    end
    return creaturesList
end

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local dung1 = getPlayersInRange({x=1276, y=1053, z=7}, 10, 10) -- pos to check if there other player in dung or no
local dung1tp = {x=1112, y=1041, z=7} -- where player will tp if dung empty

local dung2 = getPlayersInRange({x=16640, y=16530, z=8}, 10, 10) -- pos to check if there other player in dung or no
local dung2tp = {x=16637, y=16467, z=8} -- where player will tp if dung empty

local dung3 = getPlayersInRange({x=16640, y=16530, z=7}, 10, 10) -- pos to check if there other player in dung or no
local dung3tp = {x=16637, y=16467, z=7} -- where player will tp if dung empty


if #dung1 < 1 then
doTeleportThing(cid, dung1tp)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got a 10 min to kill all monters - Good Luck!")
print ("You got...")
doCreatureSetStorage(cid,987272, os.time()+900) -- time for dung
print ("Time dung...")
setPlayerStorageValue(cid,242389,1) --for start count when killing dung monster
print ("Storage...")
elseif #dung2 < 1 then
doTeleportThing(cid, dung2tp)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "set the msg here")
doCreatureSetStorage(cid,987272, os.time()+900) -- time for dung
setPlayerStorageValue(cid,242389,1) --for start count when killing dung monster
elseif #dung3 < 1 then
doTeleportThing(cid, dung3tp)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "set the msg here")
doCreatureSetStorage(cid,987272, os.time()+900) -- time for dung
setPlayerStorageValue(cid,242389,1) --for start count when killing dung monster
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "all dungs are token.")
     doTeleportThing(cid, fromPosition, true)
    end
    return true
end

1596998874986.png

All is good i think in this script, but at rest i have nothing...


dung.lua ---> creaturescripts
Lua:
local config = {
{["name"] = "rat", ["storage"] = 1, ["count"] = 150, }, -- monster name for dung number 1
{["name"] = "bat", ["storage"] = 1, ["count"] = 10}, -- monster name for dung number 2

}
--===============================================================================================
local pos1 = {x=1276, y=1053, z=7} -- where player will tp after end time
--===============================================================================================
local pos2 = {x=1275, y=1053, z=7} -- where player will tp after end time
--===============================================================================================
local pos3 = {x=1274, y=1053, z=7} -- where player will tp after end time
--===============================================================================================

function onKill(cid, target, lastHit)
     if isPlayer(target) then
     print("onKill...")
         return true
     end

for i = 1, #config do
if getCreatureName(target):lower() == config[i].name:lower() then
print("first if...")
if getPlayerStorageValue(cid, 242389) == config[i].storage then
print("second if...")
if isInRange(getPlayerPosition(cid), {x = 1099, y = 1008, z = 7}, {x = 1169, y = 1091, z = 7}) then -- dung cordintaes up left to down right
setPlayerStorageValue(cid, 242589, getPlayerStorageValue(cid, 242589) + 1)
if getPlayerStorageValue(cid, 242589) < config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed " .. config[i].name .. " [" .. getPlayerStorageValue(cid, 242589) .. " / " .. config[i].count.."]")
elseif getPlayerStorageValue(cid, 242589) == config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed last " .. config[i].name .. ", go open the chest.")
setPlayerStorageValue(cid,242589,0)--Counting Again
doTeleportThing(cid, pos1)
setPlayerStorageValue(cid, 242389, 0)
doCreatureSetStorage(cid,987272, 0)
end
-----------------------------------------------------------Dung number 2--------------------------------------------------------------------------------------
-----------------------------------------------------------Dung number 2--------------------------------------------------------------------------------------
elseif isInRange(getPlayerPosition(cid), {x = 16515, y = 16419, z = 8}, {x = 16753, y = 16641, z = 8}) then -- dung cordintaes up left to down right
setPlayerStorageValue(cid, 242589, getPlayerStorageValue(cid, 242589) + 1)
if getPlayerStorageValue(cid, 242589) < config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed " .. config[i].name .. " [" .. getPlayerStorageValue(cid, 242589) .. " / " .. config[i].count.."]")
elseif getPlayerStorageValue(cid, 242589) == config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed last " .. config[i].name .. ", go open the chest.")
setPlayerStorageValue(cid,242589,0)--Counting Again
doTeleportThing(cid, pos2)
setPlayerStorageValue(cid, 242389, 0)
doCreatureSetStorage(cid,987272, 0)
end
-----------------------------------------------------------Dung number 3--------------------------------------------------------------------------------------
-----------------------------------------------------------Dung number 3-------------------------------------------------------------------------------------
elseif isInRange(getPlayerPosition(cid), {x = 16515, y = 16419, z = 7}, {x = 16753, y = 16641, z = 7}) then -- dung cordintaes up left to down right
setPlayerStorageValue(cid, 242589, getPlayerStorageValue(cid, 242589) + 1)
if getPlayerStorageValue(cid, 242589) < config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed " .. config[i].name .. " [" .. getPlayerStorageValue(cid, 242589) .. " / " .. config[i].count.."]")
elseif getPlayerStorageValue(cid, 242589) == config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed last " .. config[i].name .. ", go open the chest.")
setPlayerStorageValue(cid,242589,0)--Counting Again
doTeleportThing(cid, pos3)
setPlayerStorageValue(cid, 242389, 0)
doCreatureSetStorage(cid,987272, 0)
end
-----------------------------------------------------------End----------------------------------------------------------------------------------------------------
-----------------------------------------------------------End---------------------------------------------------------------------------------------------------
end
end
end
return true
end

The same is here:

checkdung.lua ---> globalevents

Lua:
--===============================================================================================
local pos1 = {x= 1276, y= 1053, z= 7} -- where player will tp after end time
--===============================================================================================
local pos2 = {x=1276, y=1053, z=7} -- where player will tp after end time
--===============================================================================================
local pos3 = {x=1276, y=1053, z=7} -- where player will tp after end time
--===============================================================================================
function onThink(pid, interval)
  local  fromPosition = {x= 1276, y= 1053, z= 7}
local toPosition = {x = 1169, y = 1091, z = 7}
local pos = {x = math.random(fromPosition.x, toPosition.x), y = math.random(fromPosition.y, toPosition.y), z = math.random(fromPosition.z, toPosition.z)}
for _, pid in ipairs(getPlayersOnline()) do
if isInRange(getPlayerPosition(pid), {x = 1099, y = 1008, z = 7}, {x = 1169, y = 1091, z = }) then
print ("first if check...")
if getPlayerStorageValue(pid, 987272) < os.time() then
print ("second if check...")
setPlayerStorageValue(pid,242589,0) --Counting Again
doTeleportThing(pid, pos1)
setPlayerStorageValue(pid, 242389, 0)
doCreatureSetStorage(pid,987272, 0)
doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, 'Your time expired.')
elseif getPlayerStorageValue(pid, 987272) == os.time()+60 then
doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, "you will get teleport to Dung loot room in one minute.")
elseif getPlayerStorageValue(pid, 987272) < os.time()+10 then
doSendAnimatedText(getCreaturePosition(pid), ""..getPlayerStorageValue(pid, 987272)-os.time().." Sec.", TEXTCOLOR_RED)
                    end
                      end
--===============================================================================================
if isInRange(getPlayerPosition(pid), {x = 16544, y = 16419, z = 8}, {x = 16753, y = 16641, z = 8}) then
if getPlayerStorageValue(pid, 987272) < os.time() then
setPlayerStorageValue(pid,242589,0)--Counting Again
doTeleportThing(pid, pos2)
setPlayerStorageValue(pid, 242389, 0)
doCreatureSetStorage(pid,987272, 0)
doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, 'Your time expired.') 
elseif getPlayerStorageValue(pid, 987272) == os.time()+60 then
doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, "you will get teleport to Dung loot room in one minute.")
elseif getPlayerStorageValue(pid, 987272) < os.time()+10 then
doSendAnimatedText(getCreaturePosition(pid), ""..getPlayerStorageValue(pid, 987272)-os.time().." Sec.", TEXTCOLOR_RED)
                    end
                      end
--===============================================================================================
if isInRange(getPlayerPosition(pid), {x = 16544, y = 16419, z = 7}, {x = 16753, y = 16641, z = 7}) then
if getPlayerStorageValue(pid, 987272) < os.time() then
setPlayerStorageValue(pid,242589,0)--Counting Again
doTeleportThing(pid, pos3)
setPlayerStorageValue(pid, 242389, 0)
doCreatureSetStorage(pid,987272, 0)
doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, 'Your time expired.') 
elseif getPlayerStorageValue(pid, 987272) == os.time()+60 then
doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, "you will get teleport to Dung loot room in one minute.")
elseif getPlayerStorageValue(pid, 987272) < os.time()+10 then
doSendAnimatedText(getCreaturePosition(pid), ""..getPlayerStorageValue(pid, 987272)-os.time().." Sec.", TEXTCOLOR_RED)
                    end
                      end
--===============================================================================================
return true

end
 
Im try many options but script doesn't work. I can enter to the tp and start "dungeon" but nothing more. If i kill monster i dont have any message.

in the Server Log (Tibia) i got the information about killing two creatures, not one... (I kill one)
20:40 Loot of a rat: 3 worms, 4 gold coins.
20:40 Loot of a rat: cheese

If i using command "print" in code i see this:

dung.lua ---> in movements
Lua:
local function getPlayersInRange(position, radiusx, radiusy)
    local creaturesList = {}
    for x = -radiusx, radiusx do
        for y = -radiusy, radiusy do
            if not (x == 0 and y == 0) then
                local creature = getTopCreature({x = position.x+x, y = position.y+y, z = position.z})
                if creature.type == 1 then
                    table.insert(creaturesList, creature.uid)
                end
            end
        end
    end

    local creature = getTopCreature(position)
    if creature.type == 1 then
        if not(table.find(creaturesList, creature.uid)) then
            table.insert(creaturesList, creature.uid)
        end
    end
    return creaturesList
end

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local dung1 = getPlayersInRange({x=1276, y=1053, z=7}, 10, 10) -- pos to check if there other player in dung or no
local dung1tp = {x=1112, y=1041, z=7} -- where player will tp if dung empty

local dung2 = getPlayersInRange({x=16640, y=16530, z=8}, 10, 10) -- pos to check if there other player in dung or no
local dung2tp = {x=16637, y=16467, z=8} -- where player will tp if dung empty

local dung3 = getPlayersInRange({x=16640, y=16530, z=7}, 10, 10) -- pos to check if there other player in dung or no
local dung3tp = {x=16637, y=16467, z=7} -- where player will tp if dung empty


if #dung1 < 1 then
doTeleportThing(cid, dung1tp)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got a 10 min to kill all monters - Good Luck!")
print ("You got...")
doCreatureSetStorage(cid,987272, os.time()+900) -- time for dung
print ("Time dung...")
setPlayerStorageValue(cid,242389,1) --for start count when killing dung monster
print ("Storage...")
elseif #dung2 < 1 then
doTeleportThing(cid, dung2tp)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "set the msg here")
doCreatureSetStorage(cid,987272, os.time()+900) -- time for dung
setPlayerStorageValue(cid,242389,1) --for start count when killing dung monster
elseif #dung3 < 1 then
doTeleportThing(cid, dung3tp)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "set the msg here")
doCreatureSetStorage(cid,987272, os.time()+900) -- time for dung
setPlayerStorageValue(cid,242389,1) --for start count when killing dung monster
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "all dungs are token.")
     doTeleportThing(cid, fromPosition, true)
    end
    return true
end

View attachment 48293

All is good i think in this script, but at rest i have nothing...


dung.lua ---> creaturescripts
Lua:
local config = {
{["name"] = "rat", ["storage"] = 1, ["count"] = 150, }, -- monster name for dung number 1
{["name"] = "bat", ["storage"] = 1, ["count"] = 10}, -- monster name for dung number 2

}
--===============================================================================================
local pos1 = {x=1276, y=1053, z=7} -- where player will tp after end time
--===============================================================================================
local pos2 = {x=1275, y=1053, z=7} -- where player will tp after end time
--===============================================================================================
local pos3 = {x=1274, y=1053, z=7} -- where player will tp after end time
--===============================================================================================

function onKill(cid, target, lastHit)
     if isPlayer(target) then
     print("onKill...")
         return true
     end

for i = 1, #config do
if getCreatureName(target):lower() == config[i].name:lower() then
print("first if...")
if getPlayerStorageValue(cid, 242389) == config[i].storage then
print("second if...")
if isInRange(getPlayerPosition(cid), {x = 1099, y = 1008, z = 7}, {x = 1169, y = 1091, z = 7}) then -- dung cordintaes up left to down right
setPlayerStorageValue(cid, 242589, getPlayerStorageValue(cid, 242589) + 1)
if getPlayerStorageValue(cid, 242589) < config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed " .. config[i].name .. " [" .. getPlayerStorageValue(cid, 242589) .. " / " .. config[i].count.."]")
elseif getPlayerStorageValue(cid, 242589) == config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed last " .. config[i].name .. ", go open the chest.")
setPlayerStorageValue(cid,242589,0)--Counting Again
doTeleportThing(cid, pos1)
setPlayerStorageValue(cid, 242389, 0)
doCreatureSetStorage(cid,987272, 0)
end
-----------------------------------------------------------Dung number 2--------------------------------------------------------------------------------------
-----------------------------------------------------------Dung number 2--------------------------------------------------------------------------------------
elseif isInRange(getPlayerPosition(cid), {x = 16515, y = 16419, z = 8}, {x = 16753, y = 16641, z = 8}) then -- dung cordintaes up left to down right
setPlayerStorageValue(cid, 242589, getPlayerStorageValue(cid, 242589) + 1)
if getPlayerStorageValue(cid, 242589) < config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed " .. config[i].name .. " [" .. getPlayerStorageValue(cid, 242589) .. " / " .. config[i].count.."]")
elseif getPlayerStorageValue(cid, 242589) == config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed last " .. config[i].name .. ", go open the chest.")
setPlayerStorageValue(cid,242589,0)--Counting Again
doTeleportThing(cid, pos2)
setPlayerStorageValue(cid, 242389, 0)
doCreatureSetStorage(cid,987272, 0)
end
-----------------------------------------------------------Dung number 3--------------------------------------------------------------------------------------
-----------------------------------------------------------Dung number 3-------------------------------------------------------------------------------------
elseif isInRange(getPlayerPosition(cid), {x = 16515, y = 16419, z = 7}, {x = 16753, y = 16641, z = 7}) then -- dung cordintaes up left to down right
setPlayerStorageValue(cid, 242589, getPlayerStorageValue(cid, 242589) + 1)
if getPlayerStorageValue(cid, 242589) < config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed " .. config[i].name .. " [" .. getPlayerStorageValue(cid, 242589) .. " / " .. config[i].count.."]")
elseif getPlayerStorageValue(cid, 242589) == config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed last " .. config[i].name .. ", go open the chest.")
setPlayerStorageValue(cid,242589,0)--Counting Again
doTeleportThing(cid, pos3)
setPlayerStorageValue(cid, 242389, 0)
doCreatureSetStorage(cid,987272, 0)
end
-----------------------------------------------------------End----------------------------------------------------------------------------------------------------
-----------------------------------------------------------End---------------------------------------------------------------------------------------------------
end
end
end
return true
end

The same is here:

checkdung.lua ---> globalevents

Lua:
--===============================================================================================
local pos1 = {x= 1276, y= 1053, z= 7} -- where player will tp after end time
--===============================================================================================
local pos2 = {x=1276, y=1053, z=7} -- where player will tp after end time
--===============================================================================================
local pos3 = {x=1276, y=1053, z=7} -- where player will tp after end time
--===============================================================================================
function onThink(pid, interval)
  local  fromPosition = {x= 1276, y= 1053, z= 7}
local toPosition = {x = 1169, y = 1091, z = 7}
local pos = {x = math.random(fromPosition.x, toPosition.x), y = math.random(fromPosition.y, toPosition.y), z = math.random(fromPosition.z, toPosition.z)}
for _, pid in ipairs(getPlayersOnline()) do
if isInRange(getPlayerPosition(pid), {x = 1099, y = 1008, z = 7}, {x = 1169, y = 1091, z = }) then
print ("first if check...")
if getPlayerStorageValue(pid, 987272) < os.time() then
print ("second if check...")
setPlayerStorageValue(pid,242589,0) --Counting Again
doTeleportThing(pid, pos1)
setPlayerStorageValue(pid, 242389, 0)
doCreatureSetStorage(pid,987272, 0)
doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, 'Your time expired.')
elseif getPlayerStorageValue(pid, 987272) == os.time()+60 then
doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, "you will get teleport to Dung loot room in one minute.")
elseif getPlayerStorageValue(pid, 987272) < os.time()+10 then
doSendAnimatedText(getCreaturePosition(pid), ""..getPlayerStorageValue(pid, 987272)-os.time().." Sec.", TEXTCOLOR_RED)
                    end
                      end
--===============================================================================================
if isInRange(getPlayerPosition(pid), {x = 16544, y = 16419, z = 8}, {x = 16753, y = 16641, z = 8}) then
if getPlayerStorageValue(pid, 987272) < os.time() then
setPlayerStorageValue(pid,242589,0)--Counting Again
doTeleportThing(pid, pos2)
setPlayerStorageValue(pid, 242389, 0)
doCreatureSetStorage(pid,987272, 0)
doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, 'Your time expired.')
elseif getPlayerStorageValue(pid, 987272) == os.time()+60 then
doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, "you will get teleport to Dung loot room in one minute.")
elseif getPlayerStorageValue(pid, 987272) < os.time()+10 then
doSendAnimatedText(getCreaturePosition(pid), ""..getPlayerStorageValue(pid, 987272)-os.time().." Sec.", TEXTCOLOR_RED)
                    end
                      end
--===============================================================================================
if isInRange(getPlayerPosition(pid), {x = 16544, y = 16419, z = 7}, {x = 16753, y = 16641, z = 7}) then
if getPlayerStorageValue(pid, 987272) < os.time() then
setPlayerStorageValue(pid,242589,0)--Counting Again
doTeleportThing(pid, pos3)
setPlayerStorageValue(pid, 242389, 0)
doCreatureSetStorage(pid,987272, 0)
doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, 'Your time expired.')
elseif getPlayerStorageValue(pid, 987272) == os.time()+60 then
doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, "you will get teleport to Dung loot room in one minute.")
elseif getPlayerStorageValue(pid, 987272) < os.time()+10 then
doSendAnimatedText(getCreaturePosition(pid), ""..getPlayerStorageValue(pid, 987272)-os.time().." Sec.", TEXTCOLOR_RED)
                    end
                      end
--===============================================================================================
return true

end
creaturescript for count monster kill and change name to Rat you have to register in login
and globalevent will work after 15 min player enter dung and i change interval="1000" to interval="1"
 
Last edited:
creaturescript for count monster kill and change name to Rat you have to register in login
and globalevent will work after 15 min player enter dung and i change interval="1000" to interval="1"
I set in Creaturescript a new count and changing name to "Rat" and still nothing happen. Ofc earlier i register it at login and globalevent. I change Interval too and still nothing :/

dung.lua ---> Creature~

Lua:
local config = {
{["name"] = "Rat", ["storage"] = 1, ["count"] = 4, }, -- monster name for dung number 1
{["name"] = "bat", ["storage"] = 1, ["count"] = 10}, -- monster name for dung number 2

}
--===============================================================================================
local pos1 = {x = 1276, y = 1053, z = 7} -- where player will tp after end time
--===============================================================================================
local pos2 = {x = 1276, y = 1053, z = 7} -- where player will tp after end time
--===============================================================================================
local pos3 = {x = 1274, y = 1053, z = 7} -- where player will tp after end time
--===============================================================================================

function onKill(cid, target, lastHit)
     if isPlayer(target) then
     print("onKill...")
         return true
     end

for i = 1, #config do
if getCreatureName(target):lower() == config[i].name:lower() then
print("first if...")
if getPlayerStorageValue(cid, 242389) == config[i].storage then
print("second if...")
if isInRange(getPlayerPosition(cid), {x = 1099, y = 1008, z = 7}, {x = 1169, y = 1091, z = 7}) then -- dung cordintaes up left to down right
setPlayerStorageValue(cid, 242589, getPlayerStorageValue(cid, 242589) + 1)
if getPlayerStorageValue(cid, 242589) < config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed " .. config[i].name .. " [" .. getPlayerStorageValue(cid, 242589) .. " / " .. config[i].count.."]")
elseif getPlayerStorageValue(cid, 242589) == config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed last " .. config[i].name .. ", go open the chest.")
setPlayerStorageValue(cid,242589,0)--Counting Again
doTeleportThing(cid, pos1)
setPlayerStorageValue(cid, 242389, 0)
doCreatureSetStorage(cid,987272, 0)
end
-----------------------------------------------------------Dung number 2--------------------------------------------------------------------------------------
-----------------------------------------------------------Dung number 2--------------------------------------------------------------------------------------
elseif isInRange(getPlayerPosition(cid), {x = 16515, y = 16419, z = 8}, {x = 16753, y = 16641, z = 8}) then -- dung cordintaes up left to down right
setPlayerStorageValue(cid, 242589, getPlayerStorageValue(cid, 242589) + 1)
if getPlayerStorageValue(cid, 242589) < config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed " .. config[i].name .. " [" .. getPlayerStorageValue(cid, 242589) .. " / " .. config[i].count.."]")
elseif getPlayerStorageValue(cid, 242589) == config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed last " .. config[i].name .. ", go open the chest.")
setPlayerStorageValue(cid,242589,0)--Counting Again
doTeleportThing(cid, pos2)
setPlayerStorageValue(cid, 242389, 0)
doCreatureSetStorage(cid,987272, 0)
end
-----------------------------------------------------------Dung number 3--------------------------------------------------------------------------------------
-----------------------------------------------------------Dung number 3-------------------------------------------------------------------------------------
elseif isInRange(getPlayerPosition(cid), {x = 16515, y = 16419, z = 7}, {x = 16753, y = 16641, z = 7}) then -- dung cordintaes up left to down right
setPlayerStorageValue(cid, 242589, getPlayerStorageValue(cid, 242589) + 1)
if getPlayerStorageValue(cid, 242589) < config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed " .. config[i].name .. " [" .. getPlayerStorageValue(cid, 242589) .. " / " .. config[i].count.."]")
elseif getPlayerStorageValue(cid, 242589) == config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed last " .. config[i].name .. ", go open the chest.")
setPlayerStorageValue(cid,242589,0)--Counting Again
doTeleportThing(cid, pos3)
setPlayerStorageValue(cid, 242389, 0)
doCreatureSetStorage(cid,987272, 0)
end
-----------------------------------------------------------End----------------------------------------------------------------------------------------------------
-----------------------------------------------------------End---------------------------------------------------------------------------------------------------
end
end
end
return true
end

creature~.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
    <event type="login" name="PlayerLogin" event="script" value="login.lua"/>

    <event type="joinchannel" name="GuildMotd" event="script" value="guildmotd.lua"/>
    <event type="receivemail" name="Mail" event="script" value="mail.lua"/>
    <event type="reportbug" name="SaveReportBug" script="reportbug.lua"/>
    <event type="advance" name="AdvanceSave" event="script" value="advancesave.lua"/>
    <event type="kill" name="onKillGlobalTeleportCreation" event="script" value="onKillGlobalTeleportCreation.lua"/>
    <event type="think" name="Idle" event="script" value="idle.lua"/>
    <event type="think" name="SkullCheck" event="script" value="skullcheck.lua"/>
    <event type="kill" name="dungsystem" event="script" value="dung.lua"/>
</creaturescripts>

globalev~.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<globalevents>
    <globalevent name="save" interval="900" event="script" value="save.lua"/>
    <globalevent name="clean" interval="7200" event="script" value="clean.lua"/>

    <globalevent name="serverstart" type="start" event="script" value="start.lua"/>
    <globalevent name="playersrecord" type="record" event="script" value="record.lua"/>

    <!-- <globalevent name="timer_example" time="21:35" event="script" value="my_script.lua"/> -->
    <globalevent name="website_shop_item_delivery" interval="30000" event="script" value="shop.lua"/>
    <globalevent name="checkdung" interval="1" event="script" value="checkdung.lua"/>
</globalevents>
 
try this one
Lua:
local config = {
{["name"] = "Rat", ["storage"] = 1, ["count"] = 4, }, -- monster name for dung number 1
{["name"] = "bat", ["storage"] = 1, ["count"] = 10}, -- monster name for dung number 2

}
--===============================================================================================
local pos1 = {x = 1276, y = 1053, z = 7} -- where player will tp after end time
--===============================================================================================
local pos2 = {x = 1276, y = 1053, z = 7} -- where player will tp after end time
--===============================================================================================
local pos3 = {x = 1274, y = 1053, z = 7} -- where player will tp after end time
--===============================================================================================

function onKill(cid, target, lastHit)
     if isPlayer(target) then
     print("onKill...")
         return true
     end

for i = 1, #config do
if getCreatureName(target):lower() == config[i].name:lower() then
print("first if...")
if getPlayerStorageValue(cid, 242389) == config[i].storage then
print("second if...")
if isInRange(getPlayerPosition(cid), {x = 1099, y = 1008, z = 7}, {x = 1169, y = 1091, z = 7}) then -- dung cordintaes up left to down right
setPlayerStorageValue(cid, 242589, getPlayerStorageValue(cid, 242589) + 1)
if getPlayerStorageValue(cid, 242589) < config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed " .. config[i].name .. " [" .. getPlayerStorageValue(cid, 242589) .. " / " .. config[i].count.."]")
elseif getPlayerStorageValue(cid, 242589) == config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed last " .. config[i].name .. ", go open the chest.")
setPlayerStorageValue(cid,242589,0)--Counting Again
doTeleportThing(cid, pos1)
setPlayerStorageValue(cid, 242389, 0)
doCreatureSetStorage(cid,987272, 0)
               end
             end
end   end
-----------------------------------------------------------Dung number 2--------------------------------------------------------------------------------------
-----------------------------------------------------------Dung number 2--------------------------------------------------------------------------------------
if getCreatureName(target):lower() == config[i].name:lower() then
if getPlayerStorageValue(member, 242389) == config[i].storage then
if isInRange(getPlayerPosition(cid), {x = 16515, y = 16419, z = 8}, {x = 16753, y = 16641, z = 8}) then -- dung cordintaes up left to down right
setPlayerStorageValue(cid, 242589, getPlayerStorageValue(cid, 242589) + 1)
if getPlayerStorageValue(cid, 242589) < config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed " .. config[i].name .. " [" .. getPlayerStorageValue(cid, 242589) .. " / " .. config[i].count.."]")
elseif getPlayerStorageValue(cid, 242589) == config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed last " .. config[i].name .. ", go open the chest.")
setPlayerStorageValue(cid,242589,0)--Counting Again
doTeleportThing(cid, pos2)
setPlayerStorageValue(cid, 242389, 0)
doCreatureSetStorage(cid,987272, 0)
               end
             end
end   end
-----------------------------------------------------------Dung number 3--------------------------------------------------------------------------------------
-----------------------------------------------------------Dung number 3-------------------------------------------------------------------------------------
if getCreatureName(target):lower() == config[i].name:lower() then
if getPlayerStorageValue(member, 242389) == config[i].storage then
if isInRange(getPlayerPosition(cid), {x = 16515, y = 16419, z = 7}, {x = 16753, y = 16641, z = 7}) then -- dung cordintaes up left to down right
setPlayerStorageValue(cid, 242589, getPlayerStorageValue(cid, 242589) + 1)
if getPlayerStorageValue(cid, 242589) < config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed " .. config[i].name .. " [" .. getPlayerStorageValue(cid, 242589) .. " / " .. config[i].count.."]")
elseif getPlayerStorageValue(cid, 242589) == config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed last " .. config[i].name .. ", go open the chest.")
setPlayerStorageValue(cid,242589,0)--Counting Again
doTeleportThing(cid, pos3)
setPlayerStorageValue(cid, 242389, 0)
doCreatureSetStorage(cid,987272, 0)
               end
             end
end   end
-----------------------------------------------------------End----------------------------------------------------------------------------------------------------
-----------------------------------------------------------End---------------------------------------------------------------------------------------------------
end
end
return true
end
 
try this one
Lua:
local config = {
{["name"] = "Rat", ["storage"] = 1, ["count"] = 4, }, -- monster name for dung number 1
{["name"] = "bat", ["storage"] = 1, ["count"] = 10}, -- monster name for dung number 2

}
--===============================================================================================
local pos1 = {x = 1276, y = 1053, z = 7} -- where player will tp after end time
--===============================================================================================
local pos2 = {x = 1276, y = 1053, z = 7} -- where player will tp after end time
--===============================================================================================
local pos3 = {x = 1274, y = 1053, z = 7} -- where player will tp after end time
--===============================================================================================

function onKill(cid, target, lastHit)
     if isPlayer(target) then
     print("onKill...")
         return true
     end

for i = 1, #config do
if getCreatureName(target):lower() == config[i].name:lower() then
print("first if...")
if getPlayerStorageValue(cid, 242389) == config[i].storage then
print("second if...")
if isInRange(getPlayerPosition(cid), {x = 1099, y = 1008, z = 7}, {x = 1169, y = 1091, z = 7}) then -- dung cordintaes up left to down right
setPlayerStorageValue(cid, 242589, getPlayerStorageValue(cid, 242589) + 1)
if getPlayerStorageValue(cid, 242589) < config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed " .. config[i].name .. " [" .. getPlayerStorageValue(cid, 242589) .. " / " .. config[i].count.."]")
elseif getPlayerStorageValue(cid, 242589) == config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed last " .. config[i].name .. ", go open the chest.")
setPlayerStorageValue(cid,242589,0)--Counting Again
doTeleportThing(cid, pos1)
setPlayerStorageValue(cid, 242389, 0)
doCreatureSetStorage(cid,987272, 0)
               end
             end
end   end
-----------------------------------------------------------Dung number 2--------------------------------------------------------------------------------------
-----------------------------------------------------------Dung number 2--------------------------------------------------------------------------------------
if getCreatureName(target):lower() == config[i].name:lower() then
if getPlayerStorageValue(member, 242389) == config[i].storage then
if isInRange(getPlayerPosition(cid), {x = 16515, y = 16419, z = 8}, {x = 16753, y = 16641, z = 8}) then -- dung cordintaes up left to down right
setPlayerStorageValue(cid, 242589, getPlayerStorageValue(cid, 242589) + 1)
if getPlayerStorageValue(cid, 242589) < config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed " .. config[i].name .. " [" .. getPlayerStorageValue(cid, 242589) .. " / " .. config[i].count.."]")
elseif getPlayerStorageValue(cid, 242589) == config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed last " .. config[i].name .. ", go open the chest.")
setPlayerStorageValue(cid,242589,0)--Counting Again
doTeleportThing(cid, pos2)
setPlayerStorageValue(cid, 242389, 0)
doCreatureSetStorage(cid,987272, 0)
               end
             end
end   end
-----------------------------------------------------------Dung number 3--------------------------------------------------------------------------------------
-----------------------------------------------------------Dung number 3-------------------------------------------------------------------------------------
if getCreatureName(target):lower() == config[i].name:lower() then
if getPlayerStorageValue(member, 242389) == config[i].storage then
if isInRange(getPlayerPosition(cid), {x = 16515, y = 16419, z = 7}, {x = 16753, y = 16641, z = 7}) then -- dung cordintaes up left to down right
setPlayerStorageValue(cid, 242589, getPlayerStorageValue(cid, 242589) + 1)
if getPlayerStorageValue(cid, 242589) < config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed " .. config[i].name .. " [" .. getPlayerStorageValue(cid, 242589) .. " / " .. config[i].count.."]")
elseif getPlayerStorageValue(cid, 242589) == config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed last " .. config[i].name .. ", go open the chest.")
setPlayerStorageValue(cid,242589,0)--Counting Again
doTeleportThing(cid, pos3)
setPlayerStorageValue(cid, 242389, 0)
doCreatureSetStorage(cid,987272, 0)
               end
             end
end   end
-----------------------------------------------------------End----------------------------------------------------------------------------------------------------
-----------------------------------------------------------End---------------------------------------------------------------------------------------------------
end
end
return true
end
Nothing happen - I dont have any notification on console and on Tibia (no Start dungeon information etc.)

Edit: Sorry i dont save lua, but now is the same :D Nothing change

1. Starting dun

1597008602485.png

2. After killing 4 rats (server logs thinking is 8...)

1597008666857.png

3. Console

1597008689377.png
 
Last edited:
Im sure :D

1. CreatureScript.xml

1597008801345.png

2. Login.lua

1597008858168.png

3. I restarted server all the time and client :p

Maybe your script is not for TFS 0.3.6?
 
you sure u killed rats in this area?
if isInRange(getPlayerPosition(cid), {x = 1099, y = 1008, z = 7}, {x = 1169, y = 1091, z = 7}) then
???
 
What is that table?

I'm not looking through the script.. cuz that table is awful. I don't even know how it would even function..

swap your table for this.
Lua:
local config = {
    {name = "rat", storage = 1, count = 150}, -- monster name for dung number 1
    {name = "bat", storage = 1, count = 10}, -- monster name for dung number 2
}
 
What is that table?

I'm not looking through the script.. cuz that table is awful. I don't even know how it would even function..

swap your table for this.
Lua:
local config = {
    {name = "rat", storage = 1, count = 150}, -- monster name for dung number 1
    {name = "bat", storage = 1, count = 10}, -- monster name for dung number 2
}
this script work with me fine with my table
 
Dungeon System created by me, specifically because of this thread. xD
 
Solution
Back
Top