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

Solved doSummonCreature problem

Majster12

Member
Joined
Feb 20, 2009
Messages
134
Solutions
1
Reaction score
16
oktb4Ak.png

TFS 1.2
pileofbones.lua
Code:
function onUse(player, item, position, fromPosition, toPosition)
local position = getCreaturePosition(cid)
    local chance = math.random(1, 30)
        if chance <= 28 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You ransack the pile but fail to find any useful parts.")
        doTransformItem(item.uid, 22514)
        doSummonCreature("Guzzlemaw", position)
        elseif chance == 29 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Amidst the pile of various bones you find a large, hollow part, similar to a pipe.")
        doPlayerAddItem(cid, 22389)
        doTransformItem(item.uid, 22514)
        elseif chance == 30 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a mouthpiece for a horn.")
        doPlayerAddItem(cid, 22391)
        doTransformItem(item.uid, 22514)
end
end

compat.lua
Code:
http://pastebin.com/nYaD1iku
 
Code:
function onUse(player, item, position, fromPosition, toPosition)
    local position = player:getPosition()
    local chance = math.random(1, 30)
        if chance <= 28 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You ransack the pile but fail to find any useful parts.")
            item:transform(22514):decay()
            Game.createMonster("Guzzlemaw", position, false, true)
        elseif chance == 29 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Amidst the pile of various bones you find a large, hollow part, similar to a pipe.")
            player:addItem(22389, 1)
            item:transform(22514):decay()
        elseif chance == 30 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a mouthpiece for a horn.")
            player:addItem(22391, 1)
            item:transform(22514):decay()
        end
    return true
end
 
Code:
function onUse(player, item, position, fromPosition, toPosition)
    local position = player:getPosition()
    local chance = math.random(1, 30)
        if chance <= 28 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You ransack the pile but fail to find any useful parts.")
            item:transform(22514):decay()
            Game.createMonster("Guzzlemaw", position, false, true)
        elseif chance == 29 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Amidst the pile of various bones you find a large, hollow part, similar to a pipe.")
            player:addItem(22389, 1)
            item:transform(22514):decay()
        elseif chance == 30 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a mouthpiece for a horn.")
            player:addItem(22391, 1)
            item:transform(22514):decay()
        end
    return true
end
Thx, but i have another error.
mzi2mTO.png
 
Code:
function onUse(player, item, position, fromPosition, toPosition)
    local position = player:getPosition()
    local chance = math.random(1, 30)
        if chance <= 28 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You ransack the pile but fail to find any useful parts.")
            item:transform(22514)
            item:decay()
            Game.createMonster("Guzzlemaw", position)
        elseif chance == 29 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Amidst the pile of various bones you find a large, hollow part, similar to a pipe.")
            player:addItem(22389, 1)
            item:transform(22514)
            item:decay()
        elseif chance == 30 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a mouthpiece for a horn.")
            player:addItem(22391, 1)
            item:transform(22514)
            item:decay()
        end
    return true
end
Try this one.
@Majster12
Copy it once again. I forgot about one decay item. :p
 
Last edited:
What is that? XD
Code:
item:transform(22514):decay()
"decay"
You make item decay in items.xml or make addEvent ro revert item id.
Like this:

Code:
local function revertBone(position, itemId, transformId)
    local item = Tile(position):getItemById(itemId)
    if item then
        item:transform(transformId)
    end
end
 
Code:
function onUse(player, item, position, fromPosition, toPosition)
    local position = player:getPosition()
    local chance = math.random(1, 30)
        if chance <= 28 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You ransack the pile but fail to find any useful parts.")
            item:transform(22514)
            item:decay()
            Game.createMonster("Guzzlemaw", position)
        elseif chance == 29 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Amidst the pile of various bones you find a large, hollow part, similar to a pipe.")
            player:addItem(22389, 1)
            item:transform(22514)
            item:decay()
        elseif chance == 30 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a mouthpiece for a horn.")
            player:addItem(22391, 1)
            item:transform(22514):decay()
        end
    return true
end
Try this one.
Works fine, thx!

What is that? XD
Code:
item:transform(22514):decay()
"decay"
You make item decay in items.xml or make addEvent ro revert item id.
Like this:

Code:
local function revertBone(position, itemId, transformId)
    local item = Tile(position):getItemById(itemId)
    if item then
        item:transform(transformId)
    end
end
I have added a decay in items.xml
But thx!
 
Last edited by a moderator:
What is that? XD
Code:
item:transform(22514):decay()
"decay"
You make item decay in items.xml or make addEvent ro revert item id.
Like this:

Code:
local function revertBone(position, itemId, transformId)
    local item = Tile(position):getItemById(itemId)
    if item then
        item:transform(transformId)
    end
end
Actually as far as I remember it wont decay when transformed. That's why I had to add decay(). Test it by yourself and u'll see.
 
Actually as far as I remember it wont decay when transformed. That's why I had to add decay(). Test it by yourself and u'll see.
I meant "item:transform():decay()" in one line.
Not whole decaying stuff :p

I prefer using addEvents btw.
 
Last edited:
if you transform an item you have to start the decaying yourself, just like he did with transform():decay(), there is no point using addevent or something else for a standard decay thats already built in
 
if you transform an item you have to start the decaying yourself, just like he did with transform():decay(), there is no point using addevent or something else for a standard decay thats already built in
There is, if you want to transform back items that cant decay in items.xml
For example levers etc.
 
Back
Top Bottom