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

Promo NPC + Advanced Promo.

Zinc

New Member
Joined
Jun 6, 2007
Messages
77
Reaction score
0
Location
USA-Missouri
Okay My server i have added Additional Promotions.

But I want these promotions to be available at level 100 only.

MS, EK, ED, RP for level 20, like normal and for 20k

But have my Lord Knight, Noble Paladin, High Druid, and High Sorcerer all for Level 100 Only and for 40k.

The Voc ID for
High Sorcerer is 9,
High Druid is 10,
Noble Paladin is 11 and
Lord Knight is 12


Now for the problem.

He gives the promos all well, but he also gives my advanced promo at any level over 20.. So I've had to set it to give BOTH promos for ONLY lv 100+


Now, could it be better to keep the Regular promo NPC as it is for regular promotions...
and make a NEW npc for the Advanced promos?

Or do it as it IS and keep Both promos from ONE npc.
But make sure that it FOLLOWS the requirements.

again,
Lv 100 for Lord Knight, High Druid, High Sorcerer and Noble Paladin. at a price of 40k.

While the Regular Promos remain the same.

The server i'm using is TFS 0.2 Patch 10. So it's current~

Thanks for helping :)

Promotion.lua:
Code:
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 50000 gold coins to your first vocation. Do you want me to promote you?'})
    node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 50000, level = 100, text = 'Congratulations! You are now promoted. If you are not already the third vocation remember to buy it as soon as you can!'})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Allright then. Come back when you are ready.', reset = true})

npcHandler:addModule(FocusModule:new())
 
Last edited:
npc/lib/npcsystem/modules.lua :
Find:
Code:
function StdModule.promotePlayer(cid, message, keywords, parameters, node)
        local npcHandler = parameters.npcHandler
        if(npcHandler == nil) then
            error('StdModule.promotePlayer called without any npcHandler instance.')
        end
        if(not npcHandler:isFocused(cid)) then
            return false
        end

        if(isPlayerPremiumCallback == nil or isPlayerPremiumCallback(cid) == true or parameters.premium == false) then
            local promotedVoc = getPromotedVocation(getPlayerVocation(cid))
            if(getPlayerStorageValue(cid, 30018) == TRUE) 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
                doPlayerSetVocation(cid, promotedVoc)
                npcHandler:say(parameters.text, cid)
            end
        else
            npcHandler:say("You need a premium account in order to get promoted", cid)
        end
        npcHandler:resetNpc()
        return true
    end

Beneath it, add:
Code:
function StdModule.promotePlayerSecond(cid, message, keywords, parameters, node)
        local npcHandler = parameters.npcHandler
        if(npcHandler == nil) then
            error('StdModule.promotePlayerSecond called without any npcHandler instance.')
        end
        if(not npcHandler:isFocused(cid)) then
            return false
        end

        if(isPlayerPremiumCallback == nil or isPlayerPremiumCallback(cid) == true or parameters.premium == false) then
            
            local master = 9
            local elder = 10
            local royal = 11
            local elite = 12
            
            if(getPlayerStorageValue(cid, 30018) == FALSE) then
            if(getPlayerStorageValue(cid, 30019) == TRUE) 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
                if getPlayerVocation(cid) == 5 then
                doPlayerSetVocation(cid, master)
                npcHandler:say(parameters.text, cid)
                elseif getPlayerVocation(cid) == 6 then
                doPlayerSetVocation(cid, elder)
                npcHandler:say(parameters.text, cid)
                elseif getPlayerVocation(cid) == 7 then
                doPlayerSetVocation(cid, royal)
                npcHandler:say(parameters.text, cid)
                elseif getPlayerVocation(cid) == 8 then
                doPlayerSetVocation(cid, elite)
                npcHandler:say(parameters.text, cid)
                end
            end
            else
                npcHandler:say('You need to have the first promotion before I could promote you a second time.')
            end
        else
            npcHandler:say("You need a premium account in order to get promoted", cid)
        end
        npcHandler:resetNpc()
        return true
    end

Then to use it, do like this:
Code:
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.promotePlayerSecond, {npcHandler = npcHandler, cost = 40000, level = 100, 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())


It should work, haven't tried it out though so keep me updated!
 
Thank you very much for your work on this :) it's close to working but ..not yet.

13:59 You see yourself. You are a knight.
14:00 Jenkens[] [47]: hi
14:00 King of Elements City: Welcome, Jenkens[]! I have been expecting you.
14:00 Jenkens[] [47]: promotion
14:00 King of Elements City: I can promote you for 20000 gold coins. Do you want me to promote you?
14:00 Jenkens[] [47]: yes
14:00 King of Elements City: You need to have the first promotion before I could promote you a second time.
14:00 You see yourself. You are a knight.
14:00 Jenkens[] [47]: first promotion
14:00 King of Elements City: I can promote you for 20000 gold coins. Do you want me to promote you?
14:00 Jenkens[] [47]: yes
14:00 King of Elements City: You need to have the first promotion before I could promote you a second time.
14:00 Jenkens[] [47]: bye
14:00 King of Elements City: Good bye, Jenkens[]!

Also doesn't work for a promoted char either:
14:22 Ansina [100]: yes
14:22 King of Elements City: You need to have the first promotion before I could promote you a second time.
14:22 You see Ansina (Level 100). He is a master sorcerer.
Position: [X: 495] [Y: 494] [Z: 6].
 
Last edited:
Show me your XML file, I'm pretty sure you just didn't change the stdModule.promotePlayerSecond :)
 
XML? You mean LUA?
King of Elements City.XML:
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="King of Elements City" script="data/npc/scripts/promotion.lua" walkinterval="0" floorchange="0">
    <health now="100" max="100"/>
    <look type="133" head="20" body="39" legs="45" feet="7" addons="0"/>
</npc>

promotion.LUA:
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.promotePlayerSecond, {npcHandler = npcHandler, cost = 40000, level = 100, 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())
 
Oh right, of course I ment LUA. And seems you did everything properly, I'll recheck my code later.
 
So with this, the first promo(MS, EK, ED, RP) is all 20k and lv 20, but will the second promotions be 40k and lv 100? I don't see anything about the second promos being lv 100 + 40k -.^

Thanks for the work on this :)
 
haha of course not, common human mistakes, nothing to be ashamed of. Anyways, still not working? If so, let me know
 
Try this piece of code instead:
PHP:
function StdModule.promoteSecond(cid, message, keywords, parameters, node)
    local npcHandler = parameters.npcHandler
    if(npcHandler == nil) then
        error('StdModule.promoteSecond called without any npcHandler instance.')
    end
    if(not npcHandler:isFocused(cid)) then
        return false
    end

    if(isPlayerPremiumCallback == nil or isPlayerPremiumCallback(cid) == true or parameters.premium == false) then
        
        if(getPlayerStorageValue(cid, 30018) == TRUE) then
            if(getPlayerStorageValue(cid, 30019) == TRUE) 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
                -- Master Sorcerer
                if getPlayerVocation(cid) == 5 then
                    doPlayerSetVocation(cid, 9)
                    npcHandler:say(parameters.text, cid)
                -- Elder Druid
                elseif getPlayerVocation(cid) == 6 then
                    doPlayerSetVocation(cid, 10)
                    npcHandler:say(parameters.text, cid)
                -- Royal Paladin
                elseif getPlayerVocation(cid) == 7 then
                    doPlayerSetVocation(cid, 11)
                    npcHandler:say(parameters.text, cid)
                -- Elite Knight
                elseif getPlayerVocation(cid) == 8 then
                    doPlayerSetVocation(cid, 12)
                    npcHandler:say(parameters.text, cid)
                end
            end
        else
            npcHandler:say('You need to have the first promotion before I could promote you a second time.')
        end
    else
        npcHandler:say("You need a premium account in order to get promoted", cid)
    end
    npcHandler:resetNpc()
    return true
end
and this
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 40000 gold coins. Do you want me to promote you?'})
    node1:addChildKeyword({'yes'}, StdModule.promoteSecond, {npcHandler = npcHandler, cost = 40000, level = 100, 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())
 
Last edited:
Nope.. same thing :S

14:07 Calico Jack [8]: hi
14:07 King of Elements City: Welcome, Calico Jack! I have been expecting you.
14:07 Calico Jack [8]: promotion
14:07 King of Elements City: I can promote you for 40000 gold coins. Do you want me to promote you?
14:07 Calico Jack [8]: yes
14:07 King of Elements City: You need to have the first promotion before I could promote you a second time.
14:08 You advanced from Level 8 to Level 68.
14:08 You advanced from Level 68 to Level 86.
14:08 You advanced from Level 86 to Level 98.
14:08 Calico Jack [98]: promotion
14:08 King of Elements City: I can promote you for 40000 gold coins. Do you want me to promote you?
14:08 Calico Jack [98]: yes
14:08 King of Elements City: You need to have the first promotion before I could promote you a second time.
14:08 You see yourself. You are a sorcerer.
 
This could be easier if the script could be scripted as the 7.6 scripts.

Like adding +4 vocs or something like that...

Some scripter know how to do that?
 
Sorry then mate, this is how far my skills goes and even that wasn't enough, good luck though! :)
 
Back
Top