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

Promotion problem

Tamiko

Member
Joined
Sep 1, 2014
Messages
24
Reaction score
0
Hi

I am using: The Forgotten Server Version: 0.2.15 Mystic Spirit

I have problem with promotion NPC..
I am lvl 20,
I go buy promotion: I buy it and so on..
Queen Eloise: Congratulations! You are now promoted.
Then I am promoted.. but! I can speak to her again, over and over. Whenever I buy promotion again.. this is what happens:
You see yourself. You have no vocation.

How can I change so she sells promotion ONLY ONCE? and then whenever someone have been promoted she says: You are already promoted.. ?

This is my script:
PHP:
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, 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})

npcHandler:addModule(FocusModule:new())



Tamiko
 
data/npc/lib/npcsystem/modules.lua on line 78, change this part.
Code:
       if(getPlayerStorageValue(cid, 30018) == 1) then
           npcHandler:say("You are already promoted!", cid)
       elseif(getPlayerLevel(cid) < parameters.level) then
           npcHandler:say("I am sorry, but I can only promote you once you have reached level " .. parameters.level .. ".", cid)
       elseif(doPlayerRemoveMoney(cid, parameters.cost) ~= TRUE) then
           npcHandler:say("You do not have enough money!", cid)
       else
           setPlayerStorageValue(cid, 30018, 1)
           doPlayerSetVocation(cid, promotedVoc)
           npcHandler:say(parameters.text, cid)
       end
 
Its working!

13:17 Queen Eloise: I greet thee, my loyal subject.
13:17 Nr One [30]: promotion
13:17 Queen Eloise: I can promote you for 20000 gold coins. Do you want me to promote you?
13:17 Nr One [30]: yes
13:17 Queen Eloise: Congratulations! You are now promoted.
13:17 Nr One [30]: promotion
13:17 Queen Eloise: I can promote you for 20000 gold coins. Do you want me to promote you?
13:18 Nr One [30]: yes
13:18 Queen Eloise: You are already promoted!

Thank you so much!!!!!!!
 
Back
Top