Powtreeman
Member
How can I make a spell that turns my custom voc invisible until he attacks a player or monster and so players cannot see him or her until they are being attacked?
Is this possible?
Is this possible?
lua_register(m_luaState, "doChangeVisibility", LuaScriptInterface::luaDoChangeVisibility);
int32_t LuaScriptInterface::luaDoChangeVisibility(lua_State* L)
{
//doChangeVisibility(cid, Visible)
bool visible = popNumber(L);
ScriptEnviroment* env = getEnv();
if(Player* player = env->getPlayerByUID(popNumber(L)))
{
if(visible == true)
g_game.internalCreatureChangeVisible(player, VISIBLE_GHOST_APPEAR);
else
g_game.internalCreatureChangeVisible(player, VISIBLE_GHOST_DISAPPEAR);
lua_pushboolean(L, true);
}
else
{
errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
lua_pushboolean(L, false);
}
return 1;
}
static int32_t luaDoChangeVisibility(lua_State* L);
doChangeVisibility(cid, true)--Visible
doChangeVisibility(cid, false)--Invisible
doChangeVisibility(cid, false)
addEvent(doChangeVisibility, 3000, cid, true)
function onCombat(cid,target)
if(isPlayerGhost(cid))
doChangeVisibility(cid, true)
return true
end