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

RevScripts new vocation bug

God Aries

New Member
Joined
Jun 24, 2018
Messages
33
Reaction score
0
hello people, I have a very rare error, I created an npc that grants a new vocation and it works, but when I log out and then log in, it does not enter the character and the .exe closes without showing any error.

i use otbr global 12.64
1.3 revscript

Anyone know about this bug? please help
 
OP
OP
G

God Aries

New Member
Joined
Jun 24, 2018
Messages
33
Reaction score
0
Show your vocations.xml and the npc script, please
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 function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end
    
    local vocations = {
    [5] = 9,
    [6] = 10,
    [7] = 11,
    [8] = 12,
}

    local player = Player(cid)
    if msgcontains(msg, "asender") then
        npcHandler:say("Estas listo para asender a chaotic por 2 crystal coins? ", cid)
        npcHandler.topic[cid] = 1
    elseif msgcontains(msg, "si") and npcHandler.topic[cid] == 1 then
       local vocation = player:getVocation()
       local vocID = vocation:getId()
       local PromotionPrice = 20000
       if vocations[vocID] then
       if player:removeMoney(PromotionPrice) then
       player:setVocation(Vocation(vocations[vocID]))
        selfSay('¡Aquí tiene!.', cid)
     else
     selfSay('Lo siento, Tu no tienes dinero.', cid)
     end
     else
     selfSay('Lo siento, Tu aun no eres digno de asender.', cid)
     end
     elseif(msgcontains(msg, 'no') and isInArray({1}) == TRUE) then
     selfSay('Ok entonces.', cid)
     end       


    return true
end

keywordHandler:addKeyword({'prom'}, StdModule.say, {npcHandler = npcHandler, text = 'di {asender} para ser asendido'})

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_GREET, "Hello |PLAYERNAME| di {prom} para ser asendido")
npcHandler:setMessage(MESSAGE_FAREWELL, "Por favor no dudes en volver. |PLAYERNAME|.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Por favor no dudes en volver. |PLAYERNAME|.")
npcHandler:addModule(FocusModule:new())
im noob for create scripts, but work the script, true?

my xml vocation

XML:
<?xml version="1.0" encoding="UTF-8"?>
<vocations>
    <vocation id="0" clientid="0" name="None" description="none" magicshield="0" gaincap="10" gainhp="5" gainmana="5" gainhpticks="12" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="4.0" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="0">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="2.0" />
        <skill id="2" multiplier="2.0" />
        <skill id="3" multiplier="2.0" />
        <skill id="4" multiplier="2.0" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="1" clientid="3" name="Sorcerer" description="a sorcerer" magicshield="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="3" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="1">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="2.0" />
        <skill id="2" multiplier="2.0" />
        <skill id="3" multiplier="2.0" />
        <skill id="4" multiplier="2.0" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="2" clientid="4" name="Druid" description="a druid" magicshield="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="3" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="2">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="1.8" />
        <skill id="2" multiplier="1.8" />
        <skill id="3" multiplier="1.8" />
        <skill id="4" multiplier="1.8" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="3" clientid="2" name="Paladin" description="a paladin" magicshield="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="8" gainhpamount="1" gainmanaticks="4" gainmanaamount="2" manamultiplier="1.4" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="3">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.2" />
        <skill id="1" multiplier="1.2" />
        <skill id="2" multiplier="1.2" />
        <skill id="3" multiplier="1.2" />
        <skill id="4" multiplier="1.1" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="4" clientid="1" name="Knight" description="a knight" magicshield="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="6" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="3.0" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="4">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.1" />
        <skill id="1" multiplier="1.1" />
        <skill id="2" multiplier="1.1" />
        <skill id="3" multiplier="1.1" />
        <skill id="4" multiplier="1.4" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="5" clientid="3" name="Master Sorcerer" description="a master sorcerer" magicshield="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="2" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="1">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="2.0" />
        <skill id="2" multiplier="2.0" />
        <skill id="3" multiplier="2.0" />
        <skill id="4" multiplier="2.0" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="6" clientid="4" name="Elder Druid" description="an elder druid" magicshield="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="2" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="2">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="1.8" />
        <skill id="2" multiplier="1.8" />
        <skill id="3" multiplier="1.8" />
        <skill id="4" multiplier="1.8" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="7" clientid="2" name="Royal Paladin" description="a royal paladin" magicshield="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="6" gainhpamount="1" gainmanaticks="3" gainmanaamount="2" manamultiplier="1.4" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="3">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.2" />
        <skill id="1" multiplier="1.2" />
        <skill id="2" multiplier="1.2" />
        <skill id="3" multiplier="1.2" />
        <skill id="4" multiplier="1.1" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="8" clientid="1" name="Elite Knight" description="an elite knight" magicshield="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="4" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="3.0" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="4">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.1" />
        <skill id="1" multiplier="1.1" />
        <skill id="2" multiplier="1.1" />
        <skill id="3" multiplier="1.1" />
        <skill id="4" multiplier="1.4" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="9" clientid="3" name="Chaotic Wizard" description="a chaotic wizard" gaincap="50" gainhp="45" gainmana="70" gainhpticks="12" gainhpamount="55" gainmanaticks="2" gainmanaamount="70" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="5">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="2.0" />
        <skill id="2" multiplier="2.0" />
        <skill id="3" multiplier="2.0" />
        <skill id="4" multiplier="2.0" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="10" clientid="4" name="Chaotic Shaman" description="an chaotic shaman" gaincap="50" gainhp="45" gainmana="70" gainhpticks="12" gainhpamount="55" gainmanaticks="2" gainmanaamount="70" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="6">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="1.8" />
        <skill id="2" multiplier="1.8" />
        <skill id="3" multiplier="1.8" />
        <skill id="4" multiplier="1.8" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="11" clientid="2" name="Chaotic Archer" description="a chaotic archer" gaincap="60" gainhp="50" gainmana="55" gainhpticks="8" gainhpamount="60" gainmanaticks="4" gainmanaamount="60" manamultiplier="1.4" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="7">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.2" />
        <skill id="1" multiplier="1.2" />
        <skill id="2" multiplier="1.2" />
        <skill id="3" multiplier="1.2" />
        <skill id="4" multiplier="1.1" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="12" clientid="1" name="Chaotic Warrior" description="an chaotic warrior" gaincap="65" gainhp="55" gainmana="50" gainhpticks="6" gainhpamount="70" gainmanaticks="6" gainmanaamount="50" manamultiplier="3.0" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="8">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.1" />
        <skill id="1" multiplier="1.1" />
        <skill id="2" multiplier="1.1" />
        <skill id="3" multiplier="1.1" />
        <skill id="4" multiplier="1.4" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
</vocations>
 

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
5,701
Solutions
408
Reaction score
3,813
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 function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end
 
    local vocations = {
    [5] = 9,
    [6] = 10,
    [7] = 11,
    [8] = 12,
}

    local player = Player(cid)
    if msgcontains(msg, "asender") then
        npcHandler:say("Estas listo para asender a chaotic por 2 crystal coins? ", cid)
        npcHandler.topic[cid] = 1
    elseif msgcontains(msg, "si") and npcHandler.topic[cid] == 1 then
       local vocation = player:getVocation()
       local vocID = vocation:getId()
       local PromotionPrice = 20000
       if vocations[vocID] then
       if player:removeMoney(PromotionPrice) then
       player:setVocation(Vocation(vocations[vocID]))
        selfSay('¡Aquí tiene!.', cid)
     else
     selfSay('Lo siento, Tu no tienes dinero.', cid)
     end
     else
     selfSay('Lo siento, Tu aun no eres digno de asender.', cid)
     end
     elseif(msgcontains(msg, 'no') and isInArray({1}) == TRUE) then
     selfSay('Ok entonces.', cid)
     end   


    return true
end

keywordHandler:addKeyword({'prom'}, StdModule.say, {npcHandler = npcHandler, text = 'di {asender} para ser asendido'})

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_GREET, "Hello |PLAYERNAME| di {prom} para ser asendido")
npcHandler:setMessage(MESSAGE_FAREWELL, "Por favor no dudes en volver. |PLAYERNAME|.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Por favor no dudes en volver. |PLAYERNAME|.")
npcHandler:addModule(FocusModule:new())
im noob for create scripts, but work the script, true?

my xml vocation

XML:
<?xml version="1.0" encoding="UTF-8"?>
<vocations>
    <vocation id="0" clientid="0" name="None" description="none" magicshield="0" gaincap="10" gainhp="5" gainmana="5" gainhpticks="12" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="4.0" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="0">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="2.0" />
        <skill id="2" multiplier="2.0" />
        <skill id="3" multiplier="2.0" />
        <skill id="4" multiplier="2.0" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="1" clientid="3" name="Sorcerer" description="a sorcerer" magicshield="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="3" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="1">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="2.0" />
        <skill id="2" multiplier="2.0" />
        <skill id="3" multiplier="2.0" />
        <skill id="4" multiplier="2.0" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="2" clientid="4" name="Druid" description="a druid" magicshield="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="3" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="2">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="1.8" />
        <skill id="2" multiplier="1.8" />
        <skill id="3" multiplier="1.8" />
        <skill id="4" multiplier="1.8" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="3" clientid="2" name="Paladin" description="a paladin" magicshield="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="8" gainhpamount="1" gainmanaticks="4" gainmanaamount="2" manamultiplier="1.4" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="3">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.2" />
        <skill id="1" multiplier="1.2" />
        <skill id="2" multiplier="1.2" />
        <skill id="3" multiplier="1.2" />
        <skill id="4" multiplier="1.1" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="4" clientid="1" name="Knight" description="a knight" magicshield="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="6" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="3.0" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="4">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.1" />
        <skill id="1" multiplier="1.1" />
        <skill id="2" multiplier="1.1" />
        <skill id="3" multiplier="1.1" />
        <skill id="4" multiplier="1.4" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="5" clientid="3" name="Master Sorcerer" description="a master sorcerer" magicshield="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="2" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="1">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="2.0" />
        <skill id="2" multiplier="2.0" />
        <skill id="3" multiplier="2.0" />
        <skill id="4" multiplier="2.0" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="6" clientid="4" name="Elder Druid" description="an elder druid" magicshield="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="2" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="2">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="1.8" />
        <skill id="2" multiplier="1.8" />
        <skill id="3" multiplier="1.8" />
        <skill id="4" multiplier="1.8" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="7" clientid="2" name="Royal Paladin" description="a royal paladin" magicshield="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="6" gainhpamount="1" gainmanaticks="3" gainmanaamount="2" manamultiplier="1.4" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="3">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.2" />
        <skill id="1" multiplier="1.2" />
        <skill id="2" multiplier="1.2" />
        <skill id="3" multiplier="1.2" />
        <skill id="4" multiplier="1.1" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="8" clientid="1" name="Elite Knight" description="an elite knight" magicshield="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="4" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="3.0" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="4">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.1" />
        <skill id="1" multiplier="1.1" />
        <skill id="2" multiplier="1.1" />
        <skill id="3" multiplier="1.1" />
        <skill id="4" multiplier="1.4" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="9" clientid="3" name="Chaotic Wizard" description="a chaotic wizard" gaincap="50" gainhp="45" gainmana="70" gainhpticks="12" gainhpamount="55" gainmanaticks="2" gainmanaamount="70" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="5">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="2.0" />
        <skill id="2" multiplier="2.0" />
        <skill id="3" multiplier="2.0" />
        <skill id="4" multiplier="2.0" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="10" clientid="4" name="Chaotic Shaman" description="an chaotic shaman" gaincap="50" gainhp="45" gainmana="70" gainhpticks="12" gainhpamount="55" gainmanaticks="2" gainmanaamount="70" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="6">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="1.8" />
        <skill id="2" multiplier="1.8" />
        <skill id="3" multiplier="1.8" />
        <skill id="4" multiplier="1.8" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="11" clientid="2" name="Chaotic Archer" description="a chaotic archer" gaincap="60" gainhp="50" gainmana="55" gainhpticks="8" gainhpamount="60" gainmanaticks="4" gainmanaamount="60" manamultiplier="1.4" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="7">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.2" />
        <skill id="1" multiplier="1.2" />
        <skill id="2" multiplier="1.2" />
        <skill id="3" multiplier="1.2" />
        <skill id="4" multiplier="1.1" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="12" clientid="1" name="Chaotic Warrior" description="an chaotic warrior" gaincap="65" gainhp="55" gainmana="50" gainhpticks="6" gainhpamount="70" gainmanaticks="6" gainmanaamount="50" manamultiplier="3.0" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="8">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.1" />
        <skill id="1" multiplier="1.1" />
        <skill id="2" multiplier="1.1" />
        <skill id="3" multiplier="1.1" />
        <skill id="4" multiplier="1.4" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
</vocations>
In your script you are doing a vocation change, as opposed to a promotion.

In the eyes of the players, there is no difference, but from the scripting point of view, it is different.

for vocation change, you need to make fromvoc the same as the vocation id

And in the npc, you want to save the player, after you've changed the vocation.
(I also fixed up some of the if statement logic, and added topicHandler resets.)
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 vocations = {
    [5] = 9,
    [6] = 10,
    [7] = 11,
    [8] = 12,
}

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

    local player = Player(cid)
    if msgcontains(msg, "asender") then
        npcHandler:say("Estas listo para asender a chaotic por 2 crystal coins? ", cid)
        npcHandler.topic[cid] = 1
    elseif msgcontains(msg, "si") and npcHandler.topic[cid] == 1 then
        local vocation = player:getVocation()
        local vocID = vocation:getId()
        local PromotionPrice = 20000
        if vocations[vocID] then
            if player:removeMoney(PromotionPrice) then
                player:setVocation(Vocation(vocations[vocID]))
                player:save()
                selfSay('¡Aquí tiene!.', cid)
            else
                selfSay('Lo siento, Tu no tienes dinero.', cid)
            end
        else
            selfSay('Lo siento, Tu aun no eres digno de asender.', cid)
        end
        npcHandler.topic[cid] = 0
    elseif npcHandler.topic[cid] == 1 then
        selfSay('Ok entonces.', cid)
        npcHandler.topic[cid] = 0
    end
    return true
end

keywordHandler:addKeyword({'prom'}, StdModule.say, {npcHandler = npcHandler, text = 'di {asender} para ser asendido'})

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_GREET, "Hello |PLAYERNAME| di {prom} para ser asendido")
npcHandler:setMessage(MESSAGE_FAREWELL, "Por favor no dudes en volver. |PLAYERNAME|.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Por favor no dudes en volver. |PLAYERNAME|.")
npcHandler:addModule(FocusModule:new())

XML:
<?xml version="1.0" encoding="UTF-8"?>
<vocations>
    <vocation id="0" clientid="0" name="None" description="none" magicshield="0" gaincap="10" gainhp="5" gainmana="5" gainhpticks="12" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="4.0" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="0">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="2.0" />
        <skill id="2" multiplier="2.0" />
        <skill id="3" multiplier="2.0" />
        <skill id="4" multiplier="2.0" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="1" clientid="3" name="Sorcerer" description="a sorcerer" magicshield="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="3" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="1">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="2.0" />
        <skill id="2" multiplier="2.0" />
        <skill id="3" multiplier="2.0" />
        <skill id="4" multiplier="2.0" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="2" clientid="4" name="Druid" description="a druid" magicshield="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="3" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="2">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="1.8" />
        <skill id="2" multiplier="1.8" />
        <skill id="3" multiplier="1.8" />
        <skill id="4" multiplier="1.8" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="3" clientid="2" name="Paladin" description="a paladin" magicshield="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="8" gainhpamount="1" gainmanaticks="4" gainmanaamount="2" manamultiplier="1.4" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="3">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.2" />
        <skill id="1" multiplier="1.2" />
        <skill id="2" multiplier="1.2" />
        <skill id="3" multiplier="1.2" />
        <skill id="4" multiplier="1.1" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="4" clientid="1" name="Knight" description="a knight" magicshield="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="6" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="3.0" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="4">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.1" />
        <skill id="1" multiplier="1.1" />
        <skill id="2" multiplier="1.1" />
        <skill id="3" multiplier="1.1" />
        <skill id="4" multiplier="1.4" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="5" clientid="3" name="Master Sorcerer" description="a master sorcerer" magicshield="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="2" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="5">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="2.0" />
        <skill id="2" multiplier="2.0" />
        <skill id="3" multiplier="2.0" />
        <skill id="4" multiplier="2.0" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="6" clientid="4" name="Elder Druid" description="an elder druid" magicshield="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="2" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="6">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="1.8" />
        <skill id="2" multiplier="1.8" />
        <skill id="3" multiplier="1.8" />
        <skill id="4" multiplier="1.8" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="7" clientid="2" name="Royal Paladin" description="a royal paladin" magicshield="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="6" gainhpamount="1" gainmanaticks="3" gainmanaamount="2" manamultiplier="1.4" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="7">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.2" />
        <skill id="1" multiplier="1.2" />
        <skill id="2" multiplier="1.2" />
        <skill id="3" multiplier="1.2" />
        <skill id="4" multiplier="1.1" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="8" clientid="1" name="Elite Knight" description="an elite knight" magicshield="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="4" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="3.0" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="8">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.1" />
        <skill id="1" multiplier="1.1" />
        <skill id="2" multiplier="1.1" />
        <skill id="3" multiplier="1.1" />
        <skill id="4" multiplier="1.4" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="9" clientid="3" name="Chaotic Wizard" description="a chaotic wizard" gaincap="50" gainhp="45" gainmana="70" gainhpticks="12" gainhpamount="55" gainmanaticks="2" gainmanaamount="70" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="9">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="2.0" />
        <skill id="2" multiplier="2.0" />
        <skill id="3" multiplier="2.0" />
        <skill id="4" multiplier="2.0" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="10" clientid="4" name="Chaotic Shaman" description="an chaotic shaman" gaincap="50" gainhp="45" gainmana="70" gainhpticks="12" gainhpamount="55" gainmanaticks="2" gainmanaamount="70" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="10">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="1.8" />
        <skill id="2" multiplier="1.8" />
        <skill id="3" multiplier="1.8" />
        <skill id="4" multiplier="1.8" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="11" clientid="2" name="Chaotic Archer" description="a chaotic archer" gaincap="60" gainhp="50" gainmana="55" gainhpticks="8" gainhpamount="60" gainmanaticks="4" gainmanaamount="60" manamultiplier="1.4" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="11">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.2" />
        <skill id="1" multiplier="1.2" />
        <skill id="2" multiplier="1.2" />
        <skill id="3" multiplier="1.2" />
        <skill id="4" multiplier="1.1" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="12" clientid="1" name="Chaotic Warrior" description="an chaotic warrior" gaincap="65" gainhp="55" gainmana="50" gainhpticks="6" gainhpamount="70" gainmanaticks="6" gainmanaamount="50" manamultiplier="3.0" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="12">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.1" />
        <skill id="1" multiplier="1.1" />
        <skill id="2" multiplier="1.1" />
        <skill id="3" multiplier="1.1" />
        <skill id="4" multiplier="1.4" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
</vocations>
 

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
5,701
Solutions
408
Reaction score
3,813
I am using almost same script but on talkactions and actions onUse.
Do I have to add player:save() too?
player:save() is mostly just a failsafe so you don't get the relog issue of people's vocation rolling back to the previous one.
So I would recommend using it, yes.
 
OP
OP
G

God Aries

New Member
Joined
Jun 24, 2018
Messages
33
Reaction score
0
In your script you are doing a vocation change, as opposed to a promotion.

In the eyes of the players, there is no difference, but from the scripting point of view, it is different.

for vocation change, you need to make fromvoc the same as the vocation id

And in the npc, you want to save the player, after you've changed the vocation.
(I also fixed up some of the if statement logic, and added topicHandler resets.)
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 vocations = {
    [5] = 9,
    [6] = 10,
    [7] = 11,
    [8] = 12,
}

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

    local player = Player(cid)
    if msgcontains(msg, "asender") then
        npcHandler:say("Estas listo para asender a chaotic por 2 crystal coins? ", cid)
        npcHandler.topic[cid] = 1
    elseif msgcontains(msg, "si") and npcHandler.topic[cid] == 1 then
        local vocation = player:getVocation()
        local vocID = vocation:getId()
        local PromotionPrice = 20000
        if vocations[vocID] then
            if player:removeMoney(PromotionPrice) then
                player:setVocation(Vocation(vocations[vocID]))
                player:save()
                selfSay('¡Aquí tiene!.', cid)
            else
                selfSay('Lo siento, Tu no tienes dinero.', cid)
            end
        else
            selfSay('Lo siento, Tu aun no eres digno de asender.', cid)
        end
        npcHandler.topic[cid] = 0
    elseif npcHandler.topic[cid] == 1 then
        selfSay('Ok entonces.', cid)
        npcHandler.topic[cid] = 0
    end
    return true
end

keywordHandler:addKeyword({'prom'}, StdModule.say, {npcHandler = npcHandler, text = 'di {asender} para ser asendido'})

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_GREET, "Hello |PLAYERNAME| di {prom} para ser asendido")
npcHandler:setMessage(MESSAGE_FAREWELL, "Por favor no dudes en volver. |PLAYERNAME|.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Por favor no dudes en volver. |PLAYERNAME|.")
npcHandler:addModule(FocusModule:new())

XML:
<?xml version="1.0" encoding="UTF-8"?>
<vocations>
    <vocation id="0" clientid="0" name="None" description="none" magicshield="0" gaincap="10" gainhp="5" gainmana="5" gainhpticks="12" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="4.0" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="0">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="2.0" />
        <skill id="2" multiplier="2.0" />
        <skill id="3" multiplier="2.0" />
        <skill id="4" multiplier="2.0" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="1" clientid="3" name="Sorcerer" description="a sorcerer" magicshield="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="3" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="1">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="2.0" />
        <skill id="2" multiplier="2.0" />
        <skill id="3" multiplier="2.0" />
        <skill id="4" multiplier="2.0" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="2" clientid="4" name="Druid" description="a druid" magicshield="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="3" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="2">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="1.8" />
        <skill id="2" multiplier="1.8" />
        <skill id="3" multiplier="1.8" />
        <skill id="4" multiplier="1.8" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="3" clientid="2" name="Paladin" description="a paladin" magicshield="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="8" gainhpamount="1" gainmanaticks="4" gainmanaamount="2" manamultiplier="1.4" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="3">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.2" />
        <skill id="1" multiplier="1.2" />
        <skill id="2" multiplier="1.2" />
        <skill id="3" multiplier="1.2" />
        <skill id="4" multiplier="1.1" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="4" clientid="1" name="Knight" description="a knight" magicshield="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="6" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="3.0" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="4">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.1" />
        <skill id="1" multiplier="1.1" />
        <skill id="2" multiplier="1.1" />
        <skill id="3" multiplier="1.1" />
        <skill id="4" multiplier="1.4" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="5" clientid="3" name="Master Sorcerer" description="a master sorcerer" magicshield="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="2" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="5">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="2.0" />
        <skill id="2" multiplier="2.0" />
        <skill id="3" multiplier="2.0" />
        <skill id="4" multiplier="2.0" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="6" clientid="4" name="Elder Druid" description="an elder druid" magicshield="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="12" gainhpamount="1" gainmanaticks="2" gainmanaamount="2" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="6">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="1.8" />
        <skill id="2" multiplier="1.8" />
        <skill id="3" multiplier="1.8" />
        <skill id="4" multiplier="1.8" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="7" clientid="2" name="Royal Paladin" description="a royal paladin" magicshield="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="6" gainhpamount="1" gainmanaticks="3" gainmanaamount="2" manamultiplier="1.4" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="7">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.2" />
        <skill id="1" multiplier="1.2" />
        <skill id="2" multiplier="1.2" />
        <skill id="3" multiplier="1.2" />
        <skill id="4" multiplier="1.1" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="8" clientid="1" name="Elite Knight" description="an elite knight" magicshield="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="4" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="3.0" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="8">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.1" />
        <skill id="1" multiplier="1.1" />
        <skill id="2" multiplier="1.1" />
        <skill id="3" multiplier="1.1" />
        <skill id="4" multiplier="1.4" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="9" clientid="3" name="Chaotic Wizard" description="a chaotic wizard" gaincap="50" gainhp="45" gainmana="70" gainhpticks="12" gainhpamount="55" gainmanaticks="2" gainmanaamount="70" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="9">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="2.0" />
        <skill id="2" multiplier="2.0" />
        <skill id="3" multiplier="2.0" />
        <skill id="4" multiplier="2.0" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="10" clientid="4" name="Chaotic Shaman" description="an chaotic shaman" gaincap="50" gainhp="45" gainmana="70" gainhpticks="12" gainhpamount="55" gainmanaticks="2" gainmanaamount="70" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="10">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="1.8" />
        <skill id="2" multiplier="1.8" />
        <skill id="3" multiplier="1.8" />
        <skill id="4" multiplier="1.8" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="11" clientid="2" name="Chaotic Archer" description="a chaotic archer" gaincap="60" gainhp="50" gainmana="55" gainhpticks="8" gainhpamount="60" gainmanaticks="4" gainmanaamount="60" manamultiplier="1.4" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="11">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.2" />
        <skill id="1" multiplier="1.2" />
        <skill id="2" multiplier="1.2" />
        <skill id="3" multiplier="1.2" />
        <skill id="4" multiplier="1.1" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
    <vocation id="12" clientid="1" name="Chaotic Warrior" description="an chaotic warrior" gaincap="65" gainhp="55" gainmana="50" gainhpticks="6" gainhpamount="70" gainmanaticks="6" gainmanaamount="50" manamultiplier="3.0" attackspeed="2000" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="12">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.1" />
        <skill id="1" multiplier="1.1" />
        <skill id="2" multiplier="1.1" />
        <skill id="3" multiplier="1.1" />
        <skill id="4" multiplier="1.4" />
        <skill id="5" multiplier="1.1" />
        <skill id="6" multiplier="1.1" />
    </vocation>
</vocations>
I tried the script, and the same thing happens, it gives me the vocation and when disconnecting and connecting, the .exe closes without error
 

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
5,701
Solutions
408
Reaction score
3,813
I tried the script, and the same thing happens, it gives me the vocation and when disconnecting and connecting, the .exe closes without error
Oh, I see.

Updated npc
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 vocations = {
    [5] = 9,
    [6] = 10,
    [7] = 11,
    [8] = 12,
}

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

    local player = Player(cid)
    if msgcontains(msg, "asender") then
        npcHandler:say("Estas listo para asender a chaotic por 2 crystal coins? ", cid)
        npcHandler.topic[cid] = 1
    elseif msgcontains(msg, "si") and npcHandler.topic[cid] == 1 then
        local vocation = player:getVocation()
        local vocID = vocation:getId()
        local PromotionPrice = 20000
        if vocations[vocID] then
            if player:removeMoney(PromotionPrice) then
                player:setVocation(vocations[vocID])
                player:save()
                selfSay('¡Aquí tiene!.', cid)
            else
                selfSay('Lo siento, Tu no tienes dinero.', cid)
            end
        else
            selfSay('Lo siento, Tu aun no eres digno de asender.', cid)
        end
        npcHandler.topic[cid] = 0
    elseif npcHandler.topic[cid] == 1 then
        selfSay('Ok entonces.', cid)
        npcHandler.topic[cid] = 0
    end
    return true
end

keywordHandler:addKeyword({'prom'}, StdModule.say, {npcHandler = npcHandler, text = 'di {asender} para ser asendido'})

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_GREET, "Hello |PLAYERNAME| di {prom} para ser asendido")
npcHandler:setMessage(MESSAGE_FAREWELL, "Por favor no dudes en volver. |PLAYERNAME|.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Por favor no dudes en volver. |PLAYERNAME|.")
npcHandler:addModule(FocusModule:new())
 
OP
OP
G

God Aries

New Member
Joined
Jun 24, 2018
Messages
33
Reaction score
0
Oh, I see.

Updated npc
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 vocations = {
    [5] = 9,
    [6] = 10,
    [7] = 11,
    [8] = 12,
}

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

    local player = Player(cid)
    if msgcontains(msg, "asender") then
        npcHandler:say("Estas listo para asender a chaotic por 2 crystal coins? ", cid)
        npcHandler.topic[cid] = 1
    elseif msgcontains(msg, "si") and npcHandler.topic[cid] == 1 then
        local vocation = player:getVocation()
        local vocID = vocation:getId()
        local PromotionPrice = 20000
        if vocations[vocID] then
            if player:removeMoney(PromotionPrice) then
                player:setVocation(vocations[vocID])
                player:save()
                selfSay('¡Aquí tiene!.', cid)
            else
                selfSay('Lo siento, Tu no tienes dinero.', cid)
            end
        else
            selfSay('Lo siento, Tu aun no eres digno de asender.', cid)
        end
        npcHandler.topic[cid] = 0
    elseif npcHandler.topic[cid] == 1 then
        selfSay('Ok entonces.', cid)
        npcHandler.topic[cid] = 0
    end
    return true
end

keywordHandler:addKeyword({'prom'}, StdModule.say, {npcHandler = npcHandler, text = 'di {asender} para ser asendido'})

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_GREET, "Hello |PLAYERNAME| di {prom} para ser asendido")
npcHandler:setMessage(MESSAGE_FAREWELL, "Por favor no dudes en volver. |PLAYERNAME|.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Por favor no dudes en volver. |PLAYERNAME|.")
npcHandler:addModule(FocusModule:new())
remains the same, won't it be a sources problem?
 

Sarah Wesker

ค∂vαηcε รүηтαx ❤
Support Team
Joined
Mar 16, 2017
Messages
1,042
Solutions
105
Reaction score
1,097
Location
London
GitHub
MillhioreBT
It seems that the problem is in its sources, there is no reason for the script to cause the engine to crash abruptly, better think about what changes you have been adding to your sources and if you have a good report we can help you, remember that you can not be merging things from different sources and more knowing that today TFS and OTSBR have changed a lot and they don't look much alike anymore

Obviously this is a guess, but it is better to notice things
 
OP
OP
G

God Aries

New Member
Joined
Jun 24, 2018
Messages
33
Reaction score
0
I have not edited anything in the sources, heck I did not think I had this curious problem, my server will stop until a hero helps me know what to do.
 

Sarah Wesker

ค∂vαηcε รүηтαx ❤
Support Team
Joined
Mar 16, 2017
Messages
1,042
Solutions
105
Reaction score
1,097
Location
London
GitHub
MillhioreBT
If you are using your own compiled engine, I recommend that you open your VS debugger, in fact when server crashed, wait a few seconds and automatically windows will give you two options, end the process or debug it, you choose to debug it, make sure to choose the version VS correct and then when the debugger opens, you will get information about why your server has crashed, if you do not understand what you see, you can post a screenshot here
 
Top