Hello, is there a way to differentiate the condition_infight?
Take this script for example;
If I want to differentiate combat vs monsters and players, are you able to?
So example;
I want to be able to use the teleport scroll if you are in combat with a monster
however
If you attack a player or player attacks you, you cannot teleport then
How do you achieve that?
Take this script for example;
Lua:
local teleportScroll = Action()
function teleportScroll.onUse(player, item, fromPos, target, toPos, isHotkey)
if player:hasCondition(CONDITION_INFIGHT) then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can't teleport in combat.")
return false
end
local playerPos = player:getPosition()
local tile = Tile(playerPos)
local town = player:getTown()
local templePos = town and town:getTemplePosition() or Town(1):getTemplePosition()
playerPos:sendMagicEffect(CONST_ME_POFF)
player:teleportTo(templePos)
templePos:sendMagicEffect(CONST_ME_TELEPORT)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Welcome home adventurer!")
item:transform(item:getId(), item:getCharges() -1)
return true
end
teleportScroll:id(6119)
teleportScroll:register()
If I want to differentiate combat vs monsters and players, are you able to?
So example;
I want to be able to use the teleport scroll if you are in combat with a monster
however
If you attack a player or player attacks you, you cannot teleport then
How do you achieve that?