• 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!

TFS 1.X+ CONDITION_INVISIBLE -- how make it work like "/ghost"

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,188
Solutions
34
Reaction score
200
Hi, this spell make player "invisible". It only set player outfit to 0, and player cannot be attacked. But other peoples can see this player, so, he's not invisible.
How can i edit source to make "CONDITION_INVISIBLE " works like '/ghost'?

1) Make CONDITION_INVISIBLE works like '/ghost' (player will not be seen during the spell's time)
2) When player are in CONDITION_INVISIBLE, make he cant attack others creatures, and cannot be attacked by others creatures (players and monsters).

Using tfs 1.2


Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)

local condition = Condition(CONDITION_INVISIBLE)
condition:setParameter(CONDITION_PARAM_TICKS, 200000)
combat:addCondition(condition)

function onCastSpell(creature, variant)
    return combat:execute(creature, variant)
end
 
local isGhost = not player:isInGhostMode()
player:setGhostMode(isGhost)
if isGhost then
player:sendTextMessage(MESSAGE_INFO_DESCR, "You are now invisible.")
position:sendMagicEffect(CONST_ME_YALAHARIGHOST)
else
player:sendTextMessage(MESSAGE_INFO_DESCR, "You are visible again.")
position.x = position.x + 1
position:sendMagicEffect(CONST_ME_SMOKE)
end
Somethinglike this may work for you
 
it doesn't work this way. the player cannot heal while in "ghost mode". In addition, in ghost mode he can walk over other players.
I need "CONDITION_INVISIBLE" to be changed as mentioned above
 
Back
Top