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:
belowaddCode:function onKill(cid, target)
Code:cid = cid:getId() target = target:getId()
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>
0.4 and pre metatables data
getItemInfo and similiar functions need to be rewritten manually
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
function onKill(cid, target)
cid = cid:getId()
target = target:getId()
getMonsterInfo(name).lookCorpse
MonsterType(name):getCorpseId()
getItemInfo(corpseItem.itemid)
((corpseItem.itemid == 2148 and 1) or (corpseItem.itemid == 2152 and 100) or (corpseItem.itemid == 2160 and 10000))
iInfo.worth
iInfo
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:
belowaddCode:function onKill(cid, target)
Code:cid = cid:getId() target = target:getId()
replace
toCode:getMonsterInfo(name).lookCorpse
Code:MonsterType(name):getCorpseId()
replace
toCode:getItemInfo(corpseItem.itemid)
Code:((corpseItem.itemid == 2148 and 1) or (corpseItem.itemid == 2152 and 100) or (corpseItem.itemid == 2160 and 10000))
replace
toCode:iInfo.worth
Code:iInfo
if you do that, post console errors if any appear
https://otland.net/threads/autoloot-for-tfs-1-0.213831/@Evil Puncker
post a link to old script
bugs:you didn't register onDeath on monsters
see this:
https://otland.net/threads/tfs-1-1-extra-loot-system.230102/
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^^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.
- 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
- 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
- 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
- ranks:
- [TFS 1.1] !rank by zbizu
- [TFS 1.1] Broadcasting TOP 5 fraggers by zbizu
- (requested) weapon best hit rank
- common quests:
- (requested) task system
- (requested) poi
- (requested) inq
- (requested) oak
- (requested) svargrond arena
- 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
- 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)
- 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
- player commands:
- [TFS 1.0] !buyaddon "addon by Davidmemo
- [TFS 1.1] !exp, !mana by zbizu
- 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
- 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
- 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)
- 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)
added scripts from your signatureYou can add my scripts zbinzu =) tested and working with 1.2