MoveEvent
There are many types of events for the MoveEvent interface, here is a list.
[onStepIn(creature, item, pos, fromPosition)]
[onStepOut(creature, item, pos, fromPosition)]
[onEquip(player, item, slot, isCheck)]
[onDeEquip(player, item, slot, isCheck)]
[onAddItem(moveitem, tileitem, pos)]
[onRemoveItem(moveitem, tileitem, pos)]
You can create a MoveEvent script in data/movements/scripts folder, but
You must register MoveEvents in data/movements/movements.xml, here is an example
Alternatively you can use revscript method to register via lua, by saving a .lua file in data/scripts folder.
Please keep in mind you can name your script whatever you want as long as it ends in .lua, and its full name is in the xml, with script=""
onStepIn(creature, item, pos, fromPosition)
creature -- 1st arg/parameter /userdata/ = The creature who is doing the stepin movement
item -- 2nd arg/parameter /userdata/ = The item that is being stepped on.
pos -- 3rd arg/parameter /userdata/ = The position for the location being stepped on
fromPosition -- 4th arg/parameter /userdata/ = The position which the creature moved from
onStepin is called whenever any creature steps on the registered item id(s)
You can register your event in movement.xml like so:
You can then call the event in a script like so:
mud.lua
Always remember to return true if you wish to allow creature to step there, returning false or not returning true will block creature from stepping there!
onStepOut(creature, item, pos, fromPosition)
creature -- 1st arg/parameter /userdata/ = The creature who is doing the stepin movement
item -- 2nd arg/parameter /userdata/ = The item that is being stepped on.
pos -- 3rd arg/parameter /userdata/ = The position for the location being stepped on
fromPosition -- 4th arg/parameter /userdata/ = The position which the creature moved from
onStepOut is called whenever any player tries to step off registered item id(s)
You can register your event in creaturescripts.xml like so:
You can then call the event in a script like so:
mud.lua
Always remember to return true if you wish to allow creature to step off the tile they are on, returning false or not returning true will block the creature from being able to step off!
onEquip(player, item, slot, isCheck)
player -- 1st arg/parameter /userdata/ = The player who is equipping the item
item -- 2nd arg/parameter /userdata/ = The item that is being equipped
slot -- 3rd arg/parameter /integer/ = The slot item is being equipped to, represents a const value.
isCheck -- 4th arg/parameter /boolean/ = is this before item is equipped, true or false
onEquip runs twice everytime a player equips an item. It runs once before it is equipped, and runs again after. The parameter "isCheck" is true value the first time, before the item is equipped, and false the second time, after it is equipped. This is kind of unique to consider as it is one item with one registered event that runs two times.
You can register your event in creaturescripts.xml like so:
You can then call the event in a script like so:
pallyarmor.lua
Must return true to equip without error!
onDeEquip(player, item, slot, isCheck)
player -- 1st arg/parameter /userdata/ = The player that is removing the item
item -- 2nd arg/parameter /userdata/ = The item that is being removed
slot -- 3rd arg/parameter /userdata/ = The slot that the item is being removed from.
isCheck -- 4th arg/parameter /userdata/ = is this before item is removed, true or false
onDeEquip runs twice everytime a player de-equips an item. It runs once before it is de-equipped, and runs again after. The parameter "isCheck" is true value the first time, before the item is de-equipped, and false the second time, after it is de-equipped. This is kind of unique to consider as it is one item with one registered event that runs two times.
You can register your event in creaturescripts.xml like so:
You can then call the event in a script like so:
pallyarmor.lua
Must return true to remove item without error!
Last updated