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

Slot System (Magic Level)

God Mythera

Veteran OT User
Joined
Aug 11, 2012
Messages
2,051
Solutions
2
Reaction score
260
Location
United States
So i am using the slot system for tfs 1.0 an it works with (hp, mana, shielding, melee, distance, speed) but it doesnt work with (ml) could someone maybe tell me if there is something wrong? It is just like the other scripts just for a different stat

Code:
local conf = {
maxSlotCount=1,
ignoredIds={}
}

function choose(...)
  local arg = {...}
  return arg[math.random(1,#arg)]
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
  if item.uid == 0 or item.itemid == 0 then return false end
  toPosition.stackpos = 255
  if isInArray(conf.ignoredIds, itemEx.itemid) or
  isItemStackable(itemEx.uid) or
  itemEx.itemid == 0 or
  itemEx.type > 1 or
  not(isArmor(itemEx.uid) or isWeapon(itemEx.uid) or isShield(itemEx.uid)) then
  return false
  end
  if isCreature(itemEx.uid) then
  return false
  end
  local nam = Item(itemEx.uid):getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
  function getper()
  local n = 1
  for i=10,15 do
  n = n+math.random(1,12)
  if n < 8*i then
  break
  end
  end
  return n
  end
  function getSlotCount(nam)
  local c = 0
  for _ in nam:gmatch('%[(.-)%]') do
  c = c+1
  end
  return c
  end
  if getSlotCount(nam) < conf.maxSlotCount then
  local l = choose('ml')
  local p = getper()
  doSendMagicEffect(toPosition,30)
  nam = nam..' ['..l..'.+'..p..'%]'
  doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,l..'.+'..p..'%')
  doSetItemSpecialDescription(itemEx.uid, nam)
  doRemoveItem(item.uid,1)
  else
  doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"Slot limit reached.")
  end
  return true
end
 
Last edited:
People who want to host a tibia server with a donation shop, then come here every day asking members to do their work for them without any will to learn is what is wrong with the community.. But that's just my opinion.
 
People who want to host a tibia server with a donation shop, then come here every day asking members to do their work for them without any will to learn is what is wrong with the community.. But that's just my opinion.

I cannot get a dedicated host because i dont get paid untill next month, then i will be getting a host. I make threads in support because isnt that what it is for, support? But what i have to deal with is people commenting on my posts trying to be a smartass when all i ask for is help, if someone else needed help and i knew how to do that i would help them. And also sometimes if i need help with a script that is to hard i offer to pay, and i do learn i watch them fix the problem and that is how i learn. I do not have time to try to fix a script and do multiple tests because yes i do have my server hosted on my pc so it is impossible to do multiple tests risking to bug the server or make it crash. And some people do help me and i do thank them for that, if people are respectful to me i am respectful back but that person 'Omni Cloud' has not once tried to show me respect, he only follows me stalks me and comments on my posts trying to be a smartass then says people like me is what makes the community bad? What makes the community bad is trolls aka 'Omni Cloud' all he has been doing for the past couple of threads i have made is stalk me and comment a bunch of nonsense. All i ask from otland is a little support, people who have time to do this. I have never once on this forum tried to be a smartass for a member posting in support/request board trying to get help. And i even try to help people when i can but when i want help back i am an asshole? Maybe if this person didnt stalk me on all the threads i make and make stupid comments i wouldnt have to call him an asshole.

edit: I have also been a active member since December 12h, 2010 and this is the first time i have dealt with someone so immature to be stalking someone and commenting on all his posts. I dont see why posting in the Support/Request board is such a bad thing, because i dont wanna try to learn it for myself? I'd rather watch someone else fix the problem and learn that way instead of trying it for myself and messing up my server. I have also been actively working on my server for almost a year (11~ months) and i might have a 'Donation Shop' but pretty much EVERY item is obtainable in game. And when i first made it i didnt even have a shop but players wanted me to add one, so i did. And i also give players free points for leveling and for reporting bugs, and they have enough points to get the items that they want. But yet there are hundreds of servers who only host there server for money, yet i host my server as a hobby, for fun, and people talk crap about my server. The people who have played my server 9/10 say it is a amazing server and there are people who play it every day. I have even had a few people who were inactive for 5+ years and they choose to play my server, which makes me feel good because they choose my server out of the hundreds of servers out there.

People who want to host a tibia server with a donation shop, then come here every day asking members to do their work

This is also funny because i have only maybe made a few threads in the past month or so asking for support yet there are kids who post like 30+ threads per month and yet no one trys to say stuff like that to them, but i make what 2-4 threads in a month for support/request and i am a bad guy.
 
Last edited:
I make a comment in 1 thread in requests and all of a sudden I am a stalker.
https://otland.net/threads/request-addons-mounts-shop-system.243578/#post-2364420

I don't know why you refer to me as he it clearly says I am a female. ;)
NeRzElw.png
 
This is also funny because i have only maybe made a few threads in the past month or so asking for support yet there are kids who post like 30+ threads per month and yet no one trys to say stuff like that to them, but i make what 2-4 threads in a month for support/request and i am a bad guy.
this is not the point, years ago when this thread was created were here to help people because only few OT servers had someway to earn money from it, so people used to host servers for fun, different of nowadays most of server owners only leech codes from forums and tfs project earn money from it and doesnt seed a single line of code back or place bounty to issues, im not against you making money from your server, but like any other self-employment you can do in life you need to bet your time and money on it, no one will do your work for free, unfortunately this community is dying by itself because of that.
 
this is not the point, years ago when this thread was created were here to help people because only few OT servers had someway to earn money from it, so people used to host servers for fun, different of nowadays most of server owners only leech codes from forums and tfs project earn money from it and doesnt seed a single line of code back or place bounty to issues, im not against you making money from your server, but like any other self-employment you can do in life you need to bet your time and money on it, no one will do your work for free, unfortunately this community is dying by itself because of that.
Yes i dont mind paying someone to help me, and i barely make money on my server. If i wanted to i could just take shop off but people will just want me to add it back because i give free points every friday to players. I just hate it when people who dont even run ots or work on them comment on my threads saying why should they help me for free? Because i post on the support/request for help, if people wanna make money for something that takes them 1-5 minutes then i can pay, but it wont be alot. And i dont see why people have to make stupid comments when they can just leave? They see me as an asshole but when they comment something stupid on my post ofc i am gonna be a smartass back. I am just tired of this guy stalking me commenting on every post i make and i think he think it makes him feel good, when really he just makes himself look like a smartass.
 
Yes i dont mind paying someone to help me, and i barely make money on my server. If i wanted to i could just take shop off but people will just want me to add it back because i give free points every friday to players. I just hate it when people who dont even run ots or work on them comment on my threads saying why should they help me for free? Because i post on the support/request for help, if people wanna make money for something that takes them 1-5 minutes then i can pay, but it wont be alot. And i dont see why people have to make stupid comments when they can just leave? They see me as an asshole but when they comment something stupid on my post ofc i am gonna be a smartass back. I am just tired of this guy stalking me commenting on every post i make and i think he think it makes him feel good, when really he just makes himself look like a smartass.
The matter of my opinion is all 'bout most of hundred percent of server owners leech everything, violate licenses and after all come to support boards to fix their badly made code, im not saying thats you, when i get home i can take a look at the code, just dont be another server owner asshole like 99% of them.
 
The matter of my opinion is all 'bout most of hundred percent of server owners leech everything, violate licenses and after all come to support boards to fix their badly made code, im not saying thats you, when i get home i can take a look at the code, just dont be another server owner asshole like 99% of them.
Oh trust me im not a leech, i even give players chance to get free points. In the past 3 weeks i have made maybe 10$. At the moment i am trying to save up for a host (30 Euros) so that players can have fun and play with 0 lags. If i cant get it by the end of month i will end up buying a 5 month host anyways. Out of my own pocket. Like i said i only do this as a hobby, i dont even see why the script for ML doesnt work because the others work 100% (Health, Mana, Melee, Distance, Shielding, Speed).
 
Oh trust me im not a leech, i even give players chance to get free points. In the past 3 weeks i have made maybe 10$. At the moment i am trying to save up for a host (30 Euros) so that players can have fun and play with 0 lags. If i cant get it by the end of month i will end up buying a 5 month host anyways. Out of my own pocket. Like i said i only do this as a hobby, i dont even see why the script for ML doesnt work because the others work 100% (Health, Mana, Melee, Distance, Shielding, Speed).
actually i dont mind how your system works if its fair or something, who judge this is your players, i dont mind helping projects like yours, my point is against this kind of people (https://github.com/otland/forgottenserver/pull/994), some of them has servers that up to 700 players online asking for fixes but they cant even send a profiling data for that pr.
on topic, this is the only file of your system? seems like is all okay with file that you provide.
 
Last edited:
actually i dont mind how your system works if its fair or something, who judge this is your players, i dont mind helping projects like yours, my point is against this kind of people (https://github.com/otland/forgottenserver/pull/994), some of them has servers that up to 700 players online asking for fixes but they cant even send a profiling data for that pr.
on topic, this is the only file of your system? seems like is all okay with file that you provide.
Well i also have the creaturescript, i could post it if you want? But i will post it anyways below ^^

Code:
local conditionMP,conditionHP,conditionML,conditionCLUB,conditionSHI,conditionDIST,conditionAMP = {},{},{},{},{},{},{}
for i=1,300 do
  conditionHP[i] = createConditionObject(CONDITION_ATTRIBUTES)
  setConditionParam(conditionHP[i], CONDITION_PARAM_SUBID, 50)
  setConditionParam(conditionHP[i], CONDITION_PARAM_BUFF_SPELL, 1)
  setConditionParam(conditionHP[i], CONDITION_PARAM_TICKS, -1)
  setConditionParam(conditionHP[i], CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT, 100+i)

  conditionMP[i] = createConditionObject(CONDITION_ATTRIBUTES)
  setConditionParam(conditionMP[i], CONDITION_PARAM_SUBID, 51)
  setConditionParam(conditionMP[i], CONDITION_PARAM_BUFF_SPELL, 1)
  setConditionParam(conditionMP[i], CONDITION_PARAM_TICKS, -1)
  setConditionParam(conditionMP[i], CONDITION_PARAM_STAT_MAXMANAPOINTSPERCENT, 100+i)

  conditionML[i] = createConditionObject(CONDITION_ATTRIBUTES)
  setConditionParam(conditionML[i], CONDITION_PARAM_SUBID, 52)
  setConditionParam(conditionML[i], CONDITION_PARAM_BUFF_SPELL, 1)
  setConditionParam(conditionML[i], CONDITION_PARAM_TICKS, -1)
  setConditionParam(conditionML[i], CONDITION_PARAM_STAT_MAGICLEVELPERCENT, 100+i)


  conditionCLUB[i] = createConditionObject(CONDITION_ATTRIBUTES)
  setConditionParam(conditionCLUB[i], CONDITION_PARAM_SUBID, 53)
  setConditionParam(conditionCLUB[i], CONDITION_PARAM_BUFF_SPELL, 1)
  setConditionParam(conditionCLUB[i], CONDITION_PARAM_TICKS, -1)
  setConditionParam(conditionCLUB[i], CONDITION_PARAM_SKILL_MELEEPERCENT, 100+i)


  conditionSHI[i] = createConditionObject(CONDITION_ATTRIBUTES)
  setConditionParam(conditionSHI[i], CONDITION_PARAM_SUBID, 54)
  setConditionParam(conditionSHI[i], CONDITION_PARAM_BUFF_SPELL, 1)
  setConditionParam(conditionSHI[i], CONDITION_PARAM_TICKS, -1)
  setConditionParam(conditionSHI[i], CONDITION_PARAM_SKILL_SHIELDPERCENT, 100+i)

  conditionDIST[i] = createConditionObject(CONDITION_ATTRIBUTES)
  setConditionParam(conditionDIST[i], CONDITION_PARAM_SUBID, 55)
  setConditionParam(conditionDIST[i], CONDITION_PARAM_BUFF_SPELL, 1)
  setConditionParam(conditionDIST[i], CONDITION_PARAM_TICKS, -1)
  setConditionParam(conditionDIST[i], CONDITION_PARAM_SKILL_DISTANCEPERCENT, 100+i)
end

function getSlotType(n)
  if not n then
  return false
  end
  if n:match('%[(.+)%]') then
  n = n:match('%[(.+)%]')
  if n == '?' then
  return 0,n
  else
  return n:match('(.-)%.([+-])(%d+)%%')
  end
  else
  return false
  end
end

local function loadSet(cid)
  local t = {}
  for slot=1,9 do
  t[slot] = ''
  local s = getPlayerSlotItem(cid,slot).uid
  if s ~= 0 then
  t[slot] = Item(s):getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
  end
  end
  return t
end

function chk(cid,f)
  if not isPlayer(cid) then return false end
  local t = loadSet(cid)
  for i=1,#f do
  if f[i] ~= t[i] then
  equip(cid,nil,slot)
  break
  end
  end
  addEvent(chk,2000,cid,t)
end

function check_slot(aab, i)
  if i == 5 or i == 6 then
  if isWeapon(aab) or isShield(aab) or isBow(aab) then
  return true
  end
  else
  return true
  end
return false
end

function equip(cid,item,slot)
  local t = {}
  if item then
  local mm,sinal,qto = getSlotType(Item(item.uid):getAttribute(ITEM_ATTRIBUTE_DESCRIPTION))
  t[mm] = tonumber(qto)
  end
  for i=1,9 do
  if i ~= slot then
  if getPlayerSlotItem(cid,i).itemid ~= 0 then
  local aab = getPlayerSlotItem(cid,i).uid
  if aab and check_slot(aab,i) then
  for _ in Item(aab):getAttribute(ITEM_ATTRIBUTE_DESCRIPTION):gmatch('(%[.-%])') do
  local mm,sinal,qto2 = getSlotType(_)
  if mm then
  if not t[mm] then
  t[mm] = 0
  end
  t[mm] = t[mm]+tonumber(qto2)
  t[mm] = t[mm] > 300 and 300 or t[mm]
  end
  end
  end
  end
  end
  end
  local fu = 0
  local ca = {}
  local s = ''
  for sl,n in pairs(t) do
  fu = fu+1
  s = s..''..n..'% more of '..sl..'\n'
  if sl == 'hp' then
  doAddCondition(cid,conditionHP[tonumber(n)])
  Player(cid):addHealth(Player(cid):getMaxHealth() - Player(cid):getHealth())
  ca[50] = 1
  doSendTutorial(cid,19)
  elseif sl == 'mp' then
  doAddCondition(cid,conditionMP[tonumber(n)])
  Player(cid):addMana(Player(cid):getMaxMana() - Player(cid):getMana())
  ca[51] = 1
  doSendTutorial(cid,19)
  elseif sl == 'ml' then
  doAddCondition(cid,conditionML[tonumber(n)])
  ca[52] = 1
  elseif sl == 'melee' then
  doAddCondition(cid,conditionCLUB[tonumber(n)])
  ca[53] = 1
  elseif sl == 'shield' then
  doAddCondition(cid,conditionSHI[tonumber(n)])
  ca[54] = 1
  elseif sl == 'dist' then
  doAddCondition(cid,conditionDIST[tonumber(n)])
  ca[55] = 1
  end
  end
  if fu > 0 then
  for i=50,55 do
  if not ca[i] then
  doRemoveCondition(cid,CONDITION_ATTRIBUTES,i)
  end
  end
  else
  for i=50,55 do
  doRemoveCondition(cid,CONDITION_ATTRIBUTES,i)
  end
  end
  return true
end

function onLogin(cid)
  equip(cid,nil,slot)
  addEvent(chk,2000,cid,loadSet(cid))
  return true
end
 
When i equip the item with ml% my ml wont go up, i even put the ml at 30 and the set is atleast a 20% bonus but wont go up, it also gives no errors in console :S
could you test this script in version that it was suppose to be? i believe compat.lua could be missing something.
 
could you test this script in version that it was suppose to be? i believe compat.lua could be missing something.
It is suppose to work for 1.0 which is what i am usin :p i am just confused how the other slots work just not ML. Also if it makes sense ML worked as the full slot system script, with all the slot stats in one script. for example:

Code:
local conf = {
maxSlotCount=2,
ignoredIds={}
}

function choose(...)
  local arg = {...}
  return arg[math.random(1,#arg)]
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
  if item.uid == 0 or item.itemid == 0 then return false end
  toPosition.stackpos = 255
  if isInArray(conf.ignoredIds, itemEx.itemid) or
  isItemStackable(itemEx.uid) or
  itemEx.itemid == 0 or
  itemEx.type > 1 or
  not(isArmor(itemEx.uid) or isWeapon(itemEx.uid) or isShield(itemEx.uid)) then
  return false
  end
  if isCreature(itemEx.uid) then
  return false
  end
  local nam = Item(itemEx.uid):getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
  function getper()
  local n = 1
  for i=10,15 do
  n = n+math.random(1,7)
  if n < 8*i then
  break
  end
  end
  return n
  end
  function getSlotCount(nam)
  local c = 0
  for _ in nam:gmatch('%[(.-)%]') do
  c = c+1
  end
  return c
  end
  if getSlotCount(nam) < conf.maxSlotCount then
  local l = choose('hp','mp','ml','melee','shield','dist','speed')
  local p = getper()
  doSendMagicEffect(toPosition,30)
  nam = nam..' ['..l..'.+'..p..'%]'
  doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,l..'.+'..p..'%')
  doSetItemSpecialDescription(itemEx.uid, nam)
  doRemoveItem(item.uid,1)
  else
  doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"Slot limit reached.")
  end
  return true
end
 
It is suppose to work for 1.0 which is what i am usin :p i am just confused how the other slots work just not ML. Also if it makes sense ML worked as the full slot system script, with all the slot stats in one script. for example:
its not, it just work on tfs 1.x because of data/lib/compat/compat.lua.
 
Back
Top