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

True Ghost Spell

renancs

New Member
Joined
Jul 8, 2008
Messages
252
Reaction score
3
Hello, im needing a spell for assassin class...
Normaly the asssassins have a talent to use the spell ghost in games...
But in tibia the "utana vid" is a sh..!

So, i think i can use the ghost of gms/gods...
More... How can i put to when the player stay in ghost mode, when he attack a player or monster,
he go show again?

and the stealth is realy stealth like the ghost of gms...

Help plss...


Summ:
onCastSpell:
use the executeTalkaction function with /ghost command ignoring the access check (parameter) + set a storage

onAttack/onCombat:
check if player has storage (is ghost?) and call the executeTalkaction again, set storage and be happy

Though I don't think this will work well..

But how to do? ;s
 
code based on functions from 0.4, they might not be the same for your version


add this to your 050-functions.lua or global.lua or w/e:
Code:
function showPlayer(cid)
    doCreatureExecuteTalkAction(cid, "/ghost", true)
    unregisterCreatureEvent(cid, "RemoveGhostCombat") 
    unregisterCreatureEvent(cid, "RemoveGhostSpell")
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)  
    return true
end



make your spell with this code:
Code:
function onCast(cid, var)
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
    if getPlayerStorageValue(cid, 9999) ~= -1 then
        stopEvent(getPlayerStorageValue(cid, 9999))
        unregisterCreatureEvent(cid, "RemoveGhostCombat") 
        unregisterCreatureEvent(cid, "RemoveGhostSpell")
        doCreatureExecuteTalkAction(cid, "/ghost", true)
        setPlayerStorageValue(cid, 9999, -1)
    else
         doCreatureExecuteTalkAction(cid, "/ghost", true)
         registerCreatureEvent(cid, "RemoveGhostCombat")
         registerCreatureEvent(cid, "RemoveGhostSpell")
         setPlayerStorageValue(cid, 9999, addEvent(showPlayer, 10000, cid))
    end
    return true
end






make this creaturescript named removeghost.lua:
Code:
function onCombat(cid, target) 
    doCreatureExecuteTalkAction(cid, "/ghost", true)
    unregisterCreatureEvent(cid, "RemoveGhostCombat")
    unregisterCreatureEvent(cid, "RemoveGhostSpell")
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
    stopEvent(getPlayerStorageValue(cid, 9999))
    return true
end






make this creaturescript named removeghostspell.lua:
Code:
function onCast(cid, target) 
    doCreatureExecuteTalkAction(cid, "/ghost", true)
    unregisterCreatureEvent(cid, "RemoveGhostCombat")
    unregisterCreatureEvent(cid, "RemoveGhostSpell")
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
    stopEvent(getPlayerStorageValue(cid, 9999))
    return true
end






add this to your creaturescripts.xml
Code:
<event type="combat" name="RemoveGhostCombat" event="script" value="removeghost.lua"/>
<event type="cast" name="RemoveGhostSpell" event="script" value="removeghostspell.lua"/>


this should be enough


EDIT: Added a missing function to un-hide the player
RE-EDIT: Added spell effect, added cancelling ghost on cast
RE-RE-EDIT: Fixed a bug on cancelling on cast and added a time limit
RE-RE-RE-EDIT: Fixed a compiling bug, used compatibility functions
RE-RE-RE-RE-EDIT: Added ability to stop invis if casted again
 
Last edited:
well, the script work, but when i attack the creature, the "unregister" don't work...
don't stay visible again =(

thanks!
 
Last edited:
my bad, I forgot to use the talkaction to un-ghost him, should work perfectly now

*edited my first post*

Don't forget to Rep :)
 
Last edited:
Scarlet, Thanks alot
Rep++.

Well, work 100%, but know, u know, how can i put a "effect" when the player use the 'spell'.
I have a sprite effect to use in this spell, and i wanna to put.

And is possible, put to if the player use a spell, he go show too...


Thanks alot!!
 
Scarlet, Thanks alot
Rep++.

Well, work 100%, but know, u know, how can i put a "effect" when the player use the 'spell'.
I have a sprite effect to use in this spell, and i wanna to put.

And is possible, put to if the player use a spell, he go show too...


Thanks alot!!

Use:

Lua:
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)

And put it wherever / whenever you want to do the effect :p
 
Which TFS are you using? because in 0.3.6 /ghost can't work for normal players properly without debugs

the server doesn't send remove creature to surrounding players unless it's a player with access, which is solved by editing sources
 
Scarlat, and to player show if use a spell?
and its possible put to player show in x seconds?

What happends when he goes ghost mode, doesnt monster see him lol? If not then he can just go and rush every quest solo:p
cuz this... =D
I thought it would take to put the monsters to spotting the player invisible.


the server doesn't send remove creature to surrounding players unless it's a player with access, which is solved by editing sources
i know, my friend send a edited source for me compile..
 
Well Scarlat, now i have some errors on console, and when i use the spell, when i attack the monster or use spell
i don't show again, but the time of spell are working...
u using tfs forwhat version? maybbe this is a problem no? im using tfs for 8.54-8.57...
can u try in your tfs to see, if u have a bugs too =D


print of error.JPG
 
updated again

Tested against a demon, he totally ignores me while invis, can't test with other players since I'm all alone in my server, but should work fine :)
 
Last edited:
when u attack something or cast any spell, it'll make you visible again, also, it'll make you visible again if 10 seconds pass after activation

Anyway, I just made the code he asked, personally, I don't like it either, but oh well :p
 
Well, the errors from console are fixed..
But when i use spell, don't remove the invisibility, and sometimes, altomatic the character change of visible mode to invisible mode kkk

U test in your tfs? Maybe i need change somethingn in source... no?
 
I tested it on my TFS 0.4 and it worked like expected

yeah, I didn't do that, it only resets the invisibility if you attack/cast/time runs out

to fix that problem, just add an exhaust time equal or higher then the amount of time players can be invisible(for example, if they can stay invis for 10 seconds, have the exhaust on 20 seconds)

if you do that, it'll fix all the problems you have
 
Back
Top