Typeczek
Member
- Joined
- Feb 7, 2018
- Messages
- 44
- Reaction score
- 10
Hi, can someone help me to create DODGE/REFLECT script base on player stats like this one below?
LUA:
-- Define the item ID for the item that grants Crit
local addCritItem = Action()
local CritItemID = 32703
-- Hook into the item use event
function addCritItem.onUse(player, item, fromPosition, target, toPosition, isHotkey)
local currentskilld = player:getSkillLevel(8)
-- Check if the used item has the specified ID
if item:getId() == CritItemID then
player:setSkillLevel(8, currentskilld + 2)
item:remove(1)
-- Print a message to the player
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You gained permament 2% critical damage!")
-- Save the player's data to persist the Crit change
player:save()
end
end
addCritItem:id(32703)
addCritItem:register()