• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua TFS 1.3 how to make invisibility desappear if player attack?

Icaraii

Well-Known Member
Joined
Jan 5, 2020
Messages
469
Solutions
1
Reaction score
58
Hello,

For example, player has utana vid (invisible spell), if he attack anyone or any monster, the invisible spell would be disable. Also I would like for the spell only be castable if player is not in combat. Are both of this things possible? And if so, how can I do this?
 
data/events/scripts/creature.lua or ou can create a healthchange event and register it on all players
in function onTargetCombat(target)
Lua:
if self:isPlayer() and target then
    if target:getCondition(CONDITION_INVISIBLE) then
        target:removeCondition(CONDITION_INVISIBLE)
    end
end
 
data/events/scripts/creature.lua or ou can create a healthchange event and register it on all players
in function onTargetCombat(target)
Lua:
if self:isPlayer() and target then
    if target:getCondition(CONDITION_INVISIBLE) then
        target:removeCondition(CONDITION_INVISIBLE)
    end
end
I think healthchange wouldn't be effective.
This code you post, should be added into function Creature:onTargetCombat(target)?
Post automatically merged:

And what about the out of combat restriction? If player has battle, he can't cast it, otherwise he can cast it.
 
Back
Top