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

Kegs/Cask OTX 3.10

Hitman94

Member
Joined
Feb 9, 2009
Messages
88
Solutions
1
Reaction score
12
witam mam problem z kegami nie działają moim zdaniem błąd jest w data/modules/scripts/gamestore.lua gdyż nie nadaje itemowi Action ID po kupieniu w store

KEGS
Lua:
You see a health potion keg.
It weighs 125.00 oz.
This keg can be used to refill health potions.
It has 500 refillings left.
Item ID: 28579

CASK tutaj po kupieniu nadaje itemowi Action ID i działa poprawnie
Lua:
You see an Ultimate health potion cask.
Wrap it in your own house to create a <decoration kit>.
It has 1000 refillings left.
Item ID: 28558, Action ID: 28558

data/modules/scripts/gamestore.lua
Store Kegs który wygląda tak nie działa
Lua:
    {
        name = "Kegs Potion",
        state = GameStore.States.STATE_NONE,
        description = "You can use refill empty flask",
        icons = {"mana_keg.png"},
        rookgaard = true,
        offers = {
 
            {name = "Health Keg", thingId = 28579, count = 500, type = GameStore.OfferTypes.OFFER_TYPE_STACKABLE, price = 4, icons = {"health_keg.png"}},
            {name = "Strong Health Keg", thingId = 28580, count = 500, type = GameStore.OfferTypes.OFFER_TYPE_STACKABLE, price = 8, icons = {"strong_health_keg.png"}},
            {name = "Great Health Keg", thingId = 28581, count = 500, type = GameStore.OfferTypes.OFFER_TYPE_STACKABLE, price = 36, icons = {"great_health_keg.png"}},
            {name = "Ultimate Health Keg", thingId = 28582, count = 500, type = GameStore.OfferTypes.OFFER_TYPE_STACKABLE, price = 58, icons = {"ultimate_health_keg.png"}},
            {name = "Supreme Health Keg", thingId = 28583, count = 500, type = GameStore.OfferTypes.OFFER_TYPE_STACKABLE, price = 94, icons = {"supreme_health_keg.png"}},
            {name = "Mana Keg", thingId = 28584, count = 500, type = GameStore.OfferTypes.OFFER_TYPE_STACKABLE, price = 4, icons = {"mana_keg.png"}},
            {name = "Strong Mana Keg", thingId = 28585, count = 500, type = GameStore.OfferTypes.OFFER_TYPE_STACKABLE, price = 8, icons = {"strong_mana_keg.png"}},
            {name = "Great Mana Keg", thingId = 28586, count = 500, type = GameStore.OfferTypes.OFFER_TYPE_STACKABLE, price = 36, icons = {"great_mana_keg.png"}},
            {name = "Ultimate Mana Keg", thingId = 28587, count = 500, type = GameStore.OfferTypes.OFFER_TYPE_STACKABLE, price = 66, icons = {"ultimate_mana_keg.png"}},
            {name = "Great Spirit Potion Keg", thingId = 28589, count = 500, type = GameStore.OfferTypes.OFFER_TYPE_STACKABLE, price = 36, icons = {"great_spirit_keg.png"}},
            {name = "Ultimate Spirit Potion Keg", thingId = 28590, count = 500, type = GameStore.OfferTypes.OFFER_TYPE_STACKABLE, price = 66, icons = {"ultimate_spirit_keg.png"}},
         
                },
            },

Store Cask działający
Lua:
    {
        name = "Cask Potion",
        state = GameStore.States.STATE_NONE,
        description = "You can only be the owner of the house",
        icons = {"health_cask.png"},
        rookgaard = true,
        offers = {
  
            {name = "Health Cask", thingId = 28555, count = 1000, type = GameStore.OfferTypes.OFFER_TYPE_HOUSE, price = 4, icons = {"health_cask.png"}},
            {name = "Strong Health Cask", thingId = 28556, count = 1000, type = GameStore.OfferTypes.OFFER_TYPE_HOUSE, price = 9, icons = {"strong_health_cask.png"}},
            {name = "Great Health Cask", thingId = 28557, count = 1000, type = GameStore.OfferTypes.OFFER_TYPE_HOUSE, price = 18, icons = {"great_health_cask.png"}},
            {name = "Ultimate Health Cask", thingId = 28558, count = 1000, type = GameStore.OfferTypes.OFFER_TYPE_HOUSE, price = 29, icons = {"ultimate_health_cask.png"}},
            {name = "Supreme Health Cask", thingId = 28559, count = 1000, type = GameStore.OfferTypes.OFFER_TYPE_HOUSE, price = 47, icons = {"supreme_health_cask.png"}},
            {name = "Mana Cask", thingId = 28565, count = 1000, type = GameStore.OfferTypes.OFFER_TYPE_HOUSE, price = 4, icons = {"mana_cask.png"}},
            {name = "Strong Mana Cask", thingId = 28566, count = 1000, type = GameStore.OfferTypes.OFFER_TYPE_HOUSE, price = 7, icons = {"strong_mana_cask.png"}},
            {name = "Great Mana Cask", thingId = 28567, count = 1000, type = GameStore.OfferTypes.OFFER_TYPE_HOUSE, price = 11, icons = {"great_mana_cask.png"}},
            {name = "Ultimate Mana Cask", thingId = 28568, count = 1000, type = GameStore.OfferTypes.OFFER_TYPE_HOUSE, price = 33, icons = {"ultimate_mana_cask.png"}},
            {name = "Great Spirit Cask", thingId = 28575, count = 1000, type = GameStore.OfferTypes.OFFER_TYPE_HOUSE, price = 18, icons = {"great_spirit_cask.png"}},
            {name = "Ultimate Spirit Cask", thingId = 28576, count = 1000, type = GameStore.OfferTypes.OFFER_TYPE_HOUSE, price = 33, icons = {"ultimate_spirit_cask.png"}},
          
                },
            },
Action.xml

Lua:
    <action fromid="7634" toid="7636" script="other/caskkegs.lua"/>

other/caskkegs.lua

Lua:
local targetIdList = {
     --health potions casks
    [28555] = {itemId = 7636, transform = 7618}, [28579] = {itemId = 7636, transform = 7618}, -- Health Potion --
     [28556] = {itemId = 7634, transform = 7588}, [28580] = {itemId = 7634, transform = 7588}, -- Strong Health --
     [28557] = {itemId = 7635, transform = 7591}, [28581] = {itemId = 7635, transform = 7591}, -- Great Health --
     [28558] = {itemId = 7635, transform = 8473}, [28582] = {itemId = 7635, transform = 8473}, -- Ultimate Health --
     [28559] = {itemId = 7635, transform = 26031}, [28583] = {itemId = 7635, transform = 26031}, -- Supreme Health --
     --mana potions casks
     [28565] = {itemId = 7636, transform = 7620}, [28584] = {itemId = 7636, transform = 7620}, -- Mana Potion --
     [28566] = {itemId = 7634, transform = 7589}, [28585] = {itemId = 7634, transform = 7589}, -- Strong Mana --
     [28567] = {itemId = 7635, transform = 7590}, [28586] = {itemId = 7635, transform = 7590}, -- Great Mana --
     [28568] = {itemId = 7635, transform = 26029}, [28587] = {itemId = 7635, transform = 26029}, -- Ultimate Mana --
     --spirit potions caks
     [28575] = {itemId = 7635, transform = 8472}, [28589] = {itemId = 7635, transform = 8472}, -- Great Spirit --
     [28576] = {itemId = 7635, transform = 26030}, [28590] = {itemId = 7635, transform = 26030}, --Ultimate Spirit --
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if target:getId() >= 28535 and target:getId() < 28579 then
    local house = player:getTile():getHouse()
    if house and house:canEditAccessList(SUBOWNER_LIST, player) and house:canEditAccessList(doorId, player) or target:getId() >= 28579 then
    elseif target:getId() >= 28535 and target:getId() < 28579 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Sorry, casks only can be useds inside house.')
        return false
    else
        return false
    end

    if target then
        local charges = target:getCharges()
         if item:getCount() > charges then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format('Sorry, only Remaining %s charges.', charges))
            return false
        end

         local targetId = targetIdList[target:getId()]
         if targetId then
             if item:getId() == targetId.itemId then
                item:transform(targetId.transform)
                charges = charges - item:getCount()
                target:transform(target:getId(), charges)
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format('Remaining %s charges.', charges))
      
                if charges == 0 then
                    target:remove()
                end
             end
         end
    end
    return true
end
end

Jeśli ktoś jest wstanie pomóc będę wdzięczny :D
Można to sprawdzić w praktyce realtibia.eu
 
Last edited:
Nie znam się na real tibii i tych całych kega/caskach, ale na pierwszy rzut oka to sa juz dwa błędy:

other/caskkegs.lua
if target:getId() >= 28535 and target:getId() < 28579 then
elseif target:getId() >= 28535 and target:getId() < 28579 then

Zmień tą drugą liczbę na 28591, żeby kegi też się łapały.
 
Back
Top