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

[Request] Smoke field gives invisibility

Demnish

Tibian Hero
Joined
Sep 28, 2011
Messages
402
Solutions
2
Reaction score
65
Location
Sweden
I have no idea if it's even possible, let alone how to actually do it.

But would it be possible to make it so when a creature stand on a smoke field, they get invisibility as long as the field exist or they stay on it?
Could this be made in LUA with StepIn + StepOut?
 
Try this one
Lua:
local condition = Condition(CONDITION_INVISIBLE)

function onStepIn(creature, item, position, fromPosition)
    if not creature:isMonster() then
        return false
    end
    creature:addCondition(condition)
    return true
end
function onStepOut(creature, item, position, fromPosition)
    if not creature:isMonster() then
        return false
    end

    creature:removeCondition(CONDITION_INVISIBLE)
    return true
end
add it like this
XML:
    <movevent event="StepIn" itemid="fieldid" script="scriptname.lua" />
    <movevent event="StepOut" itemid="fieldid" script="scriptname.lua" />
This is for TFS 1.3 since you didn't mention which TFS are you using in your thread.
 
Last edited:
Try this one
Lua:
local condition = Condition(CONDITION_INVISIBLE)

function onStepIn(creature, item, position, fromPosition)
    if not creature:isMonster() then
        return false
    end
    creature:addCondition(condition)
    return true
end
function onStepOut(creature, item, position, fromPosition)
    if not creature:isMonster() then
        return false
    end

    creature:removeCondition(CONDITION_INVISIBLE)
    return true
end
add it like this
XML:
    <movevent event="StepIn" itemid="fieldid" script="scriptname.lua" />
    <movevent event="StepOut" itemid="fieldid" script="scriptname.lua" />
This is for TFS 1.3 since you didn't mention which TFS are you using in your thread.

Yeah sorry, I'm using TFS 1.3, usually don't forget but this time I guess I was tired.

Anyway, I tried the script; removed the "if monster" since I believe it would be cool if players got affected too.
However, the condition doesn't have a time and I don't know how to add so you always have invisibility when on the smoke tile.
Also what happens when you use a stealth ring and walk in then out, wouldn't the stealth ring also get deactivated?
What happens if the player is teleported away by lets say GM. Do they get infinite invisibility?

Thanks for taking time helping out! :)
Post automatically merged:

EDIT: What do you think about this script @M0ustafa?

Lua:
local magicEffect = CONST_ME_SMOKE

function onStepIn(creature, item, position, fromPosition)
    creature:setGhostMode(true)
    creature:sendMagicEffect(magicEffect)
    return true
end
function onStepOut(creature, item, position, fromPosition)
    creature:setGhostMode(false)
    creature:sendMagicEffect(magicEffect)
    return true
end
Do you see any potential problems?
I don't know if ghost mode actually makes you immune to damage.
But it works how I imagined it.

Or maybe we scratch that, since you get immortal when in ghost mode, disappears from VIP etc.
 
Last edited:
It doesn't require source edit, You can just set invisibility ticks like this
Lua:
condition:setParameter(CONDITION_PARAM_TICKS, 20000)
I think ghost mode will be OP since when you are using ghost mode you can walk through players? also I am not sure if damage will work on you never tried on a normal player but there been many threads discussing this you can check.
 
Yeah, noticed the creature gets immortal and disappears from VIP lists etc.
Gonna see if I can't make a custom CONDITION_STEALTH that works like ghost but you can get attacked by AOE spells.

Otherwise, do you think an addEvent function could work to keep the creature invisible while on the smokefield?
Never tried addEvent before.
Post automatically merged:

Solved
Lua:
local condition = Condition(CONDITION_INVISIBLE)
condition:setParameter(CONDITION_PARAM_TICKS, -1)

function onStepIn(creature, item, position, fromPosition)
    creature:addCondition(condition)
    return true
end
function onStepOut(creature, item, position, fromPosition)
    creature:removeCondition(CONDITION_INVISIBLE)
    return true
end
I put the param ticks to -1 in hope that it would disable duration(as per source code), turns out to be the case.
Love to whoever put that in and thanks @M0ustafa for helping me out. :cool:

Now I'll try to make CONDITION_STEALTH that is based on GhostMode.
If I succeed I'll post a guide here on how I implemented it so people can potentially add stealth spells to their servers.
Post automatically merged:

Hmm it doesn't seem to work with monsters however.
Spawned a troll, when it walked over it didn't get invisibility. 🤔
 
Last edited:
Try this if it will apply to monsters
Lua:
local condition = Condition(CONDITION_INVISIBLE)
if not creature:isMonster() or not creature:isPlayer() then 
 return false
 end
condition:setParameter(CONDITION_PARAM_TICKS, -1)

function onStepIn(creature, item, position, fromPosition)
if not creature:isMonster() or not creature:isPlayer() then 
 return false
 end
    creature:addCondition(condition)
    return true
end
function onStepOut(creature, item, position, fromPosition)
    creature:removeCondition(condition)
    return true
end
 
I removed the top:
Lua:
if not creature:isMonster() or not creature:isPlayer() then
return false
end
Because it returned Global Creature (nil value) since it was outside the function.
However, the script doesn't work for neither players or monsters in this edit. :confused:

Post automatically merged:

Do you know how I can make a tile check to see if there is a creature on the tile where the smoke resides?
Post automatically merged:

Nvm, I'm too tired for this. o_O
I failed to notice that my GM character can always see invisible creatures..
When I played a normal character there was no problem with it. The monster went invisible, as it always did..

Sorry for wasting your time, all is good.
 
Last edited:
Back
Top