• 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 1.2 Storage check to give Skills+Magic level onlogin

Mariuskens

Sword Art Online 2D-MMORPG
Joined
Nov 21, 2008
Messages
1,000
Reaction score
106
Location
Spain
GitHub
Olimpotibia
Hello im looking the fuction to write one script to give % depending if player have some storage, check under:

Storage 77800 = 1% of total skills
Storage 77801 = 2% of total skills
Storage 77802 = 3% of total skills
Storage 77803 = 4% of total skills
Storage 77804 = 5% of total skills
Storage 77805 = 6% of total skills
Storage 77806 = 7% of total skills
Storage 77807 = 8% of total skills
Storage 77809 = 9% of total skills
Storage 77810 = 10% of total skills

Thanks you
 
Solution
Hello im looking the fuction to write one script to give % depending if player have some storage, check under:

Storage 77800 = 1% of total skills
Storage 77801 = 2% of total skills
Storage 77802 = 3% of total skills
Storage 77803 = 4% of total skills
Storage 77804 = 5% of total skills
Storage 77805 = 6% of total skills
Storage 77806 = 7% of total skills
Storage 77807 = 8% of total skills
Storage 77809 = 9% of total skills
Storage 77810 = 10% of total skills

Thanks you
if player have all storage he receive 51%,
you can try:
Lua:
<event type="login" name="skillpercent" script="skillpercent.lua"/>
function onLogin(player)
    local skillpercent = player:getStorageValue(1234)
    local melee = Condition(CONDITION_ATTRIBUTES...
no, the thing i want is if you have storage 77800 for example and you have 100 skills, well when you log in to the game your skills change 100 to 101.
 
Hello im looking the fuction to write one script to give % depending if player have some storage, check under:

Storage 77800 = 1% of total skills
Storage 77801 = 2% of total skills
Storage 77802 = 3% of total skills
Storage 77803 = 4% of total skills
Storage 77804 = 5% of total skills
Storage 77805 = 6% of total skills
Storage 77806 = 7% of total skills
Storage 77807 = 8% of total skills
Storage 77809 = 9% of total skills
Storage 77810 = 10% of total skills

Thanks you
if player have all storage he receive 51%,
you can try:
Lua:
<event type="login" name="skillpercent" script="skillpercent.lua"/>
function onLogin(player)
    local skillpercent = player:getStorageValue(1234)
    local melee = Condition(CONDITION_ATTRIBUTES, CONDITIONID_DEFAULT)
          melee:setParameter(CONDITION_PARAM_SUBID, 1)
          melee:setParameter(CONDITION_PARAM_TICKS, -1)
          melee:setParameter(CONDITION_PARAM_SKILL_MELEEPERCENT, 100+skillpercent)
          melee:setParameter(CONDITION_PARAM_BUFF_SPELL, true)

    local distance = Condition(CONDITION_ATTRIBUTES, CONDITIONID_DEFAULT)
          distance:setParameter(CONDITION_PARAM_SUBID, 1)
          distance:setParameter(CONDITION_PARAM_TICKS, -1)
          distance:setParameter(CONDITION_PARAM_SKILL_DISTANCEPERCENT, 100+skillpercent)
          distance:setParameter(CONDITION_PARAM_BUFF_SPELL, true)
  
    local magic = Condition(CONDITION_ATTRIBUTES, CONDITIONID_DEFAULT)
          magic:setParameter(CONDITION_PARAM_SUBID, 1)
          magic:setParameter(CONDITION_PARAM_TICKS, -1)
          magic:setParameter(CONDITION_PARAM_STAT_MAGICPOINTSPERCENT, 100+skillpercent)
          magic:setParameter(CONDITION_PARAM_BUFF_SPELL, true) 
        
        if player:getStorageValue(skillpercent) then
            if player:isKnight() then
               player:addCondition(melee)
            elseif player:isPaladin() then
               player:addCondition(distance)
            elseif player:isDruid() or player:isSorcerer() then
               player:addCondition(magic)
            end 
        end
    return true
end

if player have storage:
1234, 1 = 1%
1234, 2 = 2%
1234, 3 = 3%...

login.lua
Lua:
player:registerEvent("skillpercent")

if player:getStorageValue(1234) == -1 then
    player:setStorageValue(1234, 0)
end
Edit:
Line 25
wrong elseif player:isPaladin() or player:isSorcerer() then 😅
 
Last edited:
Solution
Back
Top