TFS 1.2 Storage check to give Skills+Magic level onlogin

Mariuskens

Sword Art Online 2D-MMORPG
Joined
Nov 21, 2008
Messages
968
Reaction score
78
Location
Spain
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
 

zxmatzx

Well-Known Member
Joined
Dec 1, 2010
Messages
14
Reaction score
2
Hi,
1% of 80 is 0.8%, u want gain only 80% for next skill?
 
OP
Mariuskens

Mariuskens

Sword Art Online 2D-MMORPG
Joined
Nov 21, 2008
Messages
968
Reaction score
78
Location
Spain
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.
 

zxmatzx

Well-Known Member
Joined
Dec 1, 2010
Messages
14
Reaction score
2
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.
Yeah, but If player have less than 100 skill, will receive less than 1... If set to receive minimum 1, i can do...
 

_M4G0_

Active Member
Joined
Feb 6, 2016
Messages
388
Reaction score
67
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:
Top