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

TFS 0.X Solved.

Sanzenkai

Member
Joined
Aug 25, 2023
Messages
31
Reaction score
13
Hello, currently on my server I have a system that the player uses a scroll to change vocation for talkaction to avoid miss click on the item and things like that, and there were many players using this scroll on top of other vocations that gain less or more HP/MP per level and ended up with less HP/MP than they should (As an alternative, I put the parchment to be used only at LVL 1, but it generated some complaints), I would like to know if it is possible for someone to help me by reformulating this talkaction so that he checks the vocation in vocations.xml calculates the HP/MP that the player should have with that level and applies it to the character, I hope it's not too much to ask, thanks in advance.

Lua:
function onSay(cid,words,param,channel)
local t = {
["!asuma"] = {item = 11456, amount = 1, voc = 62, outfit = 312, msg = "Parabens voce virou um Asuma."},
["!boruto"] = {item = 829, amount = 1, voc = 52, outfit = 343, msg = "Parabens voce virou um Boruto."},
["!chino"] = {item = 11468, amount = 1, voc = 107, outfit = 353, msg = "Parabens voce virou uma Chino."}
}
if not t[words] then
    doPlayerSendCancel(cid, "Desculpe, mas nao existe esta vocacao") return true
end
local var = t[words]
local sagastor = 578744
if getPlayerLevel(cid) > 1 then
        doPlayerSendCancel(cid, "Desculpe, mas voce precisa ser level 1.") return true
    end
    if getPlayerVocation(cid) == var.voc then
        doPlayerSendCancel(cid, "Desculpe, mas voce ja esta com esta vocacao") return true
    elseif not doPlayerRemoveItem(cid, var.item,var.amount) then
        doPlayerSendCancel(cid, "Desculpe, mas voce nao tem o pergaminho") return true
    end
    doPlayerSetVocation(cid,var.voc)
    doCreatureChangeOutfit(cid, {lookType = var.outfit})
    setPlayerStorageValue(cid, sagastor, ":"..var.outfit..",:"..getPlayerVocation(cid))
    doPlayerSendTextMessage(cid, 22, var.msg)
return true
end
 
Solution
E
something like this, 0.4 lacks a few commands thought:
Lua:
local vocation = getPlayerVocation(cid)
local level = getPlayerLevel(cid)
local supposedhealth = 185 + (getVocationInfo(vocation).healthGain * (level-8))
local supposedmana = 90 + (getVocationInfo(vocation).manaGain * (level-8))
local supposedcap = 47000 + (getVocationInfo(vocation).capacity) * (level-8))

if supposedhealth ~= getCreatureMaxHealth(cid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Server detected your max health was wrongly set at " .. getCreatureMaxHealth(cid) .. " and we adjusted it to " .. supposedhealth .. " automatically.")
setCreatureMaxHealth(cid, supposedhealth)
--player:setHealth(supposedhealth)
end
if supposedhealth ~=...
perhaps you could adapt these scripts to 0.4
i don't have such programming skills yet xD but the hyresu response it would addapt better to my server, but i cant adapt i have no such wisdom for it
 
something like this, 0.4 lacks a few commands thought:
Lua:
local vocation = getPlayerVocation(cid)
local level = getPlayerLevel(cid)
local supposedhealth = 185 + (getVocationInfo(vocation).healthGain * (level-8))
local supposedmana = 90 + (getVocationInfo(vocation).manaGain * (level-8))
local supposedcap = 47000 + (getVocationInfo(vocation).capacity) * (level-8))

if supposedhealth ~= getCreatureMaxHealth(cid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Server detected your max health was wrongly set at " .. getCreatureMaxHealth(cid) .. " and we adjusted it to " .. supposedhealth .. " automatically.")
setCreatureMaxHealth(cid, supposedhealth)
--player:setHealth(supposedhealth)
end
if supposedhealth ~= getCreatureMaxMana(cid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Server detected your max mana was wrongly set at " .. getCreatureMaxMana(cid) .. " and we adjusted it to " .. supposedmana .. " automatically.")
setCreatureMaxMana(cid, supposedmana)
--player:setMana(supposedmana)
end
--if supposedcap ~= player:getCapacity() then
--doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Server detected your max capacity was wrongly set at " .. (player:getCapacity() / 100) .. " and we adjusted it to " .. supposedcap/100 .. " automatically.")
doPlayerSetMaxCapacity(uid, supposedcap)
--end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "For level " .. level .. ", your max HP should be: " .. supposedhealth .. " max mana should be: " .. supposedmana .. " max cap should be: " .. supposedcap .. ".")
 
Solution
something like this, 0.4 lacks a few commands thought:
Lua:
local vocation = getPlayerVocation(cid)
local level = getPlayerLevel(cid)
local supposedhealth = 185 + (getVocationInfo(vocation).healthGain * (level-8))
local supposedmana = 90 + (getVocationInfo(vocation).manaGain * (level-8))
local supposedcap = 47000 + (getVocationInfo(vocation).capacity) * (level-8))

if supposedhealth ~= getCreatureMaxHealth(cid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Server detected your max health was wrongly set at " .. getCreatureMaxHealth(cid) .. " and we adjusted it to " .. supposedhealth .. " automatically.")
setCreatureMaxHealth(cid, supposedhealth)
--player:setHealth(supposedhealth)
end
if supposedhealth ~= getCreatureMaxMana(cid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Server detected your max mana was wrongly set at " .. getCreatureMaxMana(cid) .. " and we adjusted it to " .. supposedmana .. " automatically.")
setCreatureMaxMana(cid, supposedmana)
--player:setMana(supposedmana)
end
--if supposedcap ~= player:getCapacity() then
--doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Server detected your max capacity was wrongly set at " .. (player:getCapacity() / 100) .. " and we adjusted it to " .. supposedcap/100 .. " automatically.")
doPlayerSetMaxCapacity(uid, supposedcap)
--end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "For level " .. level .. ", your max HP should be: " .. supposedhealth .. " max mana should be: " .. supposedmana .. " max cap should be: " .. supposedcap .. ".")

Sorry but how i install this script? i don't have a ideia
 

Similar threads

Back
Top