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

Help with prestige script I found, I need help editting it to work for tfs 1.2

Tempesto

Member
Joined
Feb 12, 2018
Messages
79
Reaction score
6
Location
Ruining your servers.
Now I made a lot of metatable changes but its still not working, here's the script:
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
    if(msgcontains(msg, 'prestige')) then
        selfSay('Are you ready to prestige and start a new life?', cid)
        talkState[talkUser] = 1
    elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
        -------CONFIGS-------
        local level = 717217
        local cost = 0
        ------/CONFIGS-------
        -----LOCALS-----
        local id = player:getGuid()
        local name = player:getName()
        local vocation = player:getVocation()
        local storage = player:getStorageValue(85987)
        local Max_Rebirth = 10000  --Change this for the number of rebirths
        ----/LOCALS-----
        if(player:getLevel() >= level) then
        if player:getStorageValue(85987) < Max_Rebirth then
            if(player:removeMoney(cost) == TRUE) then
                if(isInArray({5, 6, 7, 8}, vocation)) then
                    player:setStorageValue(85987, storage == -1 and 1 or storage + 1)
                                db.executeQuery('UPDATE players SET rebirths=rebirths+'.. 1 ..' WHERE id='..player:getGuid())
                            doBroadcastMessage("" ..  name .. " has just prestiged!", TALKTYPE_ORANGE_1)
                    player:remove()
                    db.executeQuery("UPDATE `players` SET `level` = 8, `experience` = 4200")
                    db.executeQuery("UPDATE `players` SET `name` = '"..name.."' WHERE `id` ='"..id.."';")
                else
                    selfSay('Please talk with Forgotten King and promote first.', cid)
                    talkState[talkUser] = 0
                end
            else
                selfSay('You don\'t have enough money. You need to pay 0 mil to be rebirthed.', cid)
                talkState[talkUser] = 0
            end
        else
            selfSay('You have reached the maximum rebirth.', cid)
            talkState[talkUser] = 0
        end
    else
        selfSay('Only characters of level 717217 or higher can be rebirthed.', cid)
        talkState[talkUser] = 0
    end
elseif(msgcontains(msg, 'no') and talkState[talkUser] == 1) then
        selfSay('Okey. Come back when you feel ready.', cid)
        talkState[talkUser] = 0
end
    return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

I'm getting these errors:

Code:
Lua Script Error: [Npc interface]
data/npcs/scripts/Prestiger.lua:onCreatureSay
data/npc/scripts/Prestiger.lua:27: attempt to index global 'player' (a nil value)
stack traceback:
            [C]: in function ' __index'
             data/npc/scripts/Prestiger.lua:27: in function 'callback'
             data/npc/lib/npcsystem/npchandler.lua:411: in function <data/npcs/scripts/Prestiger.lua:8>

Lua Script Error: [Npc interface]
data/npc/scripts/Prestiger.lua:onCreatureSay
data/npc/scripts/Prestiger.lua:27:  attempt to index global 'player' (a nil value)
stack traceback:
         [C]: in function '__index'
         data/npc/scripts/Prestiger.lua:27 in function 'callback'
         data/npc/lib/npcsystem/npchandler.lua:411: in function 'onCreatureSay'
         data/npc/scripts/Prestiger.lua:8: in function <data/npc/scripts/Prestiger.lua:8>

Some code you need to look at to help me probably is on my pastebin:
You can jump to the different 4 scripts at ctrl + f and type in "455555555" find next etc
4 luas - Pastebin.com


I gather that those files are relevant because I see a lot of pull-code from those files
Npcsystem.lua , npchandler.lua , modules.lua, keywordhandler.lua


Could someone help me please :)?
 
Solution
forgot to swap player for self
you don't even need that column or that line, you can remove the entire thing
prestiges are handled by storage values, and the storage value already gets incremented, making that rebirths column useless
Lua:
function Player:onLook(thing, position, distance)
    local description = "You see " .. thing:getDescription(distance)
    if self:getGroup():getAccess() then
        if thing:isItem() then
            description = string.format("%s\nItem ID: %d", description, thing:getId())

            local actionId = thing:getActionId()
            if actionId ~= 0 then
                description = string.format("%s, Action ID: %d", description, actionId)
            end

            local uniqueId =...
Thank you for helping Vulcan. Now I'm getting a much shorter and different error:

Code:
[Error - CreatureEvent::configureEvent] Invalid type for creature event PrestigerDescription
[Warning - BaseEvents::loadFromXml] Failed to configure event

I think its referring to where I have it added properly into creaturescripts.xml:

XML:
<event type="look" name="PrestigerDescription" script="Prestigerdescription.lua"/>

Prestigerdescription.lua from data/creaturescripts/scripts/
Lua:
function onLook(cid, thing, position, lookDistance)
    if isPlayer(thing.uid) and thing.uid ~= cid then
        local sex = player:getSex(thing.uid) ---might need to remove thing.uid for () ---
        local message = "You see " .. player:getname(thing.uid) .. " (Level " .. player:getLevel(thing.uid) .. ")."
        if(getPlayerFlagValue(thing.uid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION)) then
            message = message .. " " .. (sex == PLAYERSEX_FEMALE and "She" or "He") .. " is a " .. player:getGroup(thing.uid) .. "."
        elseif(player:getVocation(thing.uid) ~= 0) then
            message = message .. " " .. (sex == PLAYERSEX_FEMALE and "She" or "He") .. " is a " .. player:getVocation(thing.uid):lower() .. "."
        else
            message = message .. " " .. (sex == PLAYERSEX_FEMALE and "She" or "He") .. " has no vocation."
        end
        if(Player:getNameByGuid(guid)(getPlayerMarriageStatus(thing.uid), false, false) ~= nil) then
            message = message .. " " .. (sex == PLAYERSEX_FEMALE and "She" or "He") .. " is " .. (sex == PLAYERSEX_FEMALE and "wife" or "husband") .. " of " .. Player:getNameByGuid(guid)(getPlayerMarriageStatus(thing.uid)) .. "."
        end
        if(player:getGuild(thing.uid) > 0) then
            message = message .. " " .. (sex == PLAYERSEX_FEMALE and "She" or "He") .. " is " .. (player:getGuildLevel(thing.uid) == "" and "a member" or player:getGuildLevel()(thing.uid)) .. " of the " .. player:getGuildNick(thing.uid)
            message = getPlayerGuildNick(thing.uid) ~= "" and message .. " (" .. getPlayerGuildNick(thing.uid) .. ")." or message .. "."
        end
        if(getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS)) then
            message = message .. "\nHealth: [" .. player:getHealth(thing.uid) .. " / " .. player:getMaxHealth(thing.uid) .. "], Mana: [" .. Player:getMana(thing.uid) .. " / " .. player:getMaxMana(thing.uid) .. "]."
        end
        if(getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION)) then
            message = message .. "\nPosition: [X: " .. position.x .. "] [Y: " .. position.y .. "] [Z: " .. position.z .. "]."
        end
 player:sendTextMessage(MESSAGE_INFO_DESCR, message .. )(sex == PLAYERSEX_FEMALE and " \nShe" or " \nHe") .. " has prestiged " .. (player:getStorageValue(thing.uid, 85987) == -1 and "0" or player:getStorageValue(thing.uid, 85987)) .. " " .. (math.abs(player:getStorageValue(thing.uid, 85987)) == 1 and "time." or "times."))
        return false
    elseif thing.uid == cid then
        local message = "You see yourself."
        if(getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION)) then
            message = message .. " You are " .. player:getGroup(cid) .. "."
        elseif(player:getVocation(cid) ~= 0) then
            message = message .. " You are a " .. player:getVocation(thing.uid):lower() .. "."
        else
            message = message .. " You have no vocation."
        end
        if(Player:getNameByGuid(guid)(getPlayerMarriageStatus(thing.uid), false, false) ~= nil) then
            message = message .. " You are " .. (getPlayerSex(cid) == PLAYERSEX_FEMALE and "wife" or "husband") .. " of " .. getPlayerNameByGUID(getPlayerPartner(cid)) .. "."
        end
        if(player:getGuild(cid) > 0) then
            message = message .. " You are " .. (player:getGuildLevel(cid) == "" and "a member" or player:getGuildLevel(cid)) .. " of the " .. player:getGuild(cid)
            message = player:getGuildNick(cid) ~= "" and message .. " (" .. player:getGuildNick()(cid) .. ")." or message .. "."
        end
        if(getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS)) then
            message = message .. "\nHealth: [" .. player:getHealth(cid) .. " / " .. player:getMaxHealth(cid) .. "], Mana: [" .. player:getMana(cid) .. " / " .. player:getMaxMana(cid) .. "]."
        end
        if(getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION)) then
            message = message .. "\nPosition: [X: " .. position.x .. "] [Y: " .. position.y .. "] [Z: " .. position.z .. "]."
        end
        return false, player:sendTextMessage(MESSAGE_INFO_DESCR, message .. ) " \nYou have prestiged " .. (player:getStorageValue(cid, 85987) == -1 and "0" or player:getStorageValue(cid, 85987)) .. " " .. (player:getStorageValue(cid, 85987) == 1 and "time." or "times."))
  
   end
    return true
end

What's next to fix? Do you know?
 
because newer tfs doesn't use onLook scripts anymore, it uses 1 event
data/events/scripts/player.lua @ Player:eek:nLook
post that here
 
Player.lua
Lua:
function Player:onBrowseField(position)
   return true
end

function Player:onLook(thing, position, distance)
   local description = "You see " .. thing:getDescription(distance)
   if self:getGroup():getAccess() then
       if thing:isItem() then
           description = string.format("%s\nItem ID: %d", description, thing:getId())

           local actionId = thing:getActionId()
           if actionId ~= 0 then
               description = string.format("%s, Action ID: %d", description, actionId)
           end

           local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
           if uniqueId > 0 and uniqueId < 65536 then
               description = string.format("%s, Unique ID: %d", description, uniqueId)
           end

           local itemType = thing:getType()

           local transformEquipId = itemType:getTransformEquipId()
           local transformDeEquipId = itemType:getTransformDeEquipId()
           if transformEquipId ~= 0 then
               description = string.format("%s\nTransforms to: %d (onEquip)", description, transformEquipId)
           elseif transformDeEquipId ~= 0 then
               description = string.format("%s\nTransforms to: %d (onDeEquip)", description, transformDeEquipId)
           end

           local decayId = itemType:getDecayId()
           if decayId ~= -1 then
               description = string.format("%s\nDecays to: %d", description, decayId)
           end
       elseif thing:isCreature() then
           local str = "%s\nHealth: %d / %d"
           if thing:getMaxMana() > 0 then
               str = string.format("%s, Mana: %d / %d", str, thing:getMana(), thing:getMaxMana())
           end
           description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. "."
       end

       local position = thing:getPosition()
       description = string.format(
           "%s\nPosition: %d, %d, %d",
           description, position.x, position.y, position.z
       )

       if thing:isCreature() then
           if thing:isPlayer() then
               description = string.format("%s\nIP: %s.", description, Game.convertIpToString(thing:getIp()))
           end
       end
   end
   self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end

function Player:onLookInBattleList(creature, distance)
   local description = "You see " .. creature:getDescription(distance)
   if self:getGroup():getAccess() then
       local str = "%s\nHealth: %d / %d"
       if creature:getMaxMana() > 0 then
           str = string.format("%s, Mana: %d / %d", str, creature:getMana(), creature:getMaxMana())
       end
       description = string.format(str, description, creature:getHealth(), creature:getMaxHealth()) .. "."

       local position = creature:getPosition()
       description = string.format(
           "%s\nPosition: %d, %d, %d",
           description, position.x, position.y, position.z
       )

       if creature:isPlayer() then
           description = string.format("%s\nIP: %s", description, Game.convertIpToString(creature:getIp()))
       end
   end
   self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end

function Player:onLookInTrade(partner, item, distance)
   self:sendTextMessage(MESSAGE_INFO_DESCR, "You see " .. item:getDescription(distance))
end

function Player:onLookInShop(itemType, count)
   return true
end

function Player:onMoveItem(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
   return true
end

function Player:onMoveCreature(creature, fromPosition, toPosition)
   return true
end

function Player:onTurn(direction)
    if self:getGroup():getAccess() and self:getDirection() == direction then
        local nextPosition = self:getPosition()
        nextPosition:getNextPosition(direction)
        self:teleportTo(nextPosition, true)
    end
    return true
end
--redflag

function Player:onTradeRequest(target, item)
   return true
end

function Player:onTradeAccept(target, item, targetItem)
   return true
end

local soulCondition = Condition(CONDITION_SOUL, CONDITIONID_DEFAULT)
soulCondition:setTicks(4 * 60 * 1000)
soulCondition:setParameter(CONDITION_PARAM_SOULGAIN, 1)

local function useStamina(player)
   local staminaMinutes = player:getStamina()
   if staminaMinutes == 0 then
       return
   end

   local playerId = player:getId()
   local currentTime = os.time()
   local timePassed = currentTime - nextUseStaminaTime[playerId]
   if timePassed <= 0 then
       return
   end

   if timePassed > 60 then
       if staminaMinutes > 2 then
           staminaMinutes = staminaMinutes - 2
       else
           staminaMinutes = 0
       end
       nextUseStaminaTime[playerId] = currentTime + 120
   else
       staminaMinutes = staminaMinutes - 1
       nextUseStaminaTime[playerId] = currentTime + 60
   end
   player:setStamina(staminaMinutes)
end

function Player:onGainExperience(source, exp, rawExp)
   if not source or source:isPlayer() then
       return exp
   end

   -- Soul regeneration
   local vocation = self:getVocation()
   if self:getSoul() < vocation:getMaxSoul() and exp >= self:getLevel() then
       soulCondition:setParameter(CONDITION_PARAM_SOULTICKS, vocation:getSoulGainTicks() * 1000)
       self:addCondition(soulCondition)
   end

   -- Apply experience stage multiplier
   exp = exp * Game.getExperienceStage(self:getLevel())

   -- Stamina modifier
   if configManager.getBoolean(configKeys.STAMINA_SYSTEM) then
       useStamina(self)

       local staminaMinutes = self:getStamina()
       if staminaMinutes > 2400 and self:isPremium() then
           exp = exp * 1.5
       elseif staminaMinutes <= 840 then
           exp = exp * 0.5
       end
   end

   return exp
end

function Player:onLoseExperience(exp)
   return exp
end

function Player:onGainSkillTries(skill, tries)
   if APPLY_SKILL_MULTIPLIER == false then
       return tries
   end

   if skill == SKILL_MAGLEVEL then
       return tries * configManager.getNumber(configKeys.RATE_MAGIC)
   end
   return tries * configManager.getNumber(configKeys.RATE_SKILL)
end

This is weird:

17:52 Tort [61857: hi
17:52 Prestige Npc: Hello Tort. Im in charge of the 'Prestige' system.
17:52 Prestige Npc: Hello Tort. Im in charge of the 'Prestige' system.
17:52 Prestige Npc: Hello Tort. Im in charge of the 'Prestige' system.
17:52 Tort [61857: Prestige
17:52 Prestige Npc: Are you ready to prestige and start a new life?
17:52 Prestige Npc: Are you ready to prestige and start a new life?
17:52 Prestige Npc: Are you ready to prestige and start a new life?
17:52 Tort [61857: yes
17:52 Prestige Npc: Please talk with Forgotten King and promote first.
17:52 Prestige Npc: Please talk with Forgotten King and promote first.
17:52 Prestige Npc: Please talk with Forgotten King and promote first.
17:51 You see yourself. You are a master sorcerer.
I am promoted and premy.. -.-. lol
 
Last edited:
replace the entire Player:eek:nLook function with this
Lua:
function Player:onLook(thing, position, distance)
    local description = "You see " .. thing:getDescription(distance)
    if self:getGroup():getAccess() then
        if thing:isItem() then
            description = string.format("%s\nItem ID: %d", description, thing:getId())

            local actionId = thing:getActionId()
            if actionId ~= 0 then
                description = string.format("%s, Action ID: %d", description, actionId)
            end

            local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
            if uniqueId > 0 and uniqueId < 65536 then
                description = string.format("%s, Unique ID: %d", description, uniqueId)
            end

            local itemType = thing:getType()

            local transformEquipId = itemType:getTransformEquipId()
            local transformDeEquipId = itemType:getTransformDeEquipId()
            if transformEquipId ~= 0 then
                description = string.format("%s\nTransforms to: %d (onEquip)", description, transformEquipId)
            elseif transformDeEquipId ~= 0 then
                description = string.format("%s\nTransforms to: %d (onDeEquip)", description, transformDeEquipId)
            end

            local decayId = itemType:getDecayId()
            if decayId ~= -1 then
                description = string.format("%s\nDecays to: %d", description, decayId)
            end
        elseif thing:isCreature() then
            local str = "%s\nHealth: %d / %d"
            if thing:isPlayer() and thing:getMaxMana() > 0 then
                str = string.format("%s, Mana: %d / %d", str, thing:getMana(), thing:getMaxMana())
            end
            description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. "."
        end

        local position = thing:getPosition()
        description = string.format(
            "%s\nPosition: %d, %d, %d",
            description, position.x, position.y, position.z
        )
    end
    if thing:isPlayer() then
        local prestige = player:getStorageValue(85987)
        description = string.format("%s\nYou have prestiged %d %s%s", (prestige == -1 and 0 or prestige), (prestige == 1) and "time." or "times.")
    end
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end
as for your npc, i have no idea
 
db.executeQuery('UPDATE players SET rebirths=rebirths+'.. 1 ..' WHERE id='..player:getGuid())

I don't have a column for "rebirths" in my table for my players. I think this might be a problem. How do I add in a column for it with sql code with phpmyadmin? Should be simple, I just don't want to make any mistakes.

CREATE column Where 'players' <<< what is it to type in?

EDIT: I added a column Rebirths. Still doesn't work

I think its skipping that code and going to an "else" such as "get promoted" because I don't have a 'rebirth' column already.

@Vulcan_ I went back to my old Player.lua, yours made it impossible to use the 'look' command from the modal window right click. and it didnt work.
 
Last edited:
forgot to swap player for self
you don't even need that column or that line, you can remove the entire thing
prestiges are handled by storage values, and the storage value already gets incremented, making that rebirths column useless
Lua:
function Player:onLook(thing, position, distance)
    local description = "You see " .. thing:getDescription(distance)
    if self:getGroup():getAccess() then
        if thing:isItem() then
            description = string.format("%s\nItem ID: %d", description, thing:getId())

            local actionId = thing:getActionId()
            if actionId ~= 0 then
                description = string.format("%s, Action ID: %d", description, actionId)
            end

            local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
            if uniqueId > 0 and uniqueId < 65536 then
                description = string.format("%s, Unique ID: %d", description, uniqueId)
            end

            local itemType = thing:getType()

            local transformEquipId = itemType:getTransformEquipId()
            local transformDeEquipId = itemType:getTransformDeEquipId()
            if transformEquipId ~= 0 then
                description = string.format("%s\nTransforms to: %d (onEquip)", description, transformEquipId)
            elseif transformDeEquipId ~= 0 then
                description = string.format("%s\nTransforms to: %d (onDeEquip)", description, transformDeEquipId)
            end

            local decayId = itemType:getDecayId()
            if decayId ~= -1 then
                description = string.format("%s\nDecays to: %d", description, decayId)
            end
        elseif thing:isCreature() then
            local str = "%s\nHealth: %d / %d"
            if thing:isPlayer() and thing:getMaxMana() > 0 then
                str = string.format("%s, Mana: %d / %d", str, thing:getMana(), thing:getMaxMana())
            end
            description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. "."
        end

        local position = thing:getPosition()
        description = string.format(
            "%s\nPosition: %d, %d, %d",
            description, position.x, position.y, position.z
        )
    end
    if thing:isPlayer() then
        local prestige = self:getStorageValue(85987)
        description = string.format("%s\nYou have prestiged %d %s%s", (prestige == -1 and 0 or prestige), (prestige == 1) and "time." or "times.")
    end
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end
 
Solution
forgot to swap player for self
you don't even need that column or that line, you can remove the entire thing
prestiges are handled by storage values, and the storage value already gets incremented, making that rebirths column useless
Lua:
function Player:onLook(thing, position, distance)
    local description = "You see " .. thing:getDescription(distance)
    if self:getGroup():getAccess() then
        if thing:isItem() then
            description = string.format("%s\nItem ID: %d", description, thing:getId())

            local actionId = thing:getActionId()
            if actionId ~= 0 then
                description = string.format("%s, Action ID: %d", description, actionId)
            end

            local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
            if uniqueId > 0 and uniqueId < 65536 then
                description = string.format("%s, Unique ID: %d", description, uniqueId)
            end

            local itemType = thing:getType()

            local transformEquipId = itemType:getTransformEquipId()
            local transformDeEquipId = itemType:getTransformDeEquipId()
            if transformEquipId ~= 0 then
                description = string.format("%s\nTransforms to: %d (onEquip)", description, transformEquipId)
            elseif transformDeEquipId ~= 0 then
                description = string.format("%s\nTransforms to: %d (onDeEquip)", description, transformDeEquipId)
            end

            local decayId = itemType:getDecayId()
            if decayId ~= -1 then
                description = string.format("%s\nDecays to: %d", description, decayId)
            end
        elseif thing:isCreature() then
            local str = "%s\nHealth: %d / %d"
            if thing:isPlayer() and thing:getMaxMana() > 0 then
                str = string.format("%s, Mana: %d / %d", str, thing:getMana(), thing:getMaxMana())
            end
            description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. "."
        end

        local position = thing:getPosition()
        description = string.format(
            "%s\nPosition: %d, %d, %d",
            description, position.x, position.y, position.z
        )
    end
    if thing:isPlayer() then
        local prestige = self:getStorageValue(85987)
        description = string.format("%s\nYou have prestiged %d %s%s", (prestige == -1 and 0 or prestige), (prestige == 1) and "time." or "times.")
    end
    self:sendTextMessage(MESSAGE_INFO_DESCR, description)
end


Well, I can "look" again with that script but not "look" at myself lol. But it didn't fix my npc. I still get that
Code:
[Error - CreatureEvent::configureEvent] Invalid type for creature event PrestigerDescription
[Warning - BaseEvents::loadFromXml] Failed to configure event
and he still says I need a promotion. Very weird. Any other ideas? xD

Since that comes "else" after the "ifs" I suspect something is wrong with dbquerys. I just don't know what. Or I could be wrong, idk why its not working. It looks like it should.
 
Last edited:
you need to remove the xml line from creaturescripts.xml along with the onLook script you were trying to register before
you don't need to register the look anymore, you just have to edit player:eek:nlook
the problem with promotion in your script is because you use this
Lua:
local vocation = player:getVocation()
vocation is a class now, not an id
so you need to use vocation:getId() like this
Lua:
local vocation = player:getVocation() and player:getVocation():getId() or 0
 
you need to remove the xml line from creaturescripts.xml along with the onLook script you were trying to register before
you don't need to register the look anymore, you just have to edit player:eek:nlook
the problem with promotion in your script is because you use this
Lua:
local vocation = player:getVocation()
vocation is a class now, not an id
so you need to use vocation:getId() like this
Lua:
local vocation = player:getVocation() and player:getVocation():getId() or 0
I changed it. It's still not working. Some errors. And he doesn't do the else which is "Go get a promo" << I'm speaking in laymans terms not actual wordscript. He asks me if I want a prestige after I say "hi" and then I say, "yes" and he doesn't respond and nothing happens.
Code:
Lua Script Error: [Npc interface]
data/npc/scripts/Prestiger.lua:onCreatureSay
data/npc/scripts/Prestiger.lua:42: attempt to call field 'Execute query' (a nil value)
stack traceback
[C]: in function 'executeQuery'
data/npc/scripts/Prestiger.lua:42: in function 'callback'
data/npc/lib/npcsystem/npchandler.lua:411: in function 'onCreatureSay'
data/npc/scripts/Prestiger.lua:8: in function  <data/npc/scripts/Prestiger.lua:8>

This is annoying, thanks for helping so long Vulcan. I appreciate it, I really want to get this to work.

I think its just wrong sql code.
 
Last edited:
change db.executeQuery to db.query
Okay, I've done that. The new error is:
Code:
Lua Script Error:  [Npc interface]
data/npc/scripts/Prestiger.lua:onCreatureSay
data/npc/scripts/Prestiger.lua:43: attempt to call global 'doBroadcastMessage' (a nil value)
stack traceback:
                      [C]: in function 'doBroadcastMessage'
                       data/npc/scripts/Prestiger.lua:43: in function 'callback'
                       data/npc/lib/npcsystem/npchandler.lua:411: in function 'onCreatureSay'
                       data/npc/scripts/Prestiger.lua:8: in function <data/npc/scripts/Prestiger.lua:8>
I did this Game.broadcastMessage("" .. name .. " has just prestiged!", TALKTYPE_ORANGE_1)

Now it works xD
 
Back
Top