Action
Action's Event Interface
onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
<action itemid="4856" script="test.lua" /><action fromid="2146" toid="2147" script="other/enchanting.lua" />
function onUse(player, item, fromPosition, target, toPosition, isHotkey) -- can name the arguments what you like.
local SwordLevel = player:getSkillLevel(SKILL_SWORD)
if SwordLevel < 70 then
player:sendCancelMessage("This technique requires a sword fighting skill of 70 or higher.")
return false
end
if not item:hasAttribute(ITEM_ATTRIBUTE_EXTRADEFENSE) then
player:sendCancelMessage("Only swords known for their well balance and extra defense are suitable for this task.")
return false
end
if fromPosition:isSightClear(toPosition) then
player:sendCancelMessage("You must have a clear path to your target")
return false
end
if target:isPlayer() then
player:sendCancelMessage("To execute this technique properly, the target needs to be a player.")
return false
end
if isHotkey then
player:sendCancelMessage("You can't use this item with a hotkey!")
return false
end
-- Executing the technique
-- Teleport to the position
player:teleportTo(toPosition)
-- Configure bleeding damage
local bleed = {
damage=50,
rounds=10,
interval=1
}
-- Apply deadly bleeding attack on target
player:addDamageCondition(target, CONDITION_BLEEDING, DAMAGELIST_CONSTANT_PERIOD, bleed.damage, bleed.interval, bleed.rounds)
-- Warn target that they just got slashed hard from player:getName and their blood is puring out!
target:sendTextMessage(MESSAGE_STATUS_WARNING, "You just recieved a blood gushing wound from "..player:getName().."'s deadly sword technique!")
return true
endRevscript Action
Action:id()
Action:aid()
Action:uid()
Action:allowFarUse()
Action:blockWalls()
Action:checkFloor()
Last updated
Was this helpful?