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

CreatureEvent Skills & magic level stages

Gesior.pl

Mega Noob&LOL 2012
Senator
Joined
Sep 18, 2007
Messages
2,968
Solutions
99
Reaction score
3,384
Location
Poland
GitHub
gesior
If boters on your server make mlvl/skill 100 at night and you cant catch them it should be useful. You can 'limit' mlvl/skill to dont let cheaters get 100-120 mlvl/skill, but normal players can easy get 60-80 skill.
In game it show rate from config.lua * rate from stages
Skill (sword) stages:
(sword rate change on lvl 12, 14 [config])
11:42 Welcome to the Forgotten Server!
11:42 Your last visit was on Mon Sep 07 10:57:08 2009.

11:42 YOUR RATES: [ Magic Level: 30x || Fist: 15x | Club: 15x | Sword: 15x | Axe: 15x | Distance: 15 | Shielding: 27x | Fishing: 3x ]
11:42 You advanced in sword fighting.
11:42 You advanced in sword fighting.

11:42 sword fighting rate changed from 15x to 12x. YOUR RATES: [ Magic Level: 30x || Fist: 15x | Club: 15x | Sword: 12x | Axe: 15x | Distance: 15 | Shielding: 27x | Fishing: 3x ]
11:43 You advanced in sword fighting.
11:43 You advanced in sword fighting.

11:43 sword fighting rate changed from 12x to 9x. YOUR RATES: [ Magic Level: 30x || Fist: 15x | Club: 15x | Sword: 9x | Axe: 15x | Distance: 15 | Shielding: 27x | Fishing: 3x ]
Magic level stages:
11:45 YOUR RATES: [ Magic Level: 30x || Fist: 24x | Club: 24x | Sword: 24x | Axe: 24x | Distance: 24 | Shielding: 27x | Fishing: 3x ]
11:45 You advanced to magic level 1.
...
11:45 You advanced to magic level 6.

11:45 magic level rate changed from 30x to 15x. YOUR RATES: [ Magic Level: 15x || Fist: 24x | Club: 24x | Sword: 24x | Axe: 24x | Distance: 24 | Shielding: 27x | Fishing: 3x ]
11:45 You advanced to magic level 7.
...
11:45 You advanced to magic level 15.

11:45 magic level rate changed from 15x to 12x. YOUR RATES: [ Magic Level: 12x || Fist: 24x | Club: 24x | Sword: 24x | Axe: 24x | Distance: 24 | Shielding: 27x | Fishing: 3x ]
11:45 You advanced to magic level 16.
In data\creaturescripts\scripts\ create file stagesconfig.lua and paste:
PHP:
skillConfig = {skill = getConfigValue('rateSkill'), magiclevel = getConfigValue('rateMagic')}
skillStages = {}
skillStages[SKILL_FIST] = {{0,8},{60,5},{80,3},{100,2}}
skillStages[SKILL_CLUB] = {{0,8},{60,5},{80,2},{100,1}}
skillStages[SKILL_SWORD] = {{0,8},{60,5},{80,2},{100,1}}
skillStages[SKILL_AXE] = {{0,8},{60,5},{80,2},{100,1}}
skillStages[SKILL_DISTANCE] = {{0,8},{60,5},{80,2},{100,1}}
skillStages[SKILL_SHIELD] = {{0,9},{60,8},{80,7},{100,6},{110,3}}
--skillStages[SKILL_FISHING] = {{0,5},{60,4},{80,3},{100,2},{110,1}} -- uncomment it to make it work, you can remove other skill config if you dont need it
skillStages[SKILL__MAGLEVEL] = {{0,10},{6,5},{15,7},{80,5},{90,2},{99,1}}
showInfoOnAdvance = true -- send player message about skill rate change
showInfoOnLogin = true -- send player message about skill rates when he login
 
function getPlayerSkillRatesText(cid)
 local skillInfo = getPlayerRates(cid)
 return "YOUR RATES: [ Magic Level: " .. skillInfo[SKILL__MAGLEVEL] * skillConfig.magiclevel .. "x || Fist: " .. skillInfo[SKILL_FIST] * skillConfig.skill .. "x | Club: " .. skillInfo[SKILL_CLUB] * skillConfig.skill .. "x |  Sword: " .. skillInfo[SKILL_SWORD] * skillConfig.skill .. "x | Axe: " .. skillInfo[SKILL_AXE] * skillConfig.skill .. "x |  Distance: " .. skillInfo[SKILL_DISTANCE] * skillConfig.skill .. " | Shielding: " .. skillInfo[SKILL_SHIELD] * skillConfig.skill .. "x | Fishing: " .. skillInfo[SKILL_FISHING] * skillConfig.skill .. "x ]"
end
In data\creaturescripts\scripts\ create file skillstagesadvance.lua and paste:
PHP:
dofile(getDataDir() .. "creaturescripts/scripts/stagesconfig.lua")

function onAdvance(cid, skill, oldLevel, newLevel)
	if(skillStages[skill] ~= nil) then
		local skillRate = 1
		local oldRates = getPlayerRates(cid)
		for i, skillRateInfo in pairs(skillStages[skill]) do 
			if(newLevel >= skillRateInfo[1]) then
				skillRate = skillRateInfo[2]
			else
				break
			end
		end
		doPlayerSetRate(cid, skill, skillRate)
		if(showInfoOnAdvance and skillRate ~= oldRates[skill]) then
			if(skill >= 0 and skill <= 6) then
				configRate = skillConfig.skill
			else
				configRate = skillConfig.magiclevel
			end
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, SKILL_NAMES[skill] .. " rate changed from " .. oldRates[skill] * configRate .. "x to " .. skillRate * configRate .. "x. " .. getPlayerSkillRatesText(cid))
		end
	end
	return true
end
In data\creaturescripts\scripts\ create file skillstageslogin.lua and paste:
PHP:
dofile(getDataDir() .. "creaturescripts/scripts/stagesconfig.lua")

function onLogin(cid)
	for skill, skillStage in pairs(skillStages) do
		if(skill >= 0 and skill <= 6) then
			nowSkill = getPlayerSkillLevel(cid, skill)
		else
			nowSkill = getPlayerMagLevel(cid, true)
		end
		for i, skillRateInfo in pairs(skillStage) do
			if(nowSkill >= skillRateInfo[1]) then
				skillRate = skillRateInfo[2]
			else
				break
			end
		end
		doPlayerSetRate(cid, skill, skillRate)
	end
	if(showInfoOnLogin) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, getPlayerSkillRatesText(cid))
	end
	registerCreatureEvent(cid, "SkillStagesAdvance")
	return TRUE
end
In data/creaturescripts/creaturescripts.xml add:
PHP:
	<event type="login" name="SkillStagesLogin" event="script" value="skillstageslogin.lua"/>
	<event type="advance" name="SkillStagesAdvance" event="script" value="skillstagesadvance.lua"/>
Config example:
PHP:
skillStages[SKILL_FIST] = {{0,8},{60,5},{80,3},{100,2}}
From skill 0 (to 59) rate is: skill rate from config.lua * 8
From skill 60 (to 79) rate is: skill rate from config.lua * 5
From skill 80 (to 99) rate is: skill rate from config.lua * 3
From skill 100 (to max. TFS mlvl) rate is: skill rate from config.lua * 2
First stage must be 0
If you dont want stages for X skill/mlvl comment line in config file or remove.
 
Great as always.
For em the best thing is like make so they can train max "3 hours per day or something" and then need to hunt or
like make so they can max get ** mlvl this per "5 hours"
 
Great as always.
For em the best thing is like make so they can train max "3 hours per day or something" and then need to hunt or
like make so they can max get ** mlvl this per "5 hours"
It should not be hard to script it.
 
Wow that's really awesome. =]

1 Question tho, what do you put in your config.lua ?

Like here.

Lua:
	-- Rates
	experienceStages = "yes"
	rateExperience = 10
	rateExperienceFromPlayers = 0
	rateSkill = 20.0
	rateMagic = 10.0
	rateLoot = 3.0
	rateSpawn = 2
 
Last edited:
Wow that's really awesome. =]

1 Question tho, what do you put in your config.lua ?

Like here.

Lua:
	-- Rates
	experienceStages = "yes"
	rateExperience = 10
	rateExperienceFromPlayers = 0
	rateSkill = 20.0
	rateMagic = 10.0
	rateLoot = 3.0
	rateSpawn = 2
TFS use values from config.lua and from skillstages script.
Player skill rate = rateSkill (from config.lua) * rate for X skill (from stages script config)
if you now have:
PHP:
rateSkill = 20.0
and want change it to make skill 90+ 2x slower set in config.lua:
PHP:
rateSkill = 10.0
and in script:
PHP:
skillStages[SKILL_FIST] = {{0,2}, {90,1}}
skillStages[SKILL_CLUB] = {{0,2}, {90,1}}
skillStages[SKILL_SWORD] = {{0,2}, {90,1}}
skillStages[SKILL_AXE] = {{0,2}, {90,1}}
skillStages[SKILL_DISTANCE] = {{0,2}, {90,1}}
skillStages[SKILL_SHIELD] = {{0,2}, {90,1}}
From skill 0 - 89 rate is: 2 * 10.0 = 20.0 ('normal' players can skill to 90 easy)
From skill 90 - unlimited rate is: 1 * 10.0 = 20.0 (players that want skill 90+ [bots] skill 2x slower)
---------------------
or set rateSkill = 5.0 and in config 4 stages:
{{0,4}, {90,3}, {100,2}, {110,1}} (rate x20, x15, x10, x5)
Not hard to calculate values :>
 
TFS use values from config.lua and from skillstages script.
Player skill rate = rateSkill (from config.lua) * rate for X skill (from stages script config)
if you now have:
PHP:
rateSkill = 20.0
and want change it to make skill 90+ 2x slower set in config.lua:
PHP:
rateSkill = 10.0
and in script:
PHP:
skillStages[SKILL_FIST] = {{0,2}, {90,1}}
skillStages[SKILL_CLUB] = {{0,2}, {90,1}}
skillStages[SKILL_SWORD] = {{0,2}, {90,1}}
skillStages[SKILL_AXE] = {{0,2}, {90,1}}
skillStages[SKILL_DISTANCE] = {{0,2}, {90,1}}
skillStages[SKILL_SHIELD] = {{0,2}, {90,1}}
From skill 0 - 89 rate is: 2 * 10.0 = 20.0 ('normal' players can skill to 90 easy)
From skill 90 - unlimited rate is: 1 * 10.0 = 20.0 (players that want skill 90+ [bots] skill 2x slower)
---------------------
or set rateSkill = 5.0 and in config 4 stages:
{{0,4}, {90,3}, {100,2}, {110,1}} (rate x20, x15, x10, x5)
Not hard to calculate values :>

Alright that makes it alot easier to figure out! =P Thanks alot,
Rep+ =D
 
I dont understand how to control it :eek:

I set at config.lua my normal value of the skill and then? :O

From skill 0 - 89 rate is: 2 * 10.0 = 20.0 ('normal' players can skill to 90 easy)
From skill 90 - unlimited rate is: 1 * 10.0 = 20.0 (players that want skill 90+ [bots] skill 2x slower)

misspelling? :O
 
Last edited:
like in ur script if ml 90 the rates will be 1
i want to make if ml 90 for mages so the rates will be 1
and if the ml 13 for knight the rates will be 1
and paladin etc..
 
Back
Top