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

STORAGE FROM MONSTER TFS 0.4 or OTX 2.9

Izaack

Member
Joined
Jun 18, 2012
Messages
70
Solutions
1
Reaction score
17
Location
México
How can I make a table so that the storage reads me and as that storage comes out, such a monster as an example storage 1000 corresponds to the demodras with the position.


this script is pulling 100% but it only works for 1 storage and 1 monster how can I make a table and that each storage corresponds to x monster, I hope you can help me
Lua:
local t = {
    storage = 3800,
    monster = {"Demodras", {x=1056, y=940, z=7}},
}
 
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
        if(not isPlayer(cid)) then
                return true
        end
        if getPlayerStorageValue(cid, t.storage) < 1 then       
    doCreatureSay(cid, t.msg, TALKTYPE_ORANGE_1)
    doSummonCreature(t.monster[1], t.monster[2])
        doTeleportThing(cid, fromPosition, true)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Necesitas el acceso, Termina tu task!.")
           else
        local destination = {x = 1057, y = 950, z = 7}
        doTeleportThing(cid, destination, true)
        setPlayerStorageValue(cid, t.storage, getPlayerStorageValue(cid, t.storage) - 1)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Si mueres o sales del room pierdes el acceso a entrar de nuevo!.")
end     
        return true
end
Post automatically merged:

UP!
Post automatically merged:

UP!!
 
Last edited:
Lua:
local monster_table = {
   
    -- Monster 1
    [3800] = {
        storage = 26000,
        monster = {name = "Demodras", bossPosition = {x=1056, y=940, z=7}, msg = "Welcome to the demodras",    playerToPosition = {x = 1057, y = 950, z = 7}}
    },
    -- Monster 2
    [3801] = {
        storage = 26001,
        monster = {name = "Orshabaal", bossPosition = {x=1056, y=940, z=7}, msg = "Welcome to the demodras",    playerToPosition = {x = 1057, y = 950, z = 7}}
    },
}


function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)


    local boss_tile = monster_table[item.aid] -- this of for check if actionid of tile match with some index of the table monster_table

    if boss_tile then
        if getPlayerStorageValue(boss_tile.storage) <= 0 then
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sorry, you dont have this storage for now.")
            doTeleportThing(cid, fromPosition, true)
            return false
        end
        -- Here you can do the rest    if the player have the storage > 0
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, boss_tile.monster.msg)
        doTeleportThing(cid, boss_tile.monster.playerToPosition, true)
        doSummonCreature(boss_tile.monster.name, boss_tile.monster.bossPosition)
   
    else
        doTeleportThing(cid, fromPosition, true)  
        return false
    end
    return true
end
 
Lua:
local monster_table = {
  
    -- Monster 1
    [3800] = {
        storage = 26000,
        monster = {name = "Demodras", bossPosition = {x=1056, y=940, z=7}, msg = "Welcome to the demodras",    playerToPosition = {x = 1057, y = 950, z = 7}}
    },
    -- Monster 2
    [3801] = {
        storage = 26001,
        monster = {name = "Orshabaal", bossPosition = {x=1056, y=940, z=7}, msg = "Welcome to the demodras",    playerToPosition = {x = 1057, y = 950, z = 7}}
    },
}


function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)


    local boss_tile = monster_table[item.aid] -- this of for check if actionid of tile match with some index of the table monster_table

    if boss_tile then
        if getPlayerStorageValue(boss_tile.storage) <= 0 then
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sorry, you dont have this storage for now.")
            doTeleportThing(cid, fromPosition, true)
            return false
        end
        -- Here you can do the rest    if the player have the storage > 0
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, boss_tile.monster.msg)
        doTeleportThing(cid, boss_tile.monster.playerToPosition, true)
        doSummonCreature(boss_tile.monster.name, boss_tile.monster.bossPosition)
  
    else
        doTeleportThing(cid, fromPosition, true) 
        return false
    end
    return true
end
still the same as the first bro does not work with the second monster, also the action id is the same for all the only thing that would change would be the storage an example if you have the storage 3800 the monster that will come out when you enter the teleport will be the delay but if you have the storage 3801 the monster that will come out in the same teleport will be the orshabaal an example the action id would be handled the same.
 
Back
Top