• 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 0.X utana vid invisible adjusts

kennyubuntu

Member
Joined
May 20, 2016
Messages
150
Reaction score
13
With the help of @heba i have the so wanted invisible spell (utana vid but invisible for other players, just like warlocks do)

source changes:

replace functions:
Code:
void Player::sendCreatureChangeVisible(const Creature* creature, Visible_t visible)
{
    if(!client)
        return;

    const Player* player = creature->getPlayer();
    if(player == this || (player && (getGhostAccess() > player->getGhostAccess())))
        sendCreatureChangeOutfit(creature, creature->getCurrentOutfit());
    else if(visible == VISIBLE_DISAPPEAR)
        sendCreatureDisappear(creature, creature->getTile()->getClientIndexOfThing(this, creature));
    else
        sendCreatureAppear(creature);
}


bool Player::canSeeCreature(const Creature* creature) const
{
    if(creature == this)
        return true;

    if(const Player* player = creature->getPlayer())
        return !player->isInvisible() || getGhostAccess() > player->getGhostAccess();

    return !creature->isInvisible();
}



edit functions:
Code:
    void Player::onEndCondition(ConditionType_t type)

after
        g_game.updateCreatureSkull(this);
    }

    add

        else if(type == CONDITION_INVISIBLE)
    {
        Position newPos = getPosition();
        g_game.addDistanceEffect(Position(newPos.x + 1, newPos.y, newPos.z), newPos, SHOOT_EFFECT_ENERGY);
        g_game.addDistanceEffect(Position(newPos.x - 1, newPos.y, newPos.z), newPos, SHOOT_EFFECT_ENERGY);
        g_game.addDistanceEffect(Position(newPos.x, newPos.y + 1, newPos.z), newPos, SHOOT_EFFECT_ENERGY);
        g_game.addDistanceEffect(Position(newPos.x, newPos.y - 1, newPos.z), newPos, SHOOT_EFFECT_ENERGY);
    }

But there are a few problems i don't know how to fix...
I have to stop inv in 3 ways:

1- utamo ina is not working (a area spell to remove inv)
inv players don't recive area damage, can trap, do a lot things, i need a cauter play like this area spell that remove the utana vid, but it is not working (it was working before the modifications)

Code:
    <instant name="Cancel Invisibility" words="utana ina" maglv="1" mana="210" prem="0" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="support/cancel invisibility.lua">

    </instant>

cancel invisibility.lua
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_INVISIBLE)

local area = createCombatArea(AREA_CIRCLE3X3)
setCombatArea(combat, area)

function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end

2- players that attack still invisible
this is so OP, players can still invisible and attacking other players, i would like to when players do damage in other players, it stops the inv

3- players recive damage but still invisible
the monsters that are imune to inv can attack the inv players, but its strange because it still invisible, it should stop the invisibility

my source: Fir3element/3777 (https://github.com/Fir3element/3777/tree/master/src)
 
Solution
can i create on luascript cpp a function with
removeCondition(CONDITION_INVISIBLE);
???
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)

local area = createCombatArea({
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 3, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1}
})
setCombatArea(combat, area)

function onCastSpell(cid, var)
    local specs = getSpectators(getCreaturePosition(cid), 3, 3)
    for _, pid in ipairs(specs) do
        if(isPlayer(pid)) then
            doSendAnimatedText(getCreaturePosition(pid), "Invis!", COLOR_LIGHTBLUE)
            doRemoveCondition(pid...

Elgenady

Veteran OT User
Joined
Aug 5, 2011
Messages
1,602
Solutions
33
Reaction score
295
With the help of @heba i have the so wanted invisible spell (utana vid but invisible for other players, just like warlocks do)

source changes:

replace functions:
Code:
void Player::sendCreatureChangeVisible(const Creature* creature, Visible_t visible)
{
    if(!client)
        return;

    const Player* player = creature->getPlayer();
    if(player == this || (player && (getGhostAccess() > player->getGhostAccess())))
        sendCreatureChangeOutfit(creature, creature->getCurrentOutfit());
    else if(visible == VISIBLE_DISAPPEAR)
        sendCreatureDisappear(creature, creature->getTile()->getClientIndexOfThing(this, creature));
    else
        sendCreatureAppear(creature);
}


bool Player::canSeeCreature(const Creature* creature) const
{
    if(creature == this)
        return true;

    if(const Player* player = creature->getPlayer())
        return !player->isInvisible() || getGhostAccess() > player->getGhostAccess();

    return !creature->isInvisible();
}



edit functions:
Code:
    void Player::onEndCondition(ConditionType_t type)

after
        g_game.updateCreatureSkull(this);
    }

    add

        else if(type == CONDITION_INVISIBLE)
    {
        Position newPos = getPosition();
        g_game.addDistanceEffect(Position(newPos.x + 1, newPos.y, newPos.z), newPos, SHOOT_EFFECT_ENERGY);
        g_game.addDistanceEffect(Position(newPos.x - 1, newPos.y, newPos.z), newPos, SHOOT_EFFECT_ENERGY);
        g_game.addDistanceEffect(Position(newPos.x, newPos.y + 1, newPos.z), newPos, SHOOT_EFFECT_ENERGY);
        g_game.addDistanceEffect(Position(newPos.x, newPos.y - 1, newPos.z), newPos, SHOOT_EFFECT_ENERGY);
    }

But there are a few problems i don't know how to fix...
I have to stop inv in 3 ways:

1- utamo ina is not working (a area spell to remove inv)
inv players don't recive area damage, can trap, do a lot things, i need a cauter play like this area spell that remove the utana vid, but it is not working (it was working before the modifications)

Code:
    <instant name="Cancel Invisibility" words="utana ina" maglv="1" mana="210" prem="0" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="support/cancel invisibility.lua">

    </instant>

cancel invisibility.lua
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_INVISIBLE)

local area = createCombatArea(AREA_CIRCLE3X3)
setCombatArea(combat, area)

function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end

2- players that attack still invisible
this is so OP, players can still invisible and attacking other players, i would like to when players do damage in other players, it stops the inv

3- players recive damage but still invisible
the monsters that are imune to inv can attack the inv players, but its strange because it still invisible, it should stop the invisibility

my source: Fir3element/3777 (https://github.com/Fir3element/3777/tree/master/src)
to make player cancel in vis when attack or when get damage
add
if(isInvisible())
removeCondition(CONDITION_INVISIBLE);
in doAttacking and drainHealth and drainMana in player.cpp
but how i can make ghost player taken damage i will see it

if u want invis player don't trap other add
creature->isInvisible()
in
bool Player::canWalkthrough(const Creature* creature) const
in this line
if(creature == this || hasCustomFlag(PlayerCustomFlag_CanWalkthrough) || creature->isWalkable() ||
 
OP
kennyubuntu

kennyubuntu

Member
Joined
May 20, 2016
Messages
150
Reaction score
13
to make player cancel in vis when attack or when get damage
add
if(isInvisible())
removeCondition(CONDITION_INVISIBLE);
in doAttacking and drainHealth and drainMana in player.cpp
but how i can make ghost player taken damage i will see it

if u want invis player don't trap other add
creature->isInvisible()
in
bool Player::canWalkthrough(const Creature* creature) const
in this line
if(creature == this || hasCustomFlag(PlayerCustomFlag_CanWalkthrough) || creature->isWalkable() ||

god!

no, i want to still trapping on utana vid it make interesting things on PvP (with the utana ina)...

now 2,3 is fixed

there is only the 1 left, is it hard to make that dispel inv back to work again?
 
OP
kennyubuntu

kennyubuntu

Member
Joined
May 20, 2016
Messages
150
Reaction score
13
is anybody know why spell cancel invisibility was working before the sources changes, but now its not working?

Code:
   <instant name="Cancel Invisibility" words="utana ina" maglv="1" mana="210" prem="0" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="support/cancel invisibility.lua" />

cancel invisibility.lua
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_INVISIBLE)

local area = createCombatArea(AREA_CIRCLE3X3)
setCombatArea(combat, area)

function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end
 

Elgenady

Veteran OT User
Joined
Aug 5, 2011
Messages
1,602
Solutions
33
Reaction score
295
can i create on luascript cpp a function with
removeCondition(CONDITION_INVISIBLE);
???
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)

local area = createCombatArea({
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 3, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1}
})
setCombatArea(combat, area)

function onCastSpell(cid, var)
    local specs = getSpectators(getCreaturePosition(cid), 3, 3)
    for _, pid in ipairs(specs) do
        if(isPlayer(pid)) then
            doSendAnimatedText(getCreaturePosition(pid), "Invis!", COLOR_LIGHTBLUE)
            doRemoveCondition(pid, CONDITION_INVISIBLE)
        end
    end
   return doCombat(cid, combat, var)
end
 
Last edited:
Solution
OP
kennyubuntu

kennyubuntu

Member
Joined
May 20, 2016
Messages
150
Reaction score
13
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)

local area = createCombatArea({
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 3, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1}
})
setCombatArea(combat, area)

function onCastSpell(cid, var)
    local specs = getSpectators(getCreaturePosition(cid), 3, 3)
    for _, pid in ipairs(specs) do
        if(isPlayer(pid)) then
            doSendAnimatedText(getCreaturePosition(pid), "Invis!", COLOR_LIGHTBLUE)
            doRemoveCondition(pid, CONDITION_INVISIBLE)
        end
    end
   return doCombat(cid, combat, var)
end

GOD! its working!!!!!!! ty! I LOVE THIS SPELL
 

Elgenady

Veteran OT User
Joined
Aug 5, 2011
Messages
1,602
Solutions
33
Reaction score
295
Lua:
function onSay(cid, words, param, channel)
local condition = createConditionObject(CONDITION_INVISIBLE)
setCombatCondition(combat, condition)
setConditionParam(condition, CONDITION_PARAM_TICKS, -1)

 if getCreatureStorage(cid, "ghostmod")<= 0  then 
     doAddCondition(cid, condition)
     setPlayerStorageValue(cid, "ghostmod", 1)
 elseif getCreatureStorage(cid, "ghostmod") >= 1 then
      doRemoveCondition(cid, CONDITION_INVISIBLE)
      setPlayerStorageValue(cid, "ghostmod", 0)
     end
     return true
 end
and in talkaction.xml
<talkaction log="yes" words="/ghost" access="3" event="script" value="ghost.lua"/>

now everything will work like be4
gm can't see cm and cm can't see admin and player can't see all of them
 

djblah

Member
Joined
Oct 15, 2010
Messages
92
Solutions
1
Reaction score
24
With the help of @heba i have the so wanted invisible spell (utana vid but invisible for other players, just like warlocks do)

source changes:

replace functions:
Code:
void Player::sendCreatureChangeVisible(const Creature* creature, Visible_t visible)
{
    if(!client)
        return;

    const Player* player = creature->getPlayer();
    if(player == this || (player && (getGhostAccess() > player->getGhostAccess())))
        sendCreatureChangeOutfit(creature, creature->getCurrentOutfit());
    else if(visible == VISIBLE_DISAPPEAR)
        sendCreatureDisappear(creature, creature->getTile()->getClientIndexOfThing(this, creature));
    else
        sendCreatureAppear(creature);
}


bool Player::canSeeCreature(const Creature* creature) const
{
    if(creature == this)
        return true;

    if(const Player* player = creature->getPlayer())
        return !player->isInvisible() || getGhostAccess() > player->getGhostAccess();

    return !creature->isInvisible();
}



edit functions:
Code:
    void Player::onEndCondition(ConditionType_t type)

after
        g_game.updateCreatureSkull(this);
    }

    add

        else if(type == CONDITION_INVISIBLE)
    {
        Position newPos = getPosition();
        g_game.addDistanceEffect(Position(newPos.x + 1, newPos.y, newPos.z), newPos, SHOOT_EFFECT_ENERGY);
        g_game.addDistanceEffect(Position(newPos.x - 1, newPos.y, newPos.z), newPos, SHOOT_EFFECT_ENERGY);
        g_game.addDistanceEffect(Position(newPos.x, newPos.y + 1, newPos.z), newPos, SHOOT_EFFECT_ENERGY);
        g_game.addDistanceEffect(Position(newPos.x, newPos.y - 1, newPos.z), newPos, SHOOT_EFFECT_ENERGY);
    }

But there are a few problems i don't know how to fix...
I have to stop inv in 3 ways:

1- utamo ina is not working (a area spell to remove inv)
inv players don't recive area damage, can trap, do a lot things, i need a cauter play like this area spell that remove the utana vid, but it is not working (it was working before the modifications)

Code:
    <instant name="Cancel Invisibility" words="utana ina" maglv="1" mana="210" prem="0" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="support/cancel invisibility.lua">

    </instant>

cancel invisibility.lua
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_INVISIBLE)

local area = createCombatArea(AREA_CIRCLE3X3)
setCombatArea(combat, area)

function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end

2- players that attack still invisible
this is so OP, players can still invisible and attacking other players, i would like to when players do damage in other players, it stops the inv

3- players recive damage but still invisible
the monsters that are imune to inv can attack the inv players, but its strange because it still invisible, it should stop the invisibility

my source: Fir3element/3777 (https://github.com/Fir3element/3777/tree/master/src)

a question so that it works well you made these changes or kept it as you modified it and posted it in the forum
 

eyez

Member
Joined
Oct 11, 2016
Messages
129
Reaction score
19
Lua:
function onSay(cid, words, param, channel)
local condition = createConditionObject(CONDITION_INVISIBLE)
setCombatCondition(combat, condition)
setConditionParam(condition, CONDITION_PARAM_TICKS, -1)

if getCreatureStorage(cid, "ghostmod")<= 0  then
     doAddCondition(cid, condition)
     setPlayerStorageValue(cid, "ghostmod", 1)
elseif getCreatureStorage(cid, "ghostmod") >= 1 then
      doRemoveCondition(cid, CONDITION_INVISIBLE)
      setPlayerStorageValue(cid, "ghostmod", 0)
     end
     return true
end
and in talkaction.xml
<talkaction log="yes" words="/ghost" access="3" event="script" value="ghost.lua"/>

now everything will work like be4
gm can't see cm and cm can't see admin and player can't see all of them
ty!
 
OP
kennyubuntu

kennyubuntu

Member
Joined
May 20, 2016
Messages
150
Reaction score
13
Lua:
function onSay(cid, words, param, channel)
local condition = createConditionObject(CONDITION_INVISIBLE)
setCombatCondition(combat, condition)
setConditionParam(condition, CONDITION_PARAM_TICKS, -1)

 if getCreatureStorage(cid, "ghostmod")<= 0  then
     doAddCondition(cid, condition)
     setPlayerStorageValue(cid, "ghostmod", 1)
 elseif getCreatureStorage(cid, "ghostmod") >= 1 then
      doRemoveCondition(cid, CONDITION_INVISIBLE)
      setPlayerStorageValue(cid, "ghostmod", 0)
     end
     return true
 end
and in talkaction.xml
<talkaction log="yes" words="/ghost" access="3" event="script" value="ghost.lua"/>

now everything will work like be4
gm can't see cm and cm can't see admin and player can't see all of them

i've found 3 bugs by using this in a server online:
1- gods/gms with ghosts are trapping the players
if i do /ghost and go to you, if u try to walk in my SQM it will block you
it was amazing for players inv, but for gms/gods it is bad

2- players can see efects from gods/gms in ghost
for example: if i do /ghost, and then do /goto you
you the player will see the teleport effect...
if i create an item, you will see the red effect....


3- gods/gms when atk something loses the inv, just like players

did u know how to fix this 3 stuffs?
the problem 1 is the wrose, if u know how to fix it pls tell
and ty u again for this system, it is amazing!
 
Last edited:
Top