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

Xikini's Free Scripting Service. [0.3.7 & (0.3.6/0.4)]

Status
Not open for further replies.

Xikini

I whore myself out for likes
Senator
Joined
Nov 17, 2010
Messages
6,828
Solutions
586
Reaction score
5,409
Doing quick (30 min or less) scripts for [0.3.7 & (0.3.6/0.4)]
I am not here to fix your broken scripts, although I will give advice if requested.
I am here for script requests of scripts not already available on the forum.
If you require support for your scripting issues please make a thread in the support section.

For clarity's sake,
I will script actionscripts, creaturescripts, globalevents, talkactions, movements, npcs for you.
I will not script spells, weapons, raids or monster scripts.
Additionally, source editing, websites and database queries are a no go as well.

Code:
How to make shorter links to posts.
https://otland.net/threads/234306/page-14#post-2330703
 
Last edited:
Hello xikini can you help me please with this script 0.4
PHP:
 local config = {
    [1] = {position = {x=869,y=965,z=7}, nugget = 2,houseid = 2411},
    [2] = {position = {x=848,y=742,z=7}, nugget = 2,houseid = 2412},
    [3] = {position = {x=910,y=739,z=7}, nugget = 2,houseid = 2413},
    [4] = {position = {x=973,y=728,z=7}, nugget = 2,houseid = 2414},
    [5] = {position = {x=870,y=702,z=7}, nugget = 2,houseid = 2415},
    [6] = {position = {x=934,y=694,z=7}, nugget = 2,houseid = 2416}
}

function timeString(timeDiff)
    local dateFormat = {
        {"day", timeDiff / 60 / 60 / 24},
        {"hour", timeDiff / 60 / 60 % 24},
        {"minute", timeDiff / 60 % 60},
        {"second", timeDiff % 60}
    }

    local out = {}
    for k, t in ipairs(dateFormat) do
        local v = math.floor(t[2])
        if(v > 0) then
            table.insert(out, (k < #dateFormat and (#out > 0 and ', ' or '') or ' and ') .. v .. ' ' .. t[1] .. (v ~= 1 and 's' or ''))
        end
    end
    local ret = table.concat(out)
    if ret:len() < 16 and ret:find("second") then
        local a, b = ret:find(" and ")
        ret = ret:sub(b+1)
    end
    return ret
end
function onThink(interval)
local people = getPlayersOnline()
if #people == 0 then
return true
end

    if getGlobalStorageValue(1070) < os.time() then
        setGlobalStorageValue(1070, os.time() + 3600)
        setGlobalStorageValue(1069, 1)
    end
    for i,v in pairs(config) do
    local house = getHouseFromPos(v.position)
        if house and getHouseOwner(house) then
            if getGlobalStorageValue(1069) == 1 then
                local item2 = getTileInfo({x=v.position.x, y=v.position.y, z=v.position.z, stackpos = 1})
                    if (item2.uid ~= 0 and item2.itemid == 2157) then
                        if item2.type >= v.nugget then
                            setHouseOwner(v.houseid, getHouseOwner(house))
                            doRemoveItem(item2.uid,2)
                        else
                            setHouseOwner(v.houseid, 0)
                        end
                    else
                    setHouseOwner(v.houseid, 0)
                end
            elseif getGlobalStorageValue(1070) > os.time() then
                if getHouseOwner(house) == 0 then
                    --doCreatureSay(people[1], "Nobody Owns This,Must Buy First", TALKTYPE_ORANGE_1, false, 0,v.position)
                else
                    doCreatureSay(people[1], ""..timeString(getGlobalStorageValue(1070) - os.time()).."", TALKTYPE_ORANGE_1, false, 0,v.position)
                end
            end
        end
    end
    setGlobalStorageValue(1069, 0)
    return true
end
now it takes all money and kick out of hoouse :(

edit:
can you please check this script aswell
PHP:
function onCombat(cid, target)
local pid = isInParty(cid)
local exp = 1.0
if pid ~= false then
end
local _v = getPlayerRates(cid)[SKILL__LEVEL]
if pid ~= true and getConfigValue("EnableExtraPartyEXP") == true then
doPlayerSetRate(cid, SKILL__LEVEL, (_v+exp))
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are currently gaining more experince due to being in a party.")
end
return true
end
if player is not even in party he recieves that message and gets more and more exp on kill of same monster lol ^^
 
Last edited:
Hello xikini can you help me please with this script 0.4
PHP:
 local config = {
    [1] = {position = {x=869,y=965,z=7}, nugget = 2,houseid = 2411},
    [2] = {position = {x=848,y=742,z=7}, nugget = 2,houseid = 2412},
    [3] = {position = {x=910,y=739,z=7}, nugget = 2,houseid = 2413},
    [4] = {position = {x=973,y=728,z=7}, nugget = 2,houseid = 2414},
    [5] = {position = {x=870,y=702,z=7}, nugget = 2,houseid = 2415},
    [6] = {position = {x=934,y=694,z=7}, nugget = 2,houseid = 2416}
}

function timeString(timeDiff)
    local dateFormat = {
        {"day", timeDiff / 60 / 60 / 24},
        {"hour", timeDiff / 60 / 60 % 24},
        {"minute", timeDiff / 60 % 60},
        {"second", timeDiff % 60}
    }

    local out = {}
    for k, t in ipairs(dateFormat) do
        local v = math.floor(t[2])
        if(v > 0) then
            table.insert(out, (k < #dateFormat and (#out > 0 and ', ' or '') or ' and ') .. v .. ' ' .. t[1] .. (v ~= 1 and 's' or ''))
        end
    end
    local ret = table.concat(out)
    if ret:len() < 16 and ret:find("second") then
        local a, b = ret:find(" and ")
        ret = ret:sub(b+1)
    end
    return ret
end
function onThink(interval)
local people = getPlayersOnline()
if #people == 0 then
return true
end

    if getGlobalStorageValue(1070) < os.time() then
        setGlobalStorageValue(1070, os.time() + 3600)
        setGlobalStorageValue(1069, 1)
    end
    for i,v in pairs(config) do
    local house = getHouseFromPos(v.position)
        if house and getHouseOwner(house) then
            if getGlobalStorageValue(1069) == 1 then
                local item2 = getTileInfo({x=v.position.x, y=v.position.y, z=v.position.z, stackpos = 1})
                    if (item2.uid ~= 0 and item2.itemid == 2157) then
                        if item2.type >= v.nugget then
                            setHouseOwner(v.houseid, getHouseOwner(house))
                            doRemoveItem(item2.uid,2)
                        else
                            setHouseOwner(v.houseid, 0)
                        end
                    else
                    setHouseOwner(v.houseid, 0)
                end
            elseif getGlobalStorageValue(1070) > os.time() then
                if getHouseOwner(house) == 0 then
                    --doCreatureSay(people[1], "Nobody Owns This,Must Buy First", TALKTYPE_ORANGE_1, false, 0,v.position)
                else
                    doCreatureSay(people[1], ""..timeString(getGlobalStorageValue(1070) - os.time()).."", TALKTYPE_ORANGE_1, false, 0,v.position)
                end
            end
        end
    end
    setGlobalStorageValue(1069, 0)
    return true
end
now it takes all money and kick out of hoouse :(

edit:
can you please check this script aswell
PHP:
function onCombat(cid, target)
local pid = isInParty(cid)
local exp = 1.0
if pid ~= false then
end
local _v = getPlayerRates(cid)[SKILL__LEVEL]
if pid ~= true and getConfigValue("EnableExtraPartyEXP") == true then
doPlayerSetRate(cid, SKILL__LEVEL, (_v+exp))
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are currently gaining more experince due to being in a party.")
end
return true
end
if player is not even in party he recieves that message and gets more and more exp on kill of same monster lol ^^
Use the support forum. >.<
 
Hello xikini, i want your help with a simple script, so basically i want a smithing script which you put x amount of items say "ores" into a furnace, and the result comes out as a random items like armor/legs/helmet, hope its not that hard to configure this script :)
 
cmon bro :D its basicly same :p
i have fixed top one , can you please check party exp script ? :)
I refuse to fix scripts in this thread.
~= means 'not equal to' .
Hello xikini, i want your help with a simple script, so basically i want a smithing script which you put x amount of items say "ores" into a furnace, and the result comes out as a random items like armor/legs/helmet, hope its not that hard to configure this script :)
I'll add it to my list. :p
Btw, do you want the items to go into the players inventory (assuming they have enough capacity) or stack on the furnace?
 
Last edited:
Stack on the furnace if you can, would be cool :)
Alrighty.
Currently 4am, I get off work at 7am, get home for 7:30/8am, finish script + bug testing probably around 8:00-10am depending on how slow I am. :p
 
Credits to @Supert for the request!
Credits to @MatheusMkalo for some support!


Sacrifice Item Script

5yV9DY.gif


Known 'issue' with no simple fix.
When doing multiple items, eventually your coal basin will disappear.
This is due to tibia's stacking. Unless you edit your client, after 6/7 items, it will always disappear.


Video demonstrates the majority of the script, and configuration of script is pretty straightforward.


Installation

On map editor, place ActionID on tile.
Place coal basin on top. (Green unmovable basin is suggested. (itemID = 1484))


data/movements/movements.xml
Code:
<movevent event="AddItem" tileitem="1" actionid="45001" script="sacrifice_item.lua"/>
data/movements/simple_sacrifice_item.lua
Code:
local reward_items = {
     [1] = {item = 2159},
     [2] = {item = 1988},
     [3] = {item = 1998}
}

local config = {
     sacrifice_item = 5880, -- 5880 = iron ore
     effect = CONST_ME_HITBYFIRE,
}


function onAddItem(moveitem, tileitem, pos, cid)

     if moveitem.itemid == config.sacrifice_item then
         doRemoveItem(moveitem.uid, 1)
         doSendMagicEffect(pos, config.effect)
         local rand = reward_items[math.random(#reward_items)]
         doCreateItem(rand.item, 1, pos)
     end

     return true
end
data/movements/advanced_sacrifice_item.lua -- Credit to @MatheusMkalo
Code:
local reward_items = {
     [1] = {item = 2159},
     [2] = {item = 1988},
     [3] = {item = 1998}
}

local config = {
     sacrifice_item = 5880, -- 5880 = iron ore (Note: Item must be 'stackable')
     multi_sacrifice = 1, -- 1 = can put stacks of 100 sacrifice_item | 0 = only 1 item at a time.
     loop_1_delay = 3000, -- 1000 = 1 second
     effect = CONST_ME_HITBYFIRE,
}

BASINEVENTS = {}

function getBasinEventIdByPos(position)
     for i, info in pairs(BASINEVENTS) do
         if type(info[1]) == "table" then
             if info[1].x == position.x and info[1].y == position.y and info[1].z == position.z then
                 return i
             end
         end
     end
end

function loop_1(position, n)
     if getTileItemById(position, config.sacrifice_item).type > 0 then
         doRemoveItem(getTileItemById(position, config.sacrifice_item).uid, 1)
         doSendMagicEffect(position, config.effect)
         local rand = reward_items[math.random(#reward_items)]
         doCreateItem(rand.item, 1, position)
         if config.multi_sacrifice == 1 then
             n = 1
         else
             n = 0
         end
     end
    
     if(n > 0) then
         addEvent(loop_1, config.loop_1_delay, position, n - 1)
     else
         local basinId = getBasinEventIdByPos(position)
         if basinId then
             BASINEVENTS[basinId][2] = false
         end
     end
end

function onAddItem(moveitem, tileitem, pos, cid)
     if moveitem.itemid == config.sacrifice_item then
         local basinId = getBasinEventIdByPos(pos)
         if not basinId then
             table.insert(BASINEVENTS, {pos, true})
         elseif BASINEVENTS[basinId] then
             if BASINEVENTS[basinId][2] then
                 return true
             else
                 BASINEVENTS[basinId][2] = true
             end
         end
         addEvent(loop_1, 0, pos, 1)
     end
     return true
end
 
Last edited:
Credits to @Supert for the request!

Sacrifice Item Script

5yV9DY.gif


Known 'exploit' with no known fix.
If using 'multi_sacrifice', you can place multiple stacks of 100 and make it generate items quicker.

Known 'issue' with no simple fix.
When doing multiple items, eventually your coal basin will disappear.
This is due to tibia's stacking. Unless you edit your client, after 6/7 items, it will always disappear.

Video demonstrates the majority of the script, and there is easy config.


Installation

On map editor, place ActionID on tile.
Place coal basin on top. (Green unmovable basin is suggested. (itemID = 1484))
(note: no item has to be on top of the tile for the script to work. It just makes it look better.)


data/movements/movements.xml
Code:
<movevent event="AddItem" tileitem="1" actionid="45001" script="sacrifice_item.lua"/>
data/movements/sacrifice_item.lua
Code:
local reward_items = {
     [1] = {item = 2159},
     [2] = {item = 1988},
     [3] = {item = 1998}
}

local config = {
     sacrifice_item = 5880, -- 5880 = iron ore (Note: Item must be 'stackable')
     multi_sacrifice = 1, -- 1 = can put stacks of 100 sacrifice_item | 0 = only 1 item at a time.
     loop_1_delay = 1000, -- 1000 = 1 second
     effect = CONST_ME_HITBYFIRE
}

local position = {x = 0, y = 0, z = 0}
function loop_1(n)
     if getTileItemById(position, config.sacrifice_item).type > 0 then
         doRemoveItem(getTileItemById(position, config.sacrifice_item).uid, 1)
         doSendMagicEffect(position, config.effect)
         local rand = reward_items[math.random(#reward_items)]
         doCreateItem(rand.item, 1, position)
         if config.multi_sacrifice == 1 then
             n = 1
         else
             n = 0
         end
     end

     if(n > 0) then
         addEvent(loop_1, config.loop_1_delay, n - 1)
     end
end

function onAddItem(moveitem, tileitem, pos, cid)
     if moveitem.itemid == config.sacrifice_item then
         position = {x = pos.x, y = pos.y, z = pos.z}
         addEvent(loop_1, 0, 1)
     end
     return true
end
Use a global var true/false to fix the addEvent. If the boolean is false(default) set it to true and execute addevent and inside the loop function set it back to false when it finishes.
 
Use a global var true/false to fix the addEvent. If the boolean is false(default) set it to true and execute addevent and inside the loop function set it back to false when it finishes.
I thought of this as well, but what if they want multiple spots for this script?
They would need to create a separate file/storage for each spot, no?
 
Last edited:
Status
Not open for further replies.
Back
Top