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

Lua Adding capacity when an item is equipped?

dominique120

Science & Reason
Senator
Premium User
Joined
Jun 16, 2013
Messages
3,881
Solutions
3
Reaction score
1,046
Location
Númenor
Is there a way to mar an item add a certain amount of capacity when it is equipped? My guess is I would have to create a script for the movements that onEquip will add x capacity and ondeEquip will remove it. The only funcion I can think of is " doPlayerSetMaxCapacity(cid, cap)" but how can I remove the capacity added by this command?

In short: I need a script for an item that will add capacity when equipped, and remove it when de equipped.

Server is 0.3.6

Thanks!
 
Last edited:
Try if it works

items xml.
PHP:
    <item id="10570" article="a" name="Test Hat">
        <attribute key="description" value="More Cap"/>
        <attribute key="weight" value="100"/>
        <attribute key="armor" value="8"/>
        <attribute key="absorbPercentManaDrain" value="5"/>
        <attribute key="Capacity" value="10"/>
        <attribute key="addCap" value="8"/>
        <attribute key="cappoints" value="5"/>
        <attribute key="slotType" value="head"/>
    </item>

movements.xml

Code:
    <movevent type="Equip" itemid="10570" slot="head" event="function" value="onEquipItem">
        <vocation id="1"/>
        <vocation id="2"/>
        <vocation id="5" showInDescription="0"/>
        <vocation id="6" showInDescription="0"/>
    </movevent>
    <movevent type="DeEquip" itemid="10570" slot="head" event="function" value="onDeEquipItem"/>
 
I get this:

[22/10/2013 12:54:33] >> Loading items
[22/10/2013 12:54:34] [Warning - Items::loadFromXml] Unknown key value addCap
[22/10/2013 12:54:34] [Warning - Items::loadFromXml] Unknown key value cappoints

When I add this:

<attribute key="addCap" value="8"/>
<attribute key="cappoints" value="5"/>

And I tried it with armor that adds mana but it did not work.
 
<attributekey="MaxCap" value="50"/>
<attributekey="extraCap" value="50"/>
<attributekey="gainCap" value="50"/>

try one of this :p

maybe it's not even possible haha but you can try ^^


I found nothing in the Source code about gaincap I think you need to recompile to make it work :/
 
Last edited:
Well this script is not good at all the reason is:


Player level 300 have 3000 Cap
if the number is set to 5000 the player gets 5000 Cap

but if a level 10 got 30Cap
and he uses the item he also gets 5000 Cap :/
 
<attributekey="MaxCap" value="50"/>
<attributekey="extraCap" value="50"/>
<attributekey="gainCap" value="50"/>

try one of this :p

maybe it's not even possible haha but you can try ^^


I found nothing in the Source code about gaincap I think you need to recompile to make it work :/

None of these work, I think it would be best to create a script for movements. What did you find in the source? I have the source for this distro of TFS that I'm using.

But first! I have a strange problem. all my characters, on my account or different account all have infinite cap (says 10000 but does not change). Do you know anything about this?
 
Back
Top