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

Second Promotion (3th job)

Mooosie

mistofdeath.com
Premium User
Joined
Aug 2, 2008
Messages
742
Solutions
2
Reaction score
52
Location
Sweden
Hello!

I wonder if there is any npc that promotes the player for the second time if the player get the first promotion. I am using this promotion at the moment:

LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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

local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you for 20000 gold coins. Do you want me to promote you?'})
	node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20, promotion = 1, text = 'Congratulations! You are now promoted.'})
	node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})

local node2 = keywordHandler:addKeyword({'again'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you for the second time for 200000 gold coins. Do you want me to promote you?'})
	node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 200000, level = 120, promotion = 2, text = 'Congratulations! You are now Promoted.'})
	node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})

npcHandler:addModule(FocusModule:new())
↑ that script is working fine, it dont downgrades or anything... But I want that if, the player has promote himself once then promote him...
But before i used this:

LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

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

function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end

	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	local cfg = {vocs = { 5, 6, 7, 8 }}
	local strv = 33300011
	if(msgcontains(msg, 'promotion') or msgcontains(msg, 'promote')) then
		selfSay('Do you want to promote you?', cid)
		talkState[talkUser] = 1
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if getPlayerStorageValue(cid, strv) == -1 then
	if getPlayerLevel(cid) >= 170 then
		if isInArray(cfg.vocs, getPlayerVocation(cid)) == true then
			if(doPlayerRemoveMoney(cid, 1000)) then
					setPlayerPromotionLevel(cid, getPlayerPromotionLevel(cid) + 1)
					setPlayerStorageValue(cid, strv, 1)
				selfSay('Here you are.', cid)
			else
				selfSay('Sorry, you don\'t have enough gold.', cid)
			end
		else
		selfSay('Sorry, you need to be promoted once before I can promote you.', cid)
	end
else
	selfSay('Sorry, you need level 220 to promote you.', cid)
end
else
	selfSay('Sorry, you\'ve already been promoted.', cid)
end
		talkState[talkUser] = 0
	elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
		talkState[talkUser] = 0
		selfSay('Ok then.', cid)
	end

	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
The script i had before is not working... It gives the promotion but then when the player logsout, the server downgrades back the vocation once... And in localhost/phpmyadmin it says that the player is vocation 4, - knight for example...

I hope you understand what i mean.
Thx :D
Rep++
 
First you've to configure them on vocations.xml add the new 4 promotions (if you have 4 vocations) for example: Knight, Master Knight - Druid, Master Druid.

you have to add the 4 vocations on vocation.xml then just change the promotion npc script (King) to the new names and the new ID's and how much it costs.
 
Hello!

I wonder if there is any npc that promotes the player for the second time if the player get the first promotion. I am using this promotion at the moment:

LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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

local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you for 20000 gold coins. Do you want me to promote you?'})
	node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20, promotion = 1, text = 'Congratulations! You are now promoted.'})
	node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})

local node2 = keywordHandler:addKeyword({'again'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you for the second time for 200000 gold coins. Do you want me to promote you?'})
	node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 200000, level = 120, promotion = 2, text = 'Congratulations! You are now Promoted.'})
	node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})

npcHandler:addModule(FocusModule:new())

so i use this on promotion.lua?
 
Back
Top