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

Ranks By Level [Rep++]

Alyhide

Banned User
Joined
Aug 21, 2010
Messages
1,945
Reaction score
55
Location
Switzerland
Hello, I wanted a script that is like a 'Ranking System by the Player's level'.
So, it goes like this for an example..

"Player advances to level 100, displays message 'Congratulations! You are now level xxx. You have gained 50 crystal coins. You are now a Warlord of the Flame.'

and, in the game.. "You see Chiron. He is an elite knight .. He is a Warlord of the Flame."

I would love it if someone could give me this, and if it's possible, so it could be for multiple levels, like 100,250,etc.


Thanks, and rep++
 
Thank you J Dre, I have not tested it, will do this tomorrow, but these are 'Creaturevents' right?
And, do I have to do anything like registercreatureevent 'blahblah'?

Also, in..
[{7500, 100}] = {"Warlord of the Flame"}

What exactly is the [{7500, 100}] part? just wondering.
 
Thank you J Dre, I have not tested it, will do this tomorrow, but these are 'Creaturevents' right?
And, do I have to do anything like registercreatureevent 'blahblah'?

Also, in..
[{7500, 100}] = {"Warlord of the Flame"}

What exactly is the [{7500, 100}] part? just wondering.

Yes, they're both creaturescripts. You're going to have to add the following:

creaturescripts/creaturescripts.xml:
Code:
<event type="advance" name="[COLOR="#FF0000"]SCRIPT_1[/COLOR]" event="script" value="[COLOR="#FF0000"]SCRIPT_1.lua[/COLOR]"/>
<event type="look" name="[COLOR="#FF8C00"]SCRIPT_2[/COLOR]" event="script" value="[COLOR="#FF8C00"]SCRIPT_2.lua[/COLOR]"/>

creaturescripts/login.lua
Code:
registerCreatureEvent(cid, "[COLOR="#FF0000"]SCRIPT_1[/COLOR]")
registerCreatureEvent(cid, "[COLOR="#FF8C00"]SCRIPT_2[/COLOR]")

Those numbers are just storages and values to let the scripts assign new descriptions. I have edited the main post above.

P.S.
This is not tested...I just made it quickly @ 1:30 AM.
 
Last edited:
Hopefully you're using one of the later revisions. This is NOT tested.

First part:
LUA:
local t = {
	[100] = {id = 2160, count = 100, desc = "Warlord of the Flame"}
}

local storage = 7500
function onAdvance(cid, skill, oldLevel, newLevel)
	local i = t[newLevel]
	if skill == SKILL__LEVEL and newLevel == i and getCreatureStorage(cid, storage) < newLevel then

		local first = function()
			local reward = doCreateItemEx(i.id, i.count)
			if doPlayerAddItemEx(cid, reward, true) ~= RETURNVALUE_NOERROR then
				return false
			end
 
			doSendMagicEffect(getThingPos(cid), CONST_ME_FIREWORK_YELLOW)
			doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Congratulations, you have reached level " .. i .. "! You are now ranked " .. i.desc .. ".")
			return true
		end
	
		if first then
			doCreatureSetStorage(cid, storage, newLevel)
		end
	end
	
	return true
end

Second part:
LUA:
local t = {
	[100] = {"Warlord of the Flame"}
}

local storage = 7500
function onLook(cid, thing, position, lookDistance)
	for v, desc in pairs(t) do
		if isPlayer(thing.uid) then
			if getCreatureStorage(thing.uid, storage) == v then
				doPlayerSetSpecialDescription(thing.uid, (getPlayerSex(thing.uid) == 0 and ".\nShe" or ".\nHe") .. " is ranked " .. desc .. ".")
			end
		end
	end
	
	return true
end

loop for the second script is not necessary, loved the first script :P
LUA:
local t = {
	[100] = {"Warlord of the Flame"}
}
 
local storage = 7500
function onLook(cid, thing, position, lookDistance)
	return isPlayer(thing.uid) and doPlayerSetSpecialDescription(thing.uid, (getPlayerSex(thing.uid) == 0 and ".\nShe" or ".\nHe") .. " is ranked " .. t[getCreatureStorage(thing.uid, storage)][1] .. ".") and true
end

it was reduced.
 
I did both of them, and started up the server. No errors, then i got level 100, and nothing happened. I didn't get the title, nor did any errors pop up o.0
 
Last edited:
Back
Top