• 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 SCRIPT TFS 1.3

adrianootavares

New Member
Joined
Jul 23, 2012
Messages
112
Reaction score
4
Location
Salvador - Bahia - Brasil
Lua:
local config = {
skills_amount = 1, -- quantidade de skills que o player ganhará se ele for Knight ou Paladin
magiclevel_amount = 1, -- quantidade de magic levels o player ganhará se ele for Druid ou Sorcerer
storage = 10000, -- Storage para quest.
uniqueID = 1000, -- UniqueID que você colocará no Map Editor
mensagem = "Voce recebeu "..config.skills_amount.." skills e "..config.magiclevel_amount.." magic levels.",
}

local skills_id = {1, 2, 3, 4, 5} -- Não mexer.
       
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(item.uid == config.uniqueID) then
        if getPlayerStorageValue(cid, config.storage) == -1 then
            if isInArray({1, 2, 5, 6}, getPlayerVocation(cid)) then
                for i = 1, table.maxn(skills_id) do
                    doPlayerAddSkill(cid, skills_id[i], config.skills_amount)
                end
            else
                doPlayerAddMagLevel(cid, config.magiclevel_amount)
            end
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, config.mensagem)
            setPlayerStorageValue(cid, config.storage, 1)
        else
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Voce ja recebeu seu premio.")
        end
    end
return true
end


<action uniqueid="10000" script="skillreward.lua"/>


BUG:::

 
Lua:
local config = {
skills_amount = 1, -- quantidade de skills que o player ganhará se ele for Knight ou Paladin
magiclevel_amount = 1, -- quantidade de magic levels o player ganhará se ele for Druid ou Sorcerer
storage = 10000, -- Storage para quest.
uniqueID = 1000, -- UniqueID que você colocará no Map Editor
mensagem = "Voce recebeu "..config.skills_amount.." skills e "..config.magiclevel_amount.." magic levels."
}

local skills_id = {1, 2, 3, 4, 5} -- Não mexer.
   
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if(item.uid == config.uniqueID) then
        if player:getStorageValue(config.storage) == -1 then
            if isInArray({1, 2, 5, 6}, player:getVocation():getId()) then
                for i = 1, table.maxn(skills_id) do
                    doPlayerAddSkill(cid, skills_id[i], config.skills_amount) -- not sure about this
                end
            else
                doPlayerAddMagLevel(cid, config.magiclevel_amount) -- not sure about this
            end
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, config.mensagem)
            player:setStorageValue(config.storage, 1)
        else
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Voce ja recebeu seu premio.")
        end
    end
return true
end

I dont think that doPlayerAddMagLevel and doPlayerAddSkill works in 1.3, this script was originally meant for 0.3.6 or 0.4 which has some added things that 1.3 doesnt have.

Take a look at this, to get an idea of how its implemented in 1.3

So maybe something like
Lua:
local config = {
skills_amount = 1, -- quantidade de skills que o player ganhará se ele for Knight ou Paladin
magiclevel_amount = 1, -- quantidade de magic levels o player ganhará se ele for Druid ou Sorcerer
storage = 10000, -- Storage para quest.
uniqueID = 1000, -- UniqueID que você colocará no Map Editor
mensagem = "Voce recebeu "..config.skills_amount.." skills e "..config.magiclevel_amount.." magic levels."
}

local skills_id = {SKILL_CLUB, SKILL_AXE, SKILL_AXE, SKILL_DISTANCE, SKILL_SHIELD} -- Não mexer.
      
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if(item.uid == config.uniqueID) then
        if player:getStorageValue(config.storage) == -1 then
            if isInArray({1, 2, 5, 6}, player:getVocation():getId()) then
                for i = 1, table.maxn(skills_id) do
                    player:addSkillTries(skills_id[i], target:getVocation():getRequiredSkillTries(skills_id[i], player:getSkillLevel(skills_id[i]) + skills_amount) - player:getSkillTries(skills_id[i]))
                end
            else
                player:addManaSpent(player:getVocation():getRequiredManaSpent(player:getBaseMagicLevel() + magiclevel_amount) - target:getManaSpent())
            end
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, config.mensagem)
            player:setStorageValue(config.storage, 1)
        else
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Voce ja recebeu seu premio.")
        end
    end
return true
end
could work:rolleyes:
 
Last edited:
Lua:
local config = {
skills_amount = 1, -- quantidade de skills que o player ganhará se ele for Knight ou Paladin
magiclevel_amount = 1, -- quantidade de magic levels o player ganhará se ele for Druid ou Sorcerer
storage = 10000, -- Storage para quest.
uniqueID = 1000, -- UniqueID que você colocará no Map Editor
mensagem = "Voce recebeu "..config.skills_amount.." skills e "..config.magiclevel_amount.." magic levels."
}

local skills_id = {1, 2, 3, 4, 5} -- Não mexer.
  
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if(item.uid == config.uniqueID) then
        if player:getStorageValue(config.storage) == -1 then
            if isInArray({1, 2, 5, 6}, player:getVocation():getId()) then
                for i = 1, table.maxn(skills_id) do
                    doPlayerAddSkill(cid, skills_id[i], config.skills_amount) -- not sure about this
                end
            else
                doPlayerAddMagLevel(cid, config.magiclevel_amount) -- not sure about this
            end
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, config.mensagem)
            player:setStorageValue(config.storage, 1)
        else
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Voce ja recebeu seu premio.")
        end
    end
return true
end

I dont think that doPlayerAddMagLevel and doPlayerAddSkill works in 1.3, this script was originally meant for 0.3.6 or 0.4 which has some added things that 1.3 doesnt have.

Take a look at this, to get an idea of how its implemented in 1.3

So maybe something like
Lua:
local config = {
skills_amount = 1, -- quantidade de skills que o player ganhará se ele for Knight ou Paladin
magiclevel_amount = 1, -- quantidade de magic levels o player ganhará se ele for Druid ou Sorcerer
storage = 10000, -- Storage para quest.
uniqueID = 1000, -- UniqueID que você colocará no Map Editor
mensagem = "Voce recebeu "..config.skills_amount.." skills e "..config.magiclevel_amount.." magic levels."
}

local skills_id = {SKILL_CLUB, SKILL_AXE, SKILL_AXE, SKILL_DISTANCE, SKILL_SHIELD} -- Não mexer.
     
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if(item.uid == config.uniqueID) then
        if player:getStorageValue(config.storage) == -1 then
            if isInArray({1, 2, 5, 6}, player:getVocation():getId()) then
                for i = 1, table.maxn(skills_id) do
                    player:addSkillTries(skills_id[i], target:getVocation():getRequiredSkillTries(skills_id[i], player:getSkillLevel(skills_id[i]) + skills_amount) - player:getSkillTries(skills_id[i]))
                end
            else
                player:addManaSpent(player:getVocation():getRequiredManaSpent(player:getBaseMagicLevel() + magiclevel_amount) - target:getManaSpent())
            end
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, config.mensagem)
            player:setStorageValue(config.storage, 1)
        else
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Voce ja recebeu seu premio.")
        end
    end
return true
end
could work:rolleyes:



 
Lua:
local config = {
skills_amount = 1, -- quantidade de skills que o player ganhará se ele for Knight ou Paladin
magiclevel_amount = 1, -- quantidade de magic levels o player ganhará se ele for Druid ou Sorcerer
storage = 10000, -- Storage para quest.
uniqueID = 1000 -- UniqueID que você colocará no Map Editor
}

local skills_id = {SKILL_CLUB, SKILL_AXE, SKILL_AXE, SKILL_DISTANCE, SKILL_SHIELD} -- Não mexer.
    
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    mensagem = "Voce recebeu "..config.skills_amount.." skills e "..config.magiclevel_amount.." magic levels."
    if(item.uid == config.uniqueID) then
        if player:getStorageValue(config.storage) == -1 then
            if isInArray({1, 2, 5, 6}, player:getVocation():getId()) then
                for i = 1, table.maxn(skills_id) do
                    player:addSkillTries(skills_id[i], target:getVocation():getRequiredSkillTries(skills_id[i], player:getSkillLevel(skills_id[i]) + skills_amount) - player:getSkillTries(skills_id[i]))
                end
            else
                player:addManaSpent(player:getVocation():getRequiredManaSpent(player:getBaseMagicLevel() + magiclevel_amount) - target:getManaSpent())
            end
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, config.mensagem)
            player:setStorageValue(config.storage, 1)
        else
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Voce ja recebeu seu premio.")
        end
    end
return true
end
 
Lua:
local config = {
skills_amount = 1, -- quantidade de skills que o player ganhará se ele for Knight ou Paladin
magiclevel_amount = 1, -- quantidade de magic levels o player ganhará se ele for Druid ou Sorcerer
storage = 10000, -- Storage para quest.
uniqueID = 1000 -- UniqueID que você colocará no Map Editor
}

local skills_id = {SKILL_CLUB, SKILL_AXE, SKILL_AXE, SKILL_DISTANCE, SKILL_SHIELD} -- Não mexer.
   
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    mensagem = "Voce recebeu "..config.skills_amount.." skills e "..config.magiclevel_amount.." magic levels."
    if(item.uid == config.uniqueID) then
        if player:getStorageValue(config.storage) == -1 then
            if isInArray({1, 2, 5, 6}, player:getVocation():getId()) then
                for i = 1, table.maxn(skills_id) do
                    player:addSkillTries(skills_id[i], target:getVocation():getRequiredSkillTries(skills_id[i], player:getSkillLevel(skills_id[i]) + skills_amount) - player:getSkillTries(skills_id[i]))
                end
            else
                player:addManaSpent(player:getVocation():getRequiredManaSpent(player:getBaseMagicLevel() + magiclevel_amount) - target:getManaSpent())
            end
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, config.mensagem)
            player:setStorageValue(config.storage, 1)
        else
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Voce ja recebeu seu premio.")
        end
    end
return true
end


 
at line 19 change:
Lua:
player:addManaSpent(player:getVocation():getRequiredManaSpent(player:getBaseMagicLevel() + magiclevel_amount) - target:getManaSpent())

for:

Lua:
player:addManaSpent(player:getVocation():getRequiredManaSpent(player:getBaseMagicLevel() + config.magiclevel_amount ) - target:getManaSpent())
 
at line 19 change:
Lua:
player:addManaSpent(player:getVocation():getRequiredManaSpent(player:getBaseMagicLevel() + magiclevel_amount) - target:getManaSpent())

for:

Lua:
player:addManaSpent(player:getVocation():getRequiredManaSpent(player:getBaseMagicLevel() + config.magiclevel_amount ) - target:getManaSpent())


 
why your code has all those "target"? you supposed to use the item on someone like a wand? if its not like that then change all those "target" to "player".
That parameter means the userdata that you are going to use :p player is yourself (the one using the item) and target is the player or monster you are targetting with your item (like when you use a pick)
 

Paladin e Knight -> SKILL
DRuid e MAGE - > ML
Post automatically merged:

why your code has all those "target"? you supposed to use the item on someone like a wand? if its not like that then change all those "target" to "player".
That parameter means the userdata that you are going to use :p player is yourself (the one using the item) and target is the player or monster you are targetting with your item (like when you use a pick)

I've fixed this already rsrsrsrssrrss
 
at line 19 change:
Lua:
player:addManaSpent(player:getVocation():getRequiredManaSpent(player:getBaseMagicLevel() + magiclevel_amount) - target:getManaSpent())

for:

Lua:
player:addManaSpent(player:getVocation():getRequiredManaSpent(player:getBaseMagicLevel() + config.magiclevel_amount ) - target:getManaSpent())

At the same line change target:getManaSpent for player:getManaSpent
 

Similar threads

Back
Top