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

Equipment Tables?

Joined
Jun 22, 2010
Messages
268
Solutions
1
Reaction score
5
Location
Usa, Utah
Im have no idea how tables work could someone help me out a little?

My goal is to put all my equipment sets in tables so lets say set 1 has + 5 magic on all items, and set 2 has +10
I want it to check for the equipment in your equipment slots.
so basically if you have helm, armor, and legs from set 1 it would be 5+5+5 = 15. Then we have boots and shield
from set 2. So 10+10 = 20. so the table would put out a total of 35..if someone would help that would be awesome.
Also is their any good guides explaining tables i've looked a lil bit havent seen any!
 
You explaind it a lil bit confusing. But I will try to understand your point :
- do you want define items that will give some specific skills after you equip them?
This is what I understood.
But you can can clarify it if I got it wrong. ^^
 
pretty much, i want it to check if your wearing the items so that if your wearing a full set you get the regular magic levels + a boost and if not you just get the regular magic levels!
 
Try this, just made it:
Lua:
function getPointsFromSlots(cid)
local items = {
			set1 = {
					xxxx,
					xxxx,
					xxxx,
					xxxx
					--IDS of set1
			},
			set2 = {
					yyyy,
					yyyy,
					yyyy,
					yyyy
					--IDS of set2
			},
			set3 = {
					zzzz,
					zzzz,
					zzzz,
					zzzz
					--IDS of set3
			}
}
local slots, sets, total = {}, { {},{},{} }, { {},{},{} }
for i = 1, 9 do
	if getPlayerSlotItem(cid,i) then
		table.insert(slots, getPlayerSlotItem(cid,i).itemid)
	end
end
for i = 1, #items.set1 do
	for s = 1, #slots do
		if items.set1[i] == slots[s] then
			table.insert(sets[1], items.set1[i])
		end
	end
end
for i = 1, #items.set2 do
	for s = 1, #slots do
		if items.set2[i] == slots[s] then
			table.insert(sets[2], items.set2[i])
		end
	end
end
for i = 1, #items.set3 do
	for s = 1, #slots do
		if items.set3[i] == slots[s] then
			table.insert(sets[3], items.set3[i])
		end
	end
end
for i = 1, 3 do
	total[i] = #sets[i]*(i == 1 and 5 or i == 2 and 10 or 15)
end
value = total[1]+total[2]+total[3]
return value
end
 
Last edited:
Hey, bumping this up for ya since I got no time, the function is 100% fully working now, try to get some help for the script stuff, I'm sorry I ain't got time, cya :)
 
Back
Top Bottom