• 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 add Cap on item

lazarus321

Member
Joined
May 8, 2017
Messages
209
Reaction score
20
How do I add cap on the item. Ex. When equipping a backpack the player gains 200 cap. and when you remove backpack the cap it goes back to normal. I tried using the "weapons" script

HTML:
player:setCapacity(player:getCapacity() + 200)
but dont work. I think because it is not a weapon itself

I would like to put this function to be faster when configuring "<attribute key="skillSword" value="2" />"
 
Solution
How do I add cap on the item. Ex. When equipping a backpack the player gains 200 cap. and when you remove backpack the cap it goes back to normal. I tried using the "weapons" script

HTML:
player:setCapacity(player:getCapacity() + 200)
but dont work. I think because it is not a weapon itself

I would like to put this function to be faster when configuring "<attribute key="skillSword" value="2" />"
Movements
<movevent event="Equip" itemid="xxxx" slot="x" script="x.lua" />
<movevent event="DeEquip" itemid="xxxx" slot="x" script="x.lua" />
How do I add cap on the item. Ex. When equipping a backpack the player gains 200 cap. and when you remove backpack the cap it goes back to normal. I tried using the "weapons" script

HTML:
player:setCapacity(player:getCapacity() + 200)
but dont work. I think because it is not a weapon itself

I would like to put this function to be faster when configuring "<attribute key="skillSword" value="2" />"
Movements
<movevent event="Equip" itemid="xxxx" slot="x" script="x.lua" />
<movevent event="DeEquip" itemid="xxxx" slot="x" script="x.lua" />
 
Solution
Is it. Thanks Ascuas Funkeln.
Post automatically merged:

@Ascuas Funkeln I add in movements

HTML:
    <movevent event="Equip" itemid="26506" slot="backpack" script="Mochila_Aventureiro.lua" function="onEquipItem">
    </movevent>
    <movevent event="DeEquip" itemid="26506" slot="backpack" function="onDeEquipItem" />

and this script

HTML:
function onEquip(player, item, slot) 
  
   player:setCapacity(player:getCapacity() + (5 * 100))
  
    return true
end


dont work, need more anything?
 
Last edited:
Is it. Thanks Ascuas Funkeln.
Post automatically merged:

@Ascuas Funkeln I add in movements

HTML:
    <movevent event="Equip" itemid="26506" slot="backpack" script="Mochila_Aventureiro.lua" function="onEquipItem">
    </movevent>
    <movevent event="DeEquip" itemid="26506" slot="backpack" function="onDeEquipItem" />

and this script

HTML:
function onEquip(player, item, slot)

   player:setCapacity(player:getCapacity() + (5 * 100))

    return true
end


dont work, need more anything?
Code:
    <movevent event="Equip" itemid="26506" slot="backpack" script="Mochila_Aventureiro.lua">
    </movevent>
    <movevent event="DeEquip" itemid="26506" slot="backpack" function="onDeEquipItem" />
 
nice work now. But this cumulative add cap, I need to see now how to do it when unpacking back to the initial cap
Code:
function onEquip(player, item, slot)

   player:setCapacity(player:getCapacity() + (5 * 100))

    return true
end
function onDeEquip(player, item, slot)

   player:setCapacity(player:getCapacity())

    return true
end
Code:
    <movevent event="Equip" itemid="26506" slot="backpack" script="Mochila_Aventureiro.lua">
    </movevent>
    <movevent event="DeEquip" itemid="26506" slot="backpack" script="Mochila_Aventureiro.lua"/>

Anyway check, cuz there will be i think problem if u add cap bonus to other items
 
Back
Top