• Vote in May Mapping Competition to select a winner!
  • 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
995
Best answers
0
Reaction score
88
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

Intermediate OT User
Joined
Dec 1, 2010
Messages
261
Best answers
22
Reaction score
104
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
995
Best answers
0
Reaction score
88
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

Intermediate OT User
Joined
Dec 1, 2010
Messages
261
Best answers
22
Reaction score
104
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_

Well-Known Member
Joined
Feb 6, 2016
Messages
427
Best answers
13
Reaction score
70
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