• 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 Ranking System

Alyhide

Banned User
Joined
Aug 21, 2010
Messages
1,945
Reaction score
54
Location
Switzerland
~'Ranking System'~
Developed By J.Dre and Sonik..
Tested And Only Successful On 9.1 Servers


This is a script we made a while back, all respect to J.Dre. It took us hours, and a lot more frustration than our last script.. But, me, or J.Dre are not here for the money, so we'll just release this script also for free. Have Fun, and Enjoy.

The Idea..

Get a certain level, you get a reward, and a special description, in this case, at 100, you would be called 'Warlord of the Flame'

Screenshots..

2jd5hg2.jpg

vh54l0.png



The Scripts..

SetRank.lua:
Lua:
local config = {
	storage = 7500,
	mailbox = {
		{x = 95, y = 112, z = 7} -- mailbox location on map
	}
}
 
local ranks = {
	["Warlord of the Flame"] = {
		c = {
			level = 100,
			prize = {2160, 10}
		}
	},
}
 
local function doPlayerAddDepotItems(cid, pos, town, items, notify) -- credits to Chojy for idea.
	local parcel = doCreateItemEx(2595)
	local label = doAddContainerItem(parcel, 2599)
	doSetItemText(label, getCreatureName(cid) .."\n".. town)
	doAddContainerItemEx(parcel, items)
	doTeleportThing(parcel, pos)
	if(notify == true) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your reward has been sent to your depot because you were unable to carry it.")
	end
 
	return true
end
 
function onAdvance(cid, skill, oldLevel, newLevel)
	for desc, i in pairs(ranks) do
		if skill == SKILL__LEVEL then
			if newLevel >= i.c.level then
				if getCreatureStorage(cid, config.storage) < newLevel then
 
					local id = doCreateItemEx(i.c.prize[1], i.c.prize[2] or 1)
					if(doPlayerAddItemEx(cid, id, false) ~= RETURNVALUE_NOERROR) then
						doPlayerAddDepotItems(cid, config.mailbox[1], getTownName(getPlayerTown(cid)), id, true)
					end
 
					doCreatureSetStorage(cid, config.storage, newLevel)
					doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS)
					doCreatureSay(cid, "Congratulations! You are now a " .. desc .. ".", TALKTYPE_MONSTER)
					break
				end
			end
		end
	end
 
	return true
end


LookRank.lua:
Lua:
local t = {
	[100] = {"Warlord of the Flame"}
}
 
local storage = 7500
function onLook(cid, thing, position, lookDistance)
	if isPlayer(thing.uid) then
		local voc = getPlayerVocation(thing.uid)
		if t[getCreatureStorage(thing.uid, storage)] then
			if cid == thing.uid then
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You see yourself. " .. (voc == 0 and "You have no vocation" or "You are " .. getVocationInfo(voc).description) .. ".\nYou are also ranked as " .. t[getCreatureStorage(thing.uid, storage)][1] .. ".")
			else
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You see " .. getCreatureName(thing.uid) .. " (Level: " .. getPlayerLevel(thing.uid) .. "). " .. (getPlayerSex(thing.uid) == 0 and "She" or "He") .. " " .. (voc == 0 and 'has no vocation' or 'is ' .. getVocationInfo(voc).description) .. ". " .. (getPlayerSex(thing.uid) == 0 and "\nShe" or "\nHe") .. " is also " .. t[getCreatureStorage(thing.uid, storage)][1] .. ".")
			end
 
			return false
		end
	end
 
	return true
end


In CreatureScripts.xml..

Lua:
	<event type="look" name="LookRank" event="script" value="LookRank.lua"/>
	<event type="Advance" name="SetRank" event="script" value="SetRank.lua"/>


In Login.lua..
Lua:
  	registerCreatureEvent(cid, "SetRank") 
	registerCreatureEvent(cid, "LookRank")
 
Last edited:
great script! MM i doubt you can do for add more than 1 rank?

PHP:
local t = {
	[100] = {"Warlord of the Flame"},
	[200] = {"Black Wizard of the Flame"} ---add by knight god
}
 
local storage = 7500
function onLook(cid, thing, position, lookDistance)
	if isPlayer(thing.uid) then
		local voc = getPlayerVocation(thing.uid)
		if t[getCreatureStorage(thing.uid, storage)] then
			if cid == thing.uid then
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You see yourself. " .. (voc == 0 and "You have no vocation" or "You are " .. getVocationInfo(voc).description) .. ".\nYou are also ranked as " .. t[getCreatureStorage(thing.uid, storage)][1] .. ".")
			else
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You see " .. getCreatureName(thing.uid) .. " (Level: " .. getPlayerLevel(thing.uid) .. "). " .. (getPlayerSex(thing.uid) == 0 and "She" or "He") .. " " .. (voc == 0 and 'has no vocation' or 'is ' .. getVocationInfo(voc).description) .. ". " .. (getPlayerSex(thing.uid) == 0 and "\nShe" or "\nHe") .. " is also " .. t[getCreatureStorage(thing.uid, storage)][1] .. ".")
			end
 
			return false
		end
	end
 
	return true
end

test this
 
if someone put 1gp on mailbox he can wait for parcels with prizes for free ; )
 
if someone put 1gp on mailbox he can wait for parcels with prizes for free ; )

Then exile the part of that script if your worried about it. There is no way to change that.
Or, just put a random mailbox in a place unaccesable by players.
 
For the onLook script, I think it would be better concatenating strings together to come up with what they see, since other people may have a marriage system. others may also have their own reborn system or a system entirely different that also uses onLook.
 
Lulz, there is a function (0.3.6pl1 and newer): doPlayerSendMailByName(name, item[, town[, actor]])
And item can be a container with items ;p
Though good idea.

And if someone will put 1gp on the mailbox - it'll not affect sending a parcel.
 
Lulz, there is a function (0.3.6pl1 and newer): doPlayerSendMailByName(name, item[, town[, actor]])
And item can be a container with items ;p
Though good idea.

And if someone will put 1gp on the mailbox - it'll not affect sending a parcel.

Then make a mailbox that is unreachable to players. Use your heads people, stop complaining...it took me a while to get this working properly. <_<
 
Then make a mailbox that is unreachable to players. Use your heads people, stop complaining...it took me a while to get this working properly. <_<

Why want you make a "mailbox that is unreachable to players." if you can use this function? :blink:

Lua:
doPlayerSendMailByName(name, item[, town[, actor]])
 

Why want you make a "mailbox that is unreachable to players." if you can use this function? :blink:

Lua:
doPlayerSendMailByName(name, item[, town[, actor]])

Because I didn't know that was implemented. The solution is to make a mailbox that is unreachable (using the script here).

Dur Dur... <_<
 
Because I didn't know that was implemented. The solution is to make a mailbox that is unreachable (using the script here).

Dur Dur... <_<

So you know now and just update script. Solution for what?!
 
Tell me if there are any errors.. ;)

Lua:
local config = {
	storage = 7500,
 
local ranks = {
	["Warlord of the Flame"] = {
		c = {
			level = 100,
			prize = {2160, 10}
		}
	},
}
 
local function doPlayerSendMailByName(name, item, notify[, town[, actor]])) -- credits to Chojy for idea.
	local parcel = doCreateItemEx(2595)
	local label = doAddContainerItem(parcel, 2599)
	doSetItemText(label, getCreatureName(cid) .."\n".. town)
	doAddContainerItemEx(parcel, items)
	if(notify == true) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your reward has been sent to your depot because you were unable to carry it.")
	end
 
	return true
end
 
function onAdvance(cid, skill, oldLevel, newLevel)
	for desc, i in pairs(ranks) do
		if skill == SKILL__LEVEL then
			if newLevel >= i.c.level then
				if getCreatureStorage(cid, config.storage) < newLevel then
 
					local id = doCreateItemEx(i.c.prize[1], i.c.prize[2] or 1)
					if(doPlayerAddItemEx(cid, id, false) ~= RETURNVALUE_NOERROR) then
					doPlayerSendMailByName(name, item[, town[, actor]])
					end
 
					doCreatureSetStorage(cid, config.storage, newLevel)
					doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS)
					doCreatureSay(cid, "Congratulations! You are now a " .. desc .. ".", TALKTYPE_MONSTER)
					break
				end
			end
		end
	end
 
@up,

Quite a few. :(

I know, I'm lazy right now, sick, tired, sore.. I just basically deleted the depot thing.. I'll fix it all later..
People should just figure out that they can edit it if they want it that way, and don't, because most people don't care..
They can wait if they want it so badly..
 
I have my doubts of this working:
Lua:
local config = {
	storage = 7500,
 
local ranks = {
	["Warlord of the Flame"] = {
		c = {
			level = 100,
			prize = {2160, 10}
		}
	},
}
--[[
local function doPlayerSendMailByName(name, item, notify, town, actor) -- credits to Chojy for idea.
	local parcel = doCreateItemEx(2595)
	local label = doAddContainerItem(parcel, 2599)
	doSetItemText(label, getCreatureName(cid) .."\n".. town)
	doAddContainerItemEx(parcel, items)
	if(notify == true) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your reward has been sent to your depot because you were unable to carry it.")
	end
 
	return true
end
]]
 
function onAdvance(cid, skill, oldLevel, newLevel)
	for desc, i in pairs(ranks) do
		if skill == SKILL__LEVEL then
			if newLevel >= i.c.level then
				if getCreatureStorage(cid, config.storage) < newLevel then
 
					local id = doCreateItemEx(i.c.prize[1], i.c.prize[2] or 1)
					if(doPlayerAddItemEx(cid, id, false) ~= RETURNVALUE_NOERROR) then --does this work?
					doPlayerSendMailByName(getCreatureName(cid), id, getPlayerTown(cid))
					doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your reward has been sent to your depot because you were unable to carry it.")
					end
 
					doCreatureSetStorage(cid, config.storage, newLevel)
					doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS)
					doCreatureSay(cid, "Congratulations! You are now a " .. desc .. ".", TALKTYPE_MONSTER)
					break
				end
			end
		end
	end
return true 
end
 
don't work, it gives a reward everytime you reach a new level and also when you look yourself or other players there is not a special description
 
How does this work? can u see eachothers ranks? or is it just for yourself?
 
Back
Top