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

item-movement attribute

yoiker

Member
Joined
Jan 21, 2012
Messages
194
Solutions
1
Reaction score
9
Good morning to everyone from Venezuela. I make post because I need your help so that the slightest problem for it to an expert I can not solve and that's why I come to ask for your help.


The first problem is via movements . As you know well at least those attributes are to fire on stepping up the item not to harm the player nor acquire the status

Code:
    <item id="2647" name="plate legs">
        <attribute key="weight" value="5000" />
        <attribute key="armor" value="7" />
        <attribute key="suppressDrown" value="50" />
        <attribute key="suppressFire" value="100" />
        <attribute key="suppressPoison" value="100" />
        <attribute key="suppressEnergy" value="100" />
        <attribute key="slotType" value="legs" />
    </item>


But then to work I have to put it in movements.xml

Code:
 <movevent event="Equip" itemid="2647" slot="legs" function="onEquipItem" />
    <movevent event="DeEquip" itemid="2647" slot="legs" function="onDeEquipItem" />


Now the point is that I pass lua because I'm using a script with the same pants

Code:
<movevent event="Equip" itemid="2647" slot="legs" script="xxx.lua">
    </movevent>
<movevent event="DeEquip" itemid="2647" slot="legs" script="xxx.lua"/>


And it has stopped working the attribute that has items.xml (suppress)

I appreciate your time to see the post and respond.

And if you want to see the lua leave the message and posting :D
 
onEquip / onDeEquip scripts override the attributes of an item.
All this is ignored when you assign a script to it.
Code:
        <attribute key="armor" value="7" />
        <attribute key="suppressDrown" value="50" />
        <attribute key="suppressFire" value="100" />
        <attribute key="suppressPoison" value="100" />
        <attribute key="suppressEnergy" value="100" />
 
onEquip / onDeEquip scripts override the attributes of an item.
All this is ignored when you assign a script to it.
Code:
        <attribute key="armor" value="7" />
        <attribute key="suppressDrown" value="50" />
        <attribute key="suppressFire" value="100" />
        <attribute key="suppressPoison" value="100" />
        <attribute key="suppressEnergy" value="100" />
Use this, instead of return true
Code:
return callFunction(cid, item.uid, slot, boolean)
 
So I put it and gave me error
Code:
    local legs = CONST_SLOT_LEGS
    local min = 0
    local max = 5

    local addpercent = 4
    local defaulpercent = 115
    local conditions = {}

    for num = min, max do
    conditions[num] = Condition(CONDITION_ATTRIBUTES)
    conditions[num]:setParameter(CONDITION_PARAM_TICKS, -1)
    conditions[num]:setParameter(31, defaulpercent + addpercent * num)
    conditions[num]:setParameter(32, defaulpercent + addpercent * num)
    conditions[num]:setParameter(CONDITION_PARAM_BUFF, false)
    conditions[num]:setParameter(CONDITION_PARAM_SUBID, 18)
 end

    function onEquip(player, item, slot, boolean)
       
    if slot == legs then
       
    local succes = item:getSucces()
    if succes < 10 then succes = 0 else succes = succes - 10 end

    doAddCondition(player, conditions[succes])
    end
       return callFunction(player, item, slot, boolean)

    end

    function onDeEquip(player, item, slot, boolean)
    doRemoveCondition(player, CONDITION_ATTRIBUTES, 18)

    return callFunction(player, item, slot, boolean)
    end

Error 'callFunction'
 
Last edited:
So I put it and gave me error
Code:
    local legs = CONST_SLOT_LEGS
    local min = 0
    local max = 5

    local addpercent = 4
    local defaulpercent = 115
    local conditions = {}

    for num = min, max do
    conditions[num] = Condition(CONDITION_ATTRIBUTES)
    conditions[num]:setParameter(CONDITION_PARAM_TICKS, -1)
    conditions[num]:setParameter(31, defaulpercent + addpercent * num)
    conditions[num]:setParameter(32, defaulpercent + addpercent * num)
    conditions[num]:setParameter(CONDITION_PARAM_BUFF, false)
    conditions[num]:setParameter(CONDITION_PARAM_SUBID, 18)
end

    function onEquip(player, item, slot, boolean)
      
    if slot == legs then
      
    local succes = item:getSucces()
    if succes < 10 then succes = 0 else succes = succes - 10 end

    doAddCondition(player, conditions[succes])
    end
       return callFunction(player, item, slot, boolean)

    end

    function onDeEquip(player, item, slot, boolean)
    doRemoveCondition(player, CONDITION_ATTRIBUTES, 18)

    return callFunction(player, item, slot, boolean)
    end

Error 'callFunction'
Tfs?
 
Movements.cpp change your function to this:
Code:
uint32_t MoveEvent::fireEquip(Player* player, Item* item, slots_t slot, bool boolean){ if (scripted) { if (equipFunction(this, player, item, slot, boolean) == 1) { return executeEquip(player, item, slot); } else { return 0; } } else { return equipFunction(this, player, item, slot, boolean); }}
wrote this from phone so no intendation
Edit: i meant movements.cpp silly me
 
Last edited:
Movements.cpp change your function to this:
Code:
uint32_t MoveEvent::fireEquip(Player* player, Item* item, slots_t slot, bool boolean){ if (scripted) { if (equipFunction(this, player, item, slot, boolean) == 1) { return executeEquip(player, item, slot); } else { return 0; } } else { return equipFunction(this, player, item, slot, boolean); }}
wrote this from phone so no intendation
Edit: i meant movements.cpp silly me


He gave no error in the compilation process but with the player entering the server crash.
 
If you use a script and the function
for it then you have to add both to movements.xml function="onEquipItem" script="xx.lua" for all of them where you use both
 
If you use a script and the function
for it then you have to add both to movements.xml function="onEquipItem" script="xx.lua" for all of them where you use both

<movevent event="Equip" itemid="2647" slot="legs" script="upgrade/epic legs.lua">
</movevent>
<movevent event="DeEquip" itemid="2647" slot="legs" script="upgrade/epic legs.lua"/>


For so I have, but it gave me error when entering the console with the player
 
Back
Top