• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

CreatureEvent player does not exp - mlevel does not growing! :)

andypsylon

be be
Joined
Jan 13, 2009
Messages
772
Reaction score
65
Location
de/pl
on request:
http://otland.net/f132/can-someone-make-script-please-rep-i-need-fast-145817/

in
data\creaturescripts\creaturescripts.xml
insert:
XML:
    <event type="advance"    name="advanceMlevel"    event="script" value="advance_mlevel.lua"/>
in
data\creaturescripts\scripts\login.lua
insert:
Lua:
-- ver. 2.1 2011-12-07
-- author tfs, otland.net/members/andypsylon
local c = {
-- {lvl, mlvl}
	{10, 25},
	{15, 30},
	{20, 35}
}
for _, v in ipairs(c) do
	if(getPlayerLevel(cid) <= v[1]) then
		if getPlayerMagLevel(cid) >= v[2] then
			doPlayerSetRate(cid, SKILL__MAGLEVEL, 0)
			break
		end
	end
end
registerCreatureEvent(cid, "advanceMlevel")
create
data\creaturescripts\scripts\advance_mlevel.lua
and insert:
Lua:
-- ver. 2.2 2011-12-07
-- author tfs, otland.net/members/andypsylon
local c = {
-- {lvl, mlvl}
	{10, 25},
	{15, 30},
	{20, 35}
}
function onAdvance(cid, skill, oldLevel, newLevel)
	if skill == SKILL__MAGLEVEL or skill == SKILL__LEVEL then
		for _, v in ipairs(c) do
			if getPlayerLevel(cid) <= v[1] then
				if getPlayerMagLevel(cid) >= v[2] then
					return doPlayerSetRate(cid, SKILL__MAGLEVEL, 0) and true
				else
					return doPlayerSetRate(cid, SKILL__MAGLEVEL, 1) and true
				end
			else
				doPlayerSetRate(cid, SKILL__MAGLEVEL, 1)
			end
		end
	end
	return true
end

tested on tfs 0.3.6 and 0.4
 
Last edited:
The script doesnt work to tfs 0.3.6 please fix it :(

i gone sleep, i hope tomorrow its working to tfs 0.3.6 :(
 
Last edited:
That is the problem no error, it dont come out error because it dont read it or smth
 
When im lvl 10 and i put max 25 ml i get max 26 ml then if i go up lvl 11 i put max ml 35 but it doesnt do smth only the first one work but when i logg out i can gain more ml,
 
Buuuuut works! what you did wrong?! :p

the rest, to "the problem with logout/login", i will write and add.. moment
 
Buuuuut works! what you did wrong?! :p

the rest, to "the problem with logout/login", i will write and add.. moment

I didnt smth wrong it because i write lvl 8 max ml 25, but it stops when im 26 ml that is the problem i didnt know xD but please make it work bro :) <3
 
ok bro the logg out and in worked but this is the problem i put max 25 ml i get 26 ml max and when i reach the next level to get max 30 ml but i can get more than 30 ml :(
 
Bro this working perfectly {10, 25}, the first row then the second and third they dont work im lvl 15 i can get more than 30 ml :/ if you fix that then the script is 100% done and i will rep you bro and my friends will do it too :) comeon bro you will make it :D
 
Thanks ultra rep!!!
 
Last edited:
Although your way works, it's just as I stated in the request. The onAdvance only triggers when you >advance< the skill, thus a much simpler version to all this would have been to return the oldLevel onAdvance.
 
Not going to argue with you on your own code but you fail to show how yours is a better solution when it requires rate changes. My way would simply set everything back up to 0 mana spent and the original magic level and would still allow you to get up to 99% then level go out and level and cast one spell in order to get your next ML all the while not passing any thresholds.
 
Regardless, I've glanced through the source code and in order to do it the way I was thinking you'd need to do a source edit; although it is simple, that automatically makes your way more simple, but not more efficient. My way would have guaranteed no possible bypass, your way has some flaws.

Anyways, good job with making a LUA based version of this.
 
Back
Top Bottom