• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

promotion issue

carre

Advanced OT User
Joined
Apr 23, 2013
Messages
885
Solutions
1
Reaction score
161
Location
Sweden
16:53 Baxter: promotion
16:53 King Tibianus: Do you want to be promoted in your vocation for 20000 gold?
16:53 Baxter: yes
16:53 King Tibianus: You need a premium account in order to get promoted
here is my lua code sorry for my double post

My modules.lua

Code:
    if(isPlayerPremiumCallback == nil or isPlayerPremiumCallback(cid) == true or parameters.premium == true) 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




My 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 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())

any?
 
Last edited by a moderator:
here is my confiq lua


Code:
-- The Forgotten Server Config

    -- Account manager
    accountManager = true
    namelockManager = true
    newPlayerChooseVoc = true
    newPlayerSpawnPosX = 1
    newPlayerSpawnPosY = 1
    newPlayerSpawnPosZ = 7
    newPlayerTownId =  3
    newPlayerLevel = 8
    newPlayerMagicLevel = 0
    generateAccountNumber = false

    -- Banishments
    notationsToBan = 1
    warningsToFinalBan = 4
    warningsToDeletion = 5
    banLength = 1 * 24 * 60 * 60
    finalBanLength = 30 * 24 * 60 * 60
    ipBanishmentLength = 1 * 24 * 60 * 60
    killsToBan = 8
    maxViolationCommentSize = 200

    -- Battle
    worldType = "pvp"
    protectionLevel = 20
    pvpTileIgnoreLevelAndVocationProtection = true
    killsToRedSkull = 5
    pzLocked = 60 * 1000
    criticalHitChance = 7
    criticalHitMultiplier = 1
    displayCriticalHitNotify = false
    removeWeaponAmmunition = true
    removeWeaponCharges = false
    removeRuneCharges = false
    timeToDecreaseFrags = 24 * 60 * 60 * 1000
    whiteSkullTime = 15 * 60 * 1000
    noDamageToSameLookfeet = false
    experienceByKillingPlayers = false
    showHealingDamage = false
    showHealingDamageForMonsters = false

    -- Connection config
    ip = "127.0.0.1"
    port = 7171
    loginTries = 10
    retryTimeout = 5 * 1000
    loginTimeout = 60 * 1000
    maxPlayers = "1000"
    motd = "Welcome to The voteria!"
    displayOnOrOffAtCharlist = false
    onePlayerOnlinePerAccount = true
    allowClones = 0
    serverName = "voteria"
    loginMessage = "voteria"   
    statusTimeout = 5 * 60 * 1000
    replaceKickOnLogin = true

    -- Database
    -- NOTE: sqlFile is used only by sqlite database
    sqlType = "mysql"
    sqlHost = "localhost"
    sqlPort = 3306
    sqlUser = "root"
    sqlPass = "42405076"
    sqlDatabase = "760server"
    sqlFile = "forgottenserver.s3db"
    passwordType = "plain"

    -- Deathlist
    deathListEnabled = true
    maxDeathRecords = 5

    -- Guilds
    inGameGuildManagement = true
    levelToFormGuild = 8
    guildNameMinLength = 4
    guildNameMaxLength = 20

    -- Highscores
    highscoreDisplayPlayers = 15
    updateHighscoresAfterMinutes = 60

    -- Houses
    buyableAndSellableHouses = true
    housesPerAccount = 0
    levelToBuyHouse = 1
    houseRentAsPrice = false
    housePriceAsRent = false
    housePriceEachSQM = 1000
    houseRentPeriod = "never"
    houseNeedPremiumAccount = true
    bedsRequirePremium = true

    -- Item usage
    timeBetweenActions = 200
    timeBetweenExActions = 1000

    -- Map
    mapName = "world"
    cleanProtectedZones = true

    -- Miscellaneous
    -- NOTE: defaultPriority works only on Windows
    dataDirectory = "data/"
    kickIdlePlayerAfterMinutes = 15
    allowChangeOutfit = true
    maxMessageBuffer = 4
    displayGamemastersWithOnlineCommand = false
    defaultPriority = "high"
    saveGlobalStorage = true
    bankSystem = true
    displaySkillLevelOnAdvance = false

    -- Premium account
    freePremium = true
    premiumForPromotion = false
    removePremiumOnInit = false

    -- Rates
    experienceStages = true
    rateExp = 35
    rateSkill = 60
    rateLoot = 4
    rateMagic = 17
    rateSpawn = 1

    -- Global save
    -- NOTE: globalSaveHour means like 03:00, not that it will save every 3 hours,
    -- if you want such a system use autoSaveEachMinutes. This save method
    -- may be unstable, we recommend using OTAdmin if you want real saves.
    globalSaveEnabled = false
    globalSaveHour = 8
    shutdownAtGlobalSave = true
    cleanMapAtGlobalSave = false

    -- Spawns
    deSpawnRange = 2
    deSpawnRadius = 50

    -- Summons
    maxPlayerSummons = 2

    -- Status
    ownerName = ""
    ownerEmail = "@otland.net"
    url = "http://otland.net/"
    location = "Europe"
 
Were supposed to be right here .-.
Code:
-- Premium account
freePremium = true
premiumForPromotion = false
removePremiumOnInit = false

Do you other types of pacc? like vip sys ?
 
http://otland.net/threads/promotion-problem.216861/page-2#post-2082599
http://otland.net/threads/promotion-problem-npc.216894/

Stop making more thread about the same problem.

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(cid ~= npcHandler.focus) 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

In the modules you posted as pastebin link, you had this, which means you have to add premium = false in the npc.
http://otland.net/threads/promotion-problem.216861/#post-2082561

For some reason you changed
Code:
parameters.premium == false
to
Code:
parameters.premium == true

So ye, then ofc adding premium = false wouldn't have effect anymore..

Change it back to false and add premium = false in the npc.
 
here my modules take a look

http://pastebin.com/mmspZ5jC

here is my npc king tibianus
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="King Tibianus" script="data/npc/scripts/promotion.lua" walkinterval="1000" access="3" floorchange="0">
    <health now="100" max="100"/>
    <look type="130" head="21" body="87" legs="107" feet="95"/>
    <parameters>
      
        <parameter key="message_greet" value="I greet thee, my loyal subject."/>
        <parameter key="message_farewell" value="Good bye, |PLAYERNAME|!"/>

        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="name;job;help,premium scroll;" />
        <parameter key="keyword_reply1" value="It's hard to believe that you don't know your own king!" />
        <parameter key="keyword_reply2" value="I am your sovereign, King Tibianus III, and it's my duty to provide justice and guidance for my subjects." />
        <parameter key="keyword_reply3" value="Visit Quentin, the monk, for help." />
        <parameter key="keyword_reply4" value="I buy your premium scroll for 50000 gold coins." />
        <parameter key="module_shop" value="1"/>
        <parameter key="shop_sellable" value="premium scroll,2345,50000;" />

    </parameters>
</npc>
king tibianus
 
Code:
--Usage:
        -- local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, 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, text = 'Allright then. Come back when you are ready.'}, reset = true)
    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(cid ~= npcHandler.focus) then
            return false
        end

        if(isPremium(cid) or isPlayerPremiumCallback == nil or isPlayerPremiumCallback(cid) == false or parameters.premium == false) then
            local oldVoc = getPlayerVocation(cid)
            if(parameters.promotions[oldVoc] == oldVoc or parameters.promotions[oldVoc] == nil) then
                npcHandler:say('You are already promoted!')
            elseif(getPlayerLevel(cid) < parameters.level) then
                npcHandler:say('I am sorry, but I can only promote you once you have reached level ' .. parameters.level .. '.')
            elseif(doPlayerRemoveMoney(cid, parameters.cost) ~= TRUE) then
                npcHandler:say('You do not have enough money!')
            else
                doPlayerSetVocation(cid, parameters.promotions[oldVoc])
                npcHandler:say(parameters.text)
            end
        else
            npcHandler:say('Sorry, only premium characters are allowed to be promoted.')
        end
 
here is my npc lua scripts kingtibia nus
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="King Tibianus" script="data/npc/scripts/promotion.lua" walkinterval="1000" access="3" floorchange="0">
    <health now="100" max="100"/>
    <look type="130" head="21" body="87" legs="107" feet="95"/>
    <parameters>
       
        <parameter key="message_greet" value="I greet thee, my loyal subject."/>
        <parameter key="message_farewell" value="Good bye, |PLAYERNAME|!"/>

        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="name;job;help,premium scroll;" />
        <parameter key="keyword_reply1" value="It's hard to believe that you don't know your own king!" />
        <parameter key="keyword_reply2" value="I am your sovereign, King Tibianus III, and it's my duty to provide justice and guidance for my subjects." />
        <parameter key="keyword_reply3" value="Visit Quentin, the monk, for help." />
        <parameter key="keyword_reply4" value="I buy your premium scroll for 50000 gold coins." />
        <parameter key="module_shop" value="1"/>
        <parameter key="shop_sellable" value="premium scroll,2345,50000;" />

    </parameters>
</npc>
 
promotion.lua
Code:
-- This is an example NPC script that can be used on Jiddo's NPC system

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

local node1 = keywordHandler:addKeyword({'promotion'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to be promoted in your vocation for 20000 gold?'})
    node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, promotions = {[1] = 5, [2] = 6, [3] = 7, [4] = 8}, cost = 20000,  level = 20, text = 'Congratulations! You are now promoted.'})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Allright then. Come back when you are ready.', reset = true})

npcHandler:addModule(FocusModule:new())
 
Back
Top