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

[Request] Player won't get exp until he buys promotion

spice

CABS ARE HERE
Joined
Apr 5, 2009
Messages
1,226
Reaction score
15
Location
Göteborg, Sweden
So I need some help with my level system, togheter with my new vocation system. The player starts at level 8 and level up to 120. At level 120 he won't get EXP (he can still hunt to get loot, but NO exp). After he bought the promotion he will get exp when hunting.
 
this is a great idea, i would like to see this function in the game it could be useful for alot of people, this has given me a few idea's anyone can make it so you cant get exp past x level till you have brought premium account? can anyone script it?
 
LUA:
function onAdvance(cid, skill, oldLevel, newLevel)
	if skill == SKILL__LEVEL and newLevel > 120 and getPlayerPromotionLevel(cid) < 2 then
		return not doPlayerSendTextMessage(cid, STATUS_CONSOLE_MESSAGE_BLUE, "You need a higher promotion!")
	end
	return true
end

try that, else I won't know how to script it.
 
setPlayerExtraExpRate(cid, -xx)

set EXTRA rate, it won't change basic one, and i think u can't add player a negative experience. (since value is unsigned - i can thing wrong).

A weird way out is to set stamina to 0, but as i said this is weird.
 
yeah but i would still like to know if somone can script it for me

player max level with no promotion (120)
player max level with promotion (150)
player max level with premium (infinite)
 
Lol, it is possible... Make onAdvance which sets your exp rate to 0(at lvl 120) and in the npc or promotion item add line setrate 1 and go on...(I will do it later)

First go to creaturescript.xml and add this:
Code:
<event type="advance" name="noexp" event="script" value="noexp.lua"/>

creaturescripts/scripts/login.lua
add:
LUA:
registerCreatureEvent(cid, "noexp")
creaturescripts/noexp.lua
LUA:
function onAdvance(cid, skill, oldlevel, newlevel)
     if skill == SKILL__LEVEL and newlevel >= 120 then   
     doPlayerSetExperienceRate(cid, 0.0)
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "If don't want txt delete this line")
    end
   return TRUE
end

And now say me how you can but promotion on your OT - NPC, rune/item? I will edit it :P
 
Last edited:
Lol, my thread got bumped up. Atleast the script i requested isnt possible with lua, it require source edits. But you could do it like this:

player advance to 120, exp = 0
player gets the promotion and then the player have to be reseted (level)
player advance to 200, exp =0


and so on. Thats possible with LUA, but the script I wanted is not.

I won't check this thread anymore (I think :p)
 
Lol, it is possible... Make onAdvance which sets your exp rate to 0(at lvl 120) and in the npc or promotion item add line setrate 1 and go on...(I will do it later)

First go to creaturescript.xml and add this:
Code:
<event type="advance" name="noexp" event="script" value="noexp.lua"/>

creaturescripts/scripts/login.lua
add:
LUA:
registerCreatureEvent(cid, "noexp")
creaturescripts/noexp.lua
LUA:
function onAdvance(cid, skill, oldlevel, newlevel)
     if skill == SKILL__LEVEL and newlevel >= 120 then   
     doPlayerSetExperienceRate(cid, 0.0)
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "If don't want txt delete this line")
    end
   return TRUE
end

And now say me how you can but promotion on your OT - NPC, rune/item? I will edit it :P

But if you want to try, the player will buy it with a NPC
 
I'm weak at NPCs. Try this
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
-- OTServ event handling functions end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
	if msgcontains(msg, 'help') then
	selfSay('Say "help" for more informations.')

	elseif msgcontains(msg, 'promotion') then
		if getPlayerMoney(cid) >= 20000 then
			if getPlayerPromotionLevel(cid) ~= 1 then
			selfSay('Do you want to be promoted for 20k?')
			talk_state = 1
			else
			selfSay('You are already promoted.')
			talk_state = 0
			end
		else
		selfSay('You don\'t have enough money.')
		talk_state = 0
		end
	elseif msgcontains(msg, 'yes') and talk_state == 1 then
	talk_state = 0
		if getPlayerPromotionLevel(cid) ~= 1 then
			if doPlayerRemoveMoney(cid, 20000) == TRUE then
			doPlayerSetPromotionLevel(cid, 1)
			doPlayerSetExperienceRate(cid, 1.0)
			selfSay('Here u are.')
			else
			selfSay('You don\'t have enough money.')
			talk_state = 0
			end
		else
		selfSay('You are already promoted.')
		talk_state = 0
		end
	end

return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
promotion with npc,

but when player gets to level 150 with promotion, can you make it so they cant exp past level 150 without premium?

and when they buy premium they can continue to level
 
yeah if you can make it by an item, it would be better like vip, player uses "xxxx" item and it adds "xx" days of premium to the players account


so free account = max level cap (120)
promotion from npc = max level cap (180)
premium from item "xxxx" id = no level cap
 
Lol There is a lot of codes :D
1)Data/CreatureScripts/
Creaturescripts.xml
Code:
<event type="advance" name="noexp" event="script" value="noexp120.lua"/>
<event type="advance" name="noexp2" event="script" value="noexp180.lua"/>
/scripts/
/login.lua
LUA:
registerCreatureEvent(cid, "noexp") 
registerCreatureEvent(cid, "noexp2")
/scripts/
noexp120.lua

LUA:
function onAdvance(cid, skill, oldlevel, newlevel)
     if skill == SKILL__LEVEL and newlevel >= 120 then   
     doPlayerSetExperienceRate(cid, 0.0)
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "If don't want txt delete this line")
    end
   return TRUE
end
/scripts/
noexp180.lua

LUA:
function onAdvance(cid, skill, oldlevel, newlevel)
     if skill == SKILL__LEVEL and newlevel >= 180 and (not isPremium(cid)) then   
     doPlayerSetExperienceRate(cid, 0.0)
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "If don't want txt delete this line")
    end
   return TRUE
end

Ok, we have done the 'stopExpAtLvl' xD

2)Actions
Actions.xml
Code:
<action itemid="xxxx" event="script" value="premiumitem.lua"/>
xxxx <- write here id of the item which will give premium


/scripts/
premiumitem.lua

LUA:
function onUse(cid, item, frompos, item2, topos)
premiumdays = 15
doPlayerAddPremiumDays(cid, premiumdays)
doPlayerSetExperienceRate(cid, 1.0)
doRemoveItem(item.uid, 1)
end
premiumdays <- how many days of premium will the item gives

And take the NPC for ptomotion from my posts UP :D
 

Similar threads

Back
Top