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

List of useful TFS 1.x scripts.

This creaturescript collects gold from monsters and put in the bag, automatically organizing and changing when it comes to 100.

Could convert it?

Code:
function onKill(cid, target)

    if not isMonster(target) then return true end

    local configs = {
            ids = {2148, 2152, 2160},
            premium = true
    }
  
    if configs.premium and not isPremium(cid) then return true end

    local function gatherGold(cid, corpseId, corpsePosition)
            if not isCreature(cid) then return end
            local corpse = getTileItemById(corpsePosition, corpseId).uid
            if corpse <= 1 or not isCorpse(corpse) then return end
            local slot, corpseMoney = 0, 0
            for times = 1, getContainerSize(corpse) do
                    local corpseItem = getContainerItem(corpse, slot)
                    if not isInArray(configs.ids, corpseItem.itemid) then
                            slot = slot + 1
                    else
                            local iInfo, removeItem = getItemInfo(corpseItem.itemid), true
                            if (iInfo.worth or 0) >= 1 then
                                    corpseMoney = corpseMoney + (corpseItem.type * iInfo.worth)
                            else
                                    removeItem = doPlayerAddItem(cid, corpseItem.itemid, math.max(corpseItem.type, 1), false)
                            end
                            if removeItem then
                                    doRemoveItem(corpseItem.uid)
                            end
                    end
            end
            corpseMoney = corpseMoney + getPlayerMoney(cid)
            doPlayerRemoveMoney(cid, getPlayerMoney(cid))
            doPlayerAddMoney(cid, corpseMoney)
    end
  
    local name, pos = getCreatureName(target), getThingPos(target)
  
    addEvent(gatherGold, 10, cid, getMonsterInfo(name).lookCorpse, pos)
  
return true
end
 
quick conversion:

below
Code:
function onKill(cid, target)
add
Code:
cid = cid:getId()
target = target:getId()
 
quick conversion:

below
Code:
function onKill(cid, target)
add
Code:
cid = cid:getId()
target = target:getId()

Didn't work.
Something wrong?

Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/autogold.lua:onKill
data/creaturescripts/scripts/autogold.lua:42: attempt to call global 'getMonster
Info' (a nil value)
stack traceback:
        [C]: in function 'getMonsterInfo'
        data/creaturescripts/scripts/autogold.lua:42: in function <data/creature
scripts/scripts/autogold.lua:1>
 
Last edited:
0.4 and pre metatables data
getItemInfo and similiar functions need to be rewritten manually
 
0.4 and pre metatables data
getItemInfo and similiar functions need to be rewritten manually

I've rewrited the code with my poor knowledge, but still not work! :/
Code:
function onKill(cid, target)
cid = cid:getId()
target = target:getId()

    if not Creature.isMonster(target) then return true end

    local configs = {
            ids = {2148, 2152, 2160},
            premium = false
    }
   
    if configs.premium and not isPremium(cid) then return true end

    local function gatherGold(cid, corpseId, corpsePosition)
            if not Thing.isCreature(cid) then return end
            local corpse = getTileItemById(corpsePosition, corpseId).uid
            if corpse <= 1 or not isCorpse(corpse) then return end
            local slot, corpseMoney = 0, 0
            for times = 1, len(corpse) do
                    local corpseItem = Item.container.getThing(corpse, slot)
                    if not isInArray(configs.ids, corpseItem.itemid) then
                            slot = slot + 1
                    else
                            local iInfo, item.remove = game.item(corpseItem.itemid), true
                            if (iInfo.worth or 0) >= 1 then
                                    corpseMoney = corpseMoney + (corpseItem.type * iInfo.worth)
                            else
                                    item.remove = Player.addItem(cid, corpseItem.itemid, math.max(corpseItem.type, 1), false)
                            end
                            if item.remove then
                                    item.remove(corpseItem.uid)
                            end
                    end
            end
            corpseMoney = corpseMoney + Player.getMoney(cid)
            Player.removeMoney(cid, Player.getMoney(cid))
            Player.addMoney(cid, corpseMoney)
    end
   
    local name, pos = Creature.name(target), thing.position(target)
   
    callLater(gatherGold, 10, cid, getMonster(name).lookCorpse, pos)
   
return true
end

Can you help one last time?
 
yes, yes
I'm working on it.

There is no "worth" in 1.1 so you have to use workaround

back to your previous script and:
below
Code:
function onKill(cid, target)
add
Code:
cid = cid:getId()
target = target:getId()


replace
Code:
getMonsterInfo(name).lookCorpse
to
Code:
MonsterType(name):getCorpseId()


replace
Code:
getItemInfo(corpseItem.itemid)
to
Code:
((corpseItem.itemid == 2148 and 1) or (corpseItem.itemid == 2152 and 100) or (corpseItem.itemid == 2160 and 10000))


replace
Code:
iInfo.worth
to
Code:
iInfo

if you do that, post console errors if any appear
 
Last edited:
yes, yes
I'm working on it.

There is no "worth" in 1.1 so you have to use workaround

back to your previous script and:
below
Code:
function onKill(cid, target)
add
Code:
cid = cid:getId()
target = target:getId()


replace
Code:
getMonsterInfo(name).lookCorpse
to
Code:
MonsterType(name):getCorpseId()


replace
Code:
getItemInfo(corpseItem.itemid)
to
Code:
((corpseItem.itemid == 2148 and 1) or (corpseItem.itemid == 2152 and 100) or (corpseItem.itemid == 2160 and 10000))


replace
Code:
iInfo.worth
to
Code:
iInfo

if you do that, post console errors if any appear

Works perfectly!
Thank you for the great help!
 
I suggest the rewrite of an autoloot system, always tried to make it work and never succeeded lol (maybe a year ago xD)
 
you didn't register onDeath on monsters
see this:
https://otland.net/threads/tfs-1-1-extra-loot-system.230102/
bugs:
- I can add items to the list, or at least that is what the console says so: "22:13 you added the item wand of inferno in the list" but I can't see any item in my list when using the command
- I can spam /autoloot add,wand of inferno and it will spam "22:13 you added the item wand of inferno in the list", seems like talkaction need to be fixed since it is not checking anything lol
- it accept only "/autoloot add,itemname", but if there is a space like this: "/autoloot add, itemname"
- it doesn't support item by id
- my item list is always empty
 
As in thread title. Converting/optimising popular systems/events from older TFS to 1.0+. This is just a list, everyone can request/contribute, just post here and first post will be updated.

If you need certain event, but you can't find it, use CTRL+F (mac browser: function + F) and type its name.
If it's not there, you may post your request.

List of scripts:
If there is "(requested)" and there are no links, it means that no thread with that script/system/event was posted yet.
  1. events:
    - [TFS 1.x] Last Man Standing by nevix
    - [TFS 1.1] Rain Items by zbizu
    - (requested) capture the flag(CTF)
    - (requested) swim/firestorm event
    - (requested) zombie event
    - (requested) castle war
    - (requested) team/guild arena
    - (requested) rush/run event
    - (requested) survival-type arena event
  2. mini-games:
    - [TFS (any)] .::1-Row Slot Machine::. by cbrm
    - [TFS 1.x] Snake System by imkingran (based on Mock's)
    - [TFS 1.x] Tower Defense Event by Printer
    - [TFS 1.1] Monster Arena by Summ
    - (requested) bomberman
  3. custom server systems:
    - [TFS 1.x] Bounty Hunter System by imkingran
    - [TFS 1.1] "Catacombs" Teleporter - Great for RPG servers by Fresh
    - [TFS 1.x] Change Map by Printer (map changer for war servers)
    - [TFS 1.x] Crafting System by Colors
    - [TFS 1.1] Donation castle system by nevix
    - [TFS 1.1] Extra loot system by zbizu
    - [TFS 1.1] KD ratio by Ninja
    - [TFS 1.0] Marriage System by Godely
    - [TFS 1.1] onAdvance reward by zbizu
    - [TFS 1.1] Outfit Bonuses by Colors
    - [TFS 1.0] Potions System : Percents and Summons! by Codinablack
    - [TFS 1.x] Revive System by Colors
    - [TFS 1.1] Simple VIP System by nevix
    - [TFS 1.1] Skill Points, modalwindow by zbizu
    - [TFS 1.0] Skill Point System by Codinablack
    - [TFS 1.1] Teleporter spot (configurable price and storage) by zbizu
    - [TFS 1.1] Training anti-afk/sp limit by zbizu
    - [TFS 1.0] VIP System by Printer and Summ
    - (requested) pet system
    - (requested) reborn system
  4. ranks:
    - [TFS 1.1] !rank by zbizu
    - [TFS 1.1] Broadcasting TOP 5 fraggers by zbizu
    - (requested) weapon best hit rank
  5. common quests:
    - (requested) task system
    - (requested) poi
    - (requested) inq
    - (requested) oak
    - (requested) svargrond arena
  6. essentials
    - [TFS 1.1] Classic PVP Arena by zbizu
    - [TFS 1.x] First Items by javiKINGA
    - [TFS 1.1] Hot cuisine + improved diving by zbizu
    - [TFS 1.1] Improved tools system by zbizu
    - [TFS 1.1][10.76] Old MW sprite + timer by zbizu
    - [TFS 1.x] TP room text/effects by zbizu
  7. character/item upgrade systems:
    - [TFS 1.0] Advanced Item/Set Item Management by Giddran (old)
    - [TFS 1.1] Items upgrading (jewels) by zbizu (based on Azi's script)
    - [TFS 1.1] Random Item Stats by zbizu (based on Cykotitan's mod)
    - [TFS 1.1] Slot system by zbizu (based on Mock's script)
    - [TFS 1.1] Ultimate item stat system by zbizu (exp/loot ring, custom items lootable, elemental stats on weapons and armors)
  8. monsters / NPCs:
    - [TFS 1.1] Addon NPC (Varkhal) by zbizu
    - [TFS 1.1] Healer/blessings NPC by zbizu
    - [TFS 1.1] Thais Temple NPC Quentin BLESSER/HEALER/HELPER by danne3131
    - [TFS 1.x] Town NPC buff by Ninja
    - [TFS 1.1] Cat mages - insane custom AI example by zbizu
  9. player commands:
    - [TFS 1.0] !buyaddon "addon by Davidmemo
    - [TFS 1.1] !exp, !mana by zbizu
  10. admin/god tools:
    - [TFS 1.1] Jail / Unjail System by Summ
    - [TFS 1.1] Luascript channel by zbizu
    - [TFS 1.1] spyEq(cid, target), spyDepot(cid, target, town) by zbizu
    - [TFS 1.0] Talkaction / modalWindow group flags calculator by zbizu
    - [TFS 1.1] Teleport wand for admins by zbizu
    - [TFS 1.x][Event] Walkthrough everything Ctrl + Arrow keys by Printer
  11. functions, libs and compats:
    - [TFS 1.1] attributes functions from 0.3.7 by zbizu
    - [TFS 1.1] Items parser (useful for searching ids) by zbizu
    - [TFS 1.x] lib folder in "data" like 0.4 by zbizu (based on Limos's advice)
    - [TFS 1.1] Lua map generator (beta) by zbizu
    - [TFS 1.x] Player.setExhaustion, Player.getExhaustion by Printer
    - [TFS 1.x] Position.iterateArea by Crypton3 (execute tile function for specified area)
    - [TFS 1.x] Stop Movement by Printer
    - [TFS 1.x] Weather System by Printer
    - (requested) guild functions lib
  12. lists of functions, numbers and variables:
    - [TFS 1.0] LUA Functions List by TheChaos
    - [TFS 1.0] LUA Functions by cbrm
    - [TFS 1.x] Enums by Evan
    - [TFS 1.x] Talkaction to get metamethods by Jotran
    - [TFS 1.0] Spellid Generator by Codinablack
    - [client] Monster looktypes (go to last page for newest client looktypes)
  13. other:
    - [TFS 1.1] Fishing monsters by forgee
    - [TFS 1.1] Monster/spell/creaturescriptspack for 10.3+ by Moj Mistrz
    - [TFS 1.x] Simple Buy / Sell Shops by Jotran
    - [TFS 0.3+/1.1] Show Item Price onLook by Joe Rod (version for 1.1 in 7th post)
    - (requested) town guard npc (details: here)
    - (requested) guild extra exp time (details: here)
    - (requested) custom spells (details: here)
zbizu can u make for tfs 1.1 a script when i use key with id xxxx on the item with id xxxx i got teleported to a x position its possible? thanks mate^^
 
@zbizu I updated my Skill Point system to 1.1 on that threads main post. Not really worried about that one as everyone should use yours. However I also updated my potion system to 1.1 now, there are two versions on that thread, one for 1.0 and one for 1.1 so 1.x should be an appropriate prefix for that one, if you don't mind updating that on your list for, please and thank you.
 
If something works on 1.2 without any further changes please let me know about that so I'll update that thread.
 
You can add my scripts zbinzu =) tested and working with 1.2
 
Back
Top