• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

limit your skills to a certain level range. [level 1 - 49 max 50 shielding].

Znote

<?php echo $title; ?>
Staff member
Global Moderator
Premium User
Joined
Feb 14, 2008
Messages
7,037
Solutions
256
Reaction score
2,138
Location
Norway
GitHub
Znote
Hello. I had an idea to avoid low lvl training mc farms.

Sample:
Paladins from level 1 - 49 can get maximum of 55 distance/shielding skill.
Paladins from level 50 - 100 can get maximum of 85 distance/shielding skill.

Knights from level 1 - 49 can get maximum of 50 sword/club/axe fighting, max 60 shielding.

And so on.

Any help highly appreciated. Rep will be gained to all who applies helpful sample codes.
 
you can try this but im not sure if it works: (I dont tested)
LUA:
function onThink(cid, interval)
local players = getOnlinePlayers()
for _, pid in ipairs(players) do
--CONFIG
local vocations = {

		[1] = {
			[50] = {maxClub = 60, maxAxe = 60, maxSword = 60, maxDistance = 60, maxML = 60, maxShield = 60},
			[100] = {maxClub = 60, maxAxe = 60, maxSword = 60, maxDistance = 60, maxML = 60, maxShield = 60}
			},
		[2] = {
			[50] = {maxClub = 60, maxAxe = 60, maxSword = 60, maxDistance = 60, maxML = 60, maxShield = 60},
			[100] = {maxClub = 60, maxAxe = 60, maxSword = 60, maxDistance = 60, maxML = 60, maxShield = 60}
			},
		[3] = {
			[50] = {maxClub = 60, maxAxe = 60, maxSword = 60, maxDistance = 60, maxML = 60, maxShield = 60},
			[100] = {maxClub = 60, maxAxe = 60, maxSword = 60, maxDistance = 60, maxML = 60, maxShield = 60}
			},
		[4] = {
			[50] = {maxClub = 60, maxAxe = 60, maxSword = 60, maxDistance = 60, maxML = 60, maxShield = 60},
			[100] = {maxClub = 60, maxAxe = 60, maxSword = 60, maxDistance = 60, maxML = 60, maxShield = 60}
			},
		[5] = {
			[50] = {maxClub = 60, maxAxe = 60, maxSword = 60, maxDistance = 60, maxML = 60, maxShield = 60},
			[100] = {maxClub = 60, maxAxe = 60, maxSword = 60, maxDistance = 60, maxML = 60, maxShield = 60}
			},
		[6] = {
			[50] = {maxClub = 60, maxAxe = 60, maxSword = 60, maxDistance = 60, maxML = 60, maxShield = 60},
			[100] = {maxClub = 60, maxAxe = 60, maxSword = 60, maxDistance = 60, maxML = 60, maxShield = 60}
			},
		[7] = {
			[50] = {maxClub = 60, maxAxe = 60, maxSword = 60, maxDistance = 60, maxML = 60, maxShield = 60},
			[100] = {maxClub = 60, maxAxe = 60, maxSword = 60, maxDistance = 60, maxML = 60, maxShield = 60}
			},
		[8] = {
			[50] = {maxClub = 60, maxAxe = 60, maxSword = 60, maxDistance = 60, maxML = 60, maxShield = 60},
			[100] = {maxClub = 60, maxAxe = 60, maxSword = 60, maxDistance = 60, maxML = 60, maxShield = 60}
			}
			
} 
local t = vocations[getPlayerVocation(pid)]
local te = vocations[getPlayerVocation(pid)][getPlayerLevel(pid)]
				if t then	
					if te then
						local forr = {
								[1] = {1},
								[2] = {2},
								[3] = {3},
								[4] = {4},
								[5] = {5},
								[6] = {6},
								[7] = {7},
								[8] = {8}
						}
						for i = 1,#forr do 
							if getPlayerSkillLevel(pid,forr[i][1]) == te[forr[i][1]] then
								doPlayerAddSkillTry(cid,forr[i][1] , -1)
								doPlayerSendCancel(cid, "You cannot up more.")
							end
						end
					end
				end
		end
	return true
end
 
Nice idea....

I guess the most proper way would be a source edit, however you could surely work something out in Lua but I'd rather not...
 
Nice idea....

I guess the most proper way would be a source edit, however you could surely work something out in Lua but I'd rather not...
I don't want to restrict the skill training in front of training monks only. But on general basis[If you are below level xx, you can NOT get higher than xx in skill fighting]. (If this makes it easier to script).
Ofc, having sword fighting 50/50, and wearing a sword ring witch results in 54/50, or keeps it 50/50 dosn't matter. Want to just go the easiest way. Lua is preferred even though it might have to use some extra things witch wouldn't be necessary by source edits.

We have no problems accepting c++ scripts. So if you got some tricks and samples please provide. :D
lua is easier to submit. But still compiling on Linux is piece of cake.
@KylerXX Thanks! I'll look at your structure later. I'm sure I will find it very useful!
 
Does removing skill tries even work?
Code:
void Player::addSkillAdvance(skills_t skill, [B][COLOR="red"]u[/COLOR][COLOR="blue"]int32_t[/COLOR] count[/B], bool useMultiplier/* = true*/)
Also you can't return false in onAdvance, so source edit is probably a must. :p
 
Kind of improvisation in Lua:
Code:
local function hasSkillAbove(cid, level)
	for i = SKILL_FIRST, SKILL_AXE do
		if getPlayerSkillLevel(cid, i) >= level
			return true
		end
	end
	return false
end

function onAttack(cid, target)
	if getCreatureName(target):lower() ~= 'training monk' then
		return true
	end

	if isPaladin(cid) then
		if getPlayerLevel(cid) < 50 and getPlayerSkillLevel(cid, SKILL_DISTANCE) >= 55 then
			return false
		elseif (getPlayerLevel(cid) >= 50 and getPlayerLevel(cid) < 100) and getPlayerSkillLevel(cid, SKILL_DISTANCE) >= 85 then
			return false
		end
	elseif isKnight(cid) then
		if getPlayerLevel(cid) < 50 and hasSkillAbove(cid, 50) then
			return false
		end
	end

	return true
end
 
Does removing skill tries even work?
Code:
void Player::addSkillAdvance(skills_t skill, [B][COLOR="red"]u[/COLOR][COLOR="blue"]int32_t[/COLOR] count[/B], bool useMultiplier/* = true*/)
Also you can't return false in onAdvance, so source edit is probably a must. :p

Thanks for helping me find a relevant spot in the sources.
Probably a must? Isn't it possible (Would be rather heavy, but still possible) To check all players skills and level every etc (each char random between 45 - 60 sec), check the chars skills compare to level and reset the skill to max allowed for him?
Randomly check between 45 - 60 seconds would be to anti lag the server, so it dosnt check absolutely all chars at exactly same time, so the processor can breathe a bit more).

This might result in players having 1+ more skill than allowed temporarily, (or more if high skillrate) but will reset it down.

And thanks Chojrak, for your version. :D
Think it will work?
 
Well, if I didn't do any spelling, it should work, but it doesn't work exactly as you wanted, it prevents people with higher skills against attacking Training Monk.
 
Ahh yeah. Its very good for anti lowbie training in training room. But does not fit my situation. :P
 
I would create a lua function in C++ called like setMaxSkillLevel(cid, skill_id, value) and then in sources it would check if he can get skill tries by checking that one....... onLogin/onAdvance (skill) it would update his max skill level each time........ might be a bit complicated but is probably the most efficient way
 
Hey im looking for someone who knows how to C++ This! I work with Znote and we need it asap! We can add it if you can script it! Willing to pay
 
Back
Top