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

Auto Gold/Loot - 0 Errors

Ascuas Funkeln

Rakkedo Game
Joined
Apr 14, 2013
Messages
549
Solutions
32
Reaction score
305
Location
Poland
GitHub
AscuasFunkeln
Server: The Forgotten Server - version 0.3.6 - Edited By Cyko V8 Crying Damson

Hello, after solve problem with stamina modify and 2x exp i stuck in another situation xD

I want make Autoloot everything without any commands or other shits, just login to game and when u kill mob u collect instantly all items (without open if possible).

I start to make auto gold, i find this script on otland, but its not working for me:
Lua:
local function doPlayerAddContainerMoney(cid, container, gold)
  local extrac = 0
  for slot = (getContainerSize(container) - 1), 0, -1 do
  local item = getContainerItem(container, slot)
  local amount = (item.itemid == 2148 and item.type or (item.itemid == 2152 and item.type * 100 or (item.itemid == 2160 and item.type * 10000)) or 0)
  if item.uid > 0 then
  if amount > 0 then
  gold = gold + amount
  doRemoveItem(item.uid)
  end
  end
  if isContainer(item.uid) then
  extrac = item.uid
  end
  end
  if extrac > 0 then
  doPlayerAddContainerMoney(cid, extrac, gold)
  else
  doPlayerAddMoney(cid, gold)
  end 
end
  
local function autoloot(cid, position, corpseID)
  if not isPlayer(cid) then
  return
  end
  local corpse = getTileItemById(position, corpseID)
  if corpse and isContainer(corpse.uid) then
  doPlayerAddContainerMoney(cid, corpse.uid, 0) 
  end
end
function onKill(cid, target)
  if isPlayer(target) then
  return true
  end
  local position = getCreaturePosition(target)
  local info = getMonsterInfo(getCreatureName(target))
  addEvent(autoloot, 100, cid, position, info.lookCorpse)
  return true
end

And i think why this not work?
I make something like that for test:
Lua:
function onKill(cid, target)
            doPlayerSendTextMessage(cid, 22, "Mob Killed.")
end
And this not work, like function "onKill" not working (Same problem i have with function onThink) or im Epic Handicap and i should go play Lego xD
 
Server: The Forgotten Server - version 0.3.6 - Edited By Cyko V8 Crying Damson

Hello, after solve problem with stamina modify and 2x exp i stuck in another situation xD

I want make Autoloot everything without any commands or other shits, just login to game and when u kill mob u collect instantly all items (without open if possible).

I start to make auto gold, i find this script on otland, but its not working for me:
Lua:
local function doPlayerAddContainerMoney(cid, container, gold)
  local extrac = 0
  for slot = (getContainerSize(container) - 1), 0, -1 do
  local item = getContainerItem(container, slot)
  local amount = (item.itemid == 2148 and item.type or (item.itemid == 2152 and item.type * 100 or (item.itemid == 2160 and item.type * 10000)) or 0)
  if item.uid > 0 then
  if amount > 0 then
  gold = gold + amount
  doRemoveItem(item.uid)
  end
  end
  if isContainer(item.uid) then
  extrac = item.uid
  end
  end
  if extrac > 0 then
  doPlayerAddContainerMoney(cid, extrac, gold)
  else
  doPlayerAddMoney(cid, gold)
  end
end
 
local function autoloot(cid, position, corpseID)
  if not isPlayer(cid) then
  return
  end
  local corpse = getTileItemById(position, corpseID)
  if corpse and isContainer(corpse.uid) then
  doPlayerAddContainerMoney(cid, corpse.uid, 0)
  end
end
function onKill(cid, target)
  if isPlayer(target) then
  return true
  end
  local position = getCreaturePosition(target)
  local info = getMonsterInfo(getCreatureName(target))
  addEvent(autoloot, 100, cid, position, info.lookCorpse)
  return true
end

And i think why this not work?
I make something like that for test:
Lua:
function onKill(cid, target)
            doPlayerSendTextMessage(cid, 22, "Mob Killed.")
end
And this not work, like function "onKill" not working (Same problem i have with function onThink) or im Epic Handicap and i should go play Lego xD
Do you register the onKill event when the player login to the game?
Edit:
Do you really need to use onThink for this system? since it should only be executed once you kill a monster anyway

Inside login.lua you have to add something like this
Lua:
registerCreatureEvent(cid, "nameOfTheEventToLoad")
 
Last edited:
You are the boss~! xD Work perfect!
Now i just need make this gold stacking, i already make this changes in sources (That i find on this site) but this need compile to start working right?(Correct me if i wrong, im new with scripting etc.xD). Already i think, its not sense making compile for one thing. But im read already all threads about this and probably its the only one option to solve this problem.

Already i still need to make Autoloot for everything. Now im starting make some modify in this gold script, we will see! xD But feel free in help me with this on this thread, about loot everything and stacking :D
 
You are the boss~! xD Work perfect!
Now i just need make this gold stacking, i already make this changes in sources (That i find on this site) but this need compile to start working right?(Correct me if i wrong, im new with scripting etc.xD). Already i think, its not sense making compile for one thing. But im read already all threads about this and probably its the only one option to solve this problem.

Already i still need to make Autoloot for everything. Now im starting make some modify in this gold script, we will see! xD But feel free in help me with this on this thread, about loot everything and stacking :D
If you made changes to the source code you have to compile it to make it work, since that code is contained inside the exe file (if compiled on windows)
It does make sense to compile for one edit in the source code if you want the code to start work right away :D
Im sure it's possible to make a lua script to autostack the gold aswell, but if you already made the changes in the source code i would recommend to use that method instead.

I wish you good luck whit the rest of the script, and hopefully some usefull help if you run in to any problems.
 
Already im after compiling, i edit source with autostacking + change skills names on advanced, with tutorial compiling is not hard thing :p
Everything works perfect! Now i just have to edit autogold for autoeverything :D
 
Back
Top