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

[TFS 1.2/1.3] Free scripting service

Status
Not open for further replies.
But i have tried searching and all i can see is servers with anti-bot :/
not interested in making an anti-bot system for 1.3
i don't even have a bot to test with to see if it would work
+ the newer bots are harder to stop ive heard so i won't bother
you're better off just using a custom client and seeing if you can stop bot injection
 
Hey,
It's possible to create something like: when player kill the monster and looted rare item (rare item from list) then ppls got global/world chat msg: PlayerName looted ItemName from MonsterName?

Thanks.
 
Hey,
It's possible to create something like: when player kill the monster and looted rare item (rare item from list) then ppls got global/world chat msg: PlayerName looted ItemName from MonsterName?

Thanks.
try this
Lua:
local rareItems = {1111, 2222, 3333}

local function scanRareItems(name, pos)
    local corpse = Tile(pos):getTopDownItem()
    for i = corpse:getSize()-1, 0, -1 do
        local item = corpse:getItem(i)
        if isInArray(rareItems, item:getId()) then
            Game.broadcastMessage(("%s has looted a %d %s!"):format(name, item:getCount(), item:getCount() > 1 and ItemType(item:getId()):getPluralName() or item:getName()))
            return
        end
    end
end

function onKill(creature, target)
    if creature:isPlayer() and target:isMonster() then
        addEvent(scanRareItems, 0, creature:getName(), target:getPosition())
    end
    return true
end
 
Shiet! I fckup name in xml (facepalm). Rly sorry for this, works perfect! Big Thanks!
 
Hi Xeraphus.
im triying to do a script function onMove

<event class="Player" method="onMoveItem" enabled="1" />

function Player:eek:nMoveItem(item, count, fromPosition, toPosition, fromCylinder, toCylinder)

it's possible to make something like=

if player move items from X to Y, that items set weight to 0.
and if player move again items from Y to X that items recover their original weight.

what im triying to do?
an special backpack where you can carry items even if the player no have cap.

thanks in advance Xeraphus.
 
Hi Xeraphus.
im triying to do a script function onMove

<event class="Player" method="onMoveItem" enabled="1" />

function Player:eek:nMoveItem(item, count, fromPosition, toPosition, fromCylinder, toCylinder)

it's possible to make something like=

if player move items from X to Y, that items set weight to 0.
and if player move again items from Y to X that items recover their original weight.

what im triying to do?
an special backpack where you can carry items even if the player no have cap.

thanks in advance Xeraphus.
this is a bit hard to make (i don't think it's actually possible) since toCylinder doesn't return the cylinder you're actually going to put the item in
otherwise you could copy the item, remove the first one and add the copied item to the new cylinder
 
this is a bit hard to make (i don't think it's actually possible) since toCylinder doesn't return the cylinder you're actually going to put the item in
otherwise you could copy the item, remove the first one and add the copied item to the new cylinder

if toPosition.x == CONTAINER_POSITION and toCylinder and toCylinder:getId() == "xxxx" then
then item set cap 0?
 
if toPosition.x == CONTAINER_POSITION and toCylinder and toCylinder:getId() == "xxxx" then
then item set cap 0?
toCylinder will be the same as fromCylinder if you're moving it from inside a backpack to another backpack
i don't think there's a solution in everything works perfectly
yes you can do that but it won't work if you have the item in your backpack and move it to the backpack inside there
 
a okk, i get you, well this is my "purse slot" called menu and there is 4 items(containers)
2e6455fd74f41d50c47131a82599666fo.png


this is the Loot box.
here comes all the loot from the monsters (automatic when you kill something)
i can add on the script (when the corpse of the monster is scaned and move the items to the loot box)
a line to remove the "cap" of the items.
but if you move that items again from there (loot box) to the first container(inventory) these items need to have cap again.
but the inventory and the loot box are in the same place "purse slot 11", so, is not possible :(
any other solution?
 
It's me again, sorry = D
Code:
23:47 Player has looted a 1 golden legs!
23:48 Player has looted a 1 golden legs!
Can I dispose of this number '1'? I try made this by myself but got something like this now:
Code:
23:52 Player has looted a golden legss!
23:52 Player has looted a golden legss!
;o
Extra 's' at the end.
It's possible to add this msg to world-chat too?
 
It's me again, sorry = D
Code:
23:47 Player has looted a 1 golden legs!
23:48 Player has looted a 1 golden legs!
Can I dispose of this number '1'? I try made this by myself but got something like this now:
Code:
23:52 Player has looted a golden legss!
23:52 Player has looted a golden legss!
;o
Extra 's' at the end.
It's possible to add this msg to world-chat too?
untested but i think it should work fine, i added the article and item name instead of the 1
change the WORLD_CHAT too
Lua:
local rareItems = {1111, 2222, 3333}
local WORLD_CHAT = 00000 -- channel id here

local function scanRareItems(cid, pos)
    local player = Player(cid)
    local name = player:getName()
    local corpse = Tile(pos):getTopDownItem()
    for i = corpse:getSize()-1, 0, -1 do
        local item = corpse:getItem(i)
        if isInArray(rareItems, item:getId()) then
            local count = item:getCount()
            local string = ("%s has looted %s %s!"):format(name, count > 1 and count or item:getArticle(), count > 1 and item:getPluralName() or item:getName())
            Game.broadcastMessage(string)
            player:sendChannelMessage(nil, string, TALKTYPE_CHANNEL_R1, WORLD_CHAT)
        end
    end
end

function onKill(creature, target)
    if creature:isPlayer() and target:isMonster() then
        addEvent(scanRareItems, 0, creature:getId(), target:getPosition())
    end
    return true
end

a okk, i get you, well this is my "purse slot" called menu and there is 4 items(containers)
2e6455fd74f41d50c47131a82599666fo.png


this is the Loot box.
here comes all the loot from the monsters (automatic when you kill something)
i can add on the script (when the corpse of the monster is scaned and move the items to the loot box)
a line to remove the "cap" of the items.
but if you move that items again from there (loot box) to the first container(inventory) these items need to have cap again.
but the inventory and the loot box are in the same place "purse slot 11", so, is not possible :(
any other solution?
i don't think there's a solution, i can't test it either cause i don't have the same server as you (don't have a working purse or that loot box)
i do however know how to change the item weight, so if you're able to figure out how to get the boxes working, you can use these two to set weight to 0 and put it back:
Lua:
item:setAttribute(ITEM_ATTRIBUTE_WEIGHT, 0)
item:setAttribute(ITEM_ATTRIBUTE_WEIGHT, ItemType(item:getId()):getWeight())
 
Can you script an event that is an automated trivia?

Event would be like this.
Event starts every hour
Event is a global broadcast that asks a questions every 60 seconds, players must answer questions using "$" "#" "&" or something to
answer the broadcast script
After a player has answered 3 answers correctly, the event shall finish adding an item to the player that won the event.
 
Hello! Nice job, I would like to request a questchest that have random multiple rewards. For example rightclick chest and you get a bag or backpack with the reward like
Code:
Sneaky Stabber of Eliteness 33%chance
Squeezing Gear of Girlpower 33% chance
Whacking Driller of Fate 33% chance
Ornamented shield 25% chance
Boots of Haste 25% chance
CrystalCoins 1-5 100% chance
All inside a bag/backpack.
Every player that opens the chest should get a random reward so that 2 players might get different rewards from it.
If possible, no limit to how many items that can be rewarded from it.

Thanks in advance, hope you understand me :p
 
Last edited:
Can you script an event that is an automated trivia?

Event would be like this.
Event starts every hour
Event is a global broadcast that asks a questions every 60 seconds, players must answer questions using "$" "#" "&" or something to
answer the broadcast script
After a player has answered 3 answers correctly, the event shall finish adding an item to the player that won the event.
will work on this soon, should be easy

Wondering if you could please update functions to have the date the item was added to inventory and make a talkaction to search for items like "/scanplayer "all/Name", "ID"
are you talking about updating the addItem function to set the time it was added when the item is given?
i can scan the player easy i just wanna know how you expect it to be done
if you dont know ill just use debug.sethook on addItem

Hello! Nice job, I would like to request a questchest that have random multiple rewards. For example rightclick chest and you get a bag or backpack with the reward like
Code:
Sneaky Stabber of Eliteness 33%chance
Squeezing Gear of Girlpower 33% chance
Whacking Driller of Fate 33% chance
Ornamented shield 25% chance
Boots of Haste 25% chance
CrystalCoins 1-5 100% chance
All inside a bag/backpack.
Every player that opens the chest should get a random reward so that 2 players might get different rewards from it.
If possible, no limit to how many items that can be rewarded from it.

Thanks in advance, hope you understand me :p
Lua:
local items = {
    {id = xxxxx, chance = y, count = {min, max}}
}

local storage = 88888

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(storage) == 1 then
        player:sendCancelMessage("You have already done this quest.")
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        return true
    end
    local backpack = player:addItem(2000)
    for i = 1, #items do
        if math.random(100) <= items[i].chance then
            backpack:addItem(items[i].id, math.random(items[i].count[1], items[i].count[2]))
        end
    end
    player:setStorageValue(storage, 1)
    player:sendTextMessage(MESSAGE_INFO_DESCR, "You have received a reward.")
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
    return true
end

all you have to do is add more items to the items table, i put an example of how it should look there
 
Last edited:
will work on this soon, should be easy


are you talking about updating the addItem function to set the time it was added when the item is given?
i can scan the player easy i just wanna know how you expect it to be done
if you dont know ill just use debug.sethook on addItem


Lua:
local items = {
    {id = xxxxx, chance = y, count = {min, max}}
}

local storage = 88888

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(storage) == 1 then
        player:sendCancelMessage("You have already done this quest.")
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        return true
    end
    local backpack = player:addItem(2000)
    for i = 1, items do
        if math.random(100) <= items[i].chance then
            backpack:addItem(items[i].id, math.random(items[i].count[1], items[i].count[2]))
        end
    end
    player:setStorageValue(storage, 1)
    player:sendTextMessage(MESSAGE_INFO_DESCR, "You have received a reward.")
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
    return true
end

all you have to do is add more items to the items table, i put an example of how it should look there
Thank you! This works like a charm :) changed
Lua:
for i = 1, items do
to
Lua:
for i = 1, #items do
 
Status
Not open for further replies.
Back
Top