• 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 Movements.xml/lua issue.

  • Thread starter Thread starter Xikini
  • Start date Start date
X

Xikini

Guest
TFS 0.3.7_SVN (Crying Damson)

Trying to do some stuff with armor in movements but having some unexpected issues.
In our items.xml we can add all sorts of stuff beyond the initial armor and weight values.
For instance our plate armor looks something like this.
Code:
<item id="2463" article="a plate armor" name="plate armor">
     <attribute key="weight" value="100"/>
     <attribute key="armor" value="10"/>
     <attribute key="speed" value="-4"/>
     <attribute key="maxHealthPercent" value="110"/>
     <attribute key="slotType" value="body"/>
   </item>
Things like weight, armor, slotType, all work.
However less common things such as speed and maxHealthPercent do not work when using a script
But they do work if using the standard function.
Code:
<movevent type="Equip" level="1" itemid="2463" slot="armor" event="function" value="onEquipItem"/>
<movevent type="DeEquip" level="1" itemid="2463" slot="armor" event="function" value="onDeEquipItem"/>
Getting extremely basic, we've tested simply using the functions provided from the source.
However it doesn't seem to load everything.
Code:
<movevent type="Equip" level="1" itemid="2463" slot="armor" event="script" value="armor.lua"/>
<movevent type="DeEquip" level="1" itemid="2463" slot="armor" event="script" value="armor.lua"/>
Code:
function onDeEquip(cid, item, slot, boolean)
   return true
end
function onEquip(cid, item, slot, boolean)
   return true
end

What I'm wondering.. is if we can use something other then return true,
in order to force it to use the regular function.. but still retain event="script"
Do something like this.. (I'm going way out of what I'm capable of)
Code:
<movevent type="Equip" level="1" itemid="2463" slot="armor" event="script" value="armor.lua"/>
<movevent type="DeEquip" level="1" itemid="2463" slot="armor" event="script" value="armor.lua"/>
Code:
load function(onDeEquipItem)
load function(onEquipItem)
function onDeEquip(cid, item, slot, boolean)
   return onDeEquipItem
end
function onEquip(cid, item, slot, boolean)
   return onEquipItem
end
I'm not entirely sure if this will be helpful.. but here is our movement.cpp

Hopefully someone understands what I'm trying to explain and may have a solution.

Cheers,

Xikini
 
I had the same problem when making an ssa exhaust script, the ssa didn't give protection nor did charges remove. The solution was a source edit.
I'm using 0.4 r3884 so I'm not sure if it's the same but

in movement.cpp find

bool MoveEvent::fireEquip(Player* player, Item* item, slots_t slot, bool boolean)



After doing this it worked, but if the item is equipped directly into its slot from the tradewindow of an npc the server will crash(might not be the case for you).
I saw this, but does it really require a source edit to return a function already existing?
Can we not call the function directly, like it does in movements.xml?
 
Back
Top