Hey!
Used search function but without succés.
Im looking for script where x position cannot be passed without wearing x item in specific armor_const_slot.
Has this alrdy been Done?
Cannot find it..
local required_armor = 2463
function onStepIn(creature, item, toPosition, fromPosition)
local player = creature:getPlayer()
if not player then return true end
local armor = player:getSlotItem(CONST_SLOT_ARMOR)
if not armor or armor.itemid ~= required_armor then
player:teleportTo(fromPosition, true)
player:sendCancelMessage("You do not have the required item.")
end
return true
end
function onStepIn(creature, item, position, fromPosition)
if creature:isPlayer() and CONST_SLOT_HELMET == Itemid. then
item:transform(453, 1)
item:decay()
end
end
function onStepOut(creature, item, position, fromPosition)
item:transform(452, 1)
item:decay()
end
Hey!
Used search function but without succés.
Im looking for script where x position cannot be passed without wearing x item in specific armor_const_slot.
Has this alrdy been Done?
Cannot find it..
local required_armor = 2463
function onStepIn(creature, item, toPosition, fromPosition)
local player = creature:getPlayer()
if not player then return true end
local armor = player:getSlotItem(CONST_SLOT_ARMOR)
if not armor or armor.itemid ~= required_armor then
player:teleportTo(fromPosition, true)
player:sendCancelMessage("You do not have the required item.")
end
return true
end
local required_armor = 2463
function onStepIn(creature, item, toPosition, fromPosition)
local player = creature:getPlayer()
if not player then return true end
local armor = player:getSlotItem(CONST_SLOT_ARMOR)
if not armor or armor.itemid ~= required_armor then
player:teleportTo(fromPosition, true)
player:sendCancelMessage("You do not have the required item.")
end
return true
end
The armor or a new item removed along with the requirement for armor?
Try this:The armor
local required_armor = 2463
function onStepIn(creature, item, toPosition, fromPosition)
local player = creature:getPlayer()
if not player then return true end
local armor = player:getSlotItem(CONST_SLOT_ARMOR)
if armor and armor.itemid == required_armor then
armor:remove(1)
player:sendTextMessage(MESSAGE_INFO_DESCR, "Armor item accepted.")
else
player:teleportTo(fromPosition, true)
player:sendCancelMessage("You do not have the required item.")
end
return true
end