• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Custom Vocation INVISIBILITY

Powtreeman

Member
Joined
Sep 26, 2011
Messages
400
Reaction score
6
Location
USA
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?
 
Pretty much yes

- - - Updated - - -

Or at least invisibility that nobody else can detect and from there ill just make it last for like 2 or 3 seconds and give it a CD of 8 or 10 seconds.
 
I'm pretty sure you can only make it by source edits :/ Just look how the "/ghost" feature works and try to change it~~
 
These 2 goes into Luascript.cpp
Code:
lua_register(m_luaState, "doChangeVisibility", LuaScriptInterface::luaDoChangeVisibility);
Code:
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;
}

luascript.h
Code:
static int32_t luaDoChangeVisibility(lua_State* L);

And then use like:
LUA:
doChangeVisibility(cid, true)--Visible
doChangeVisibility(cid, false)--Invisible

This should make you invis for 3 sec: (haven't tried any of these though FYI)
LUA:
doChangeVisibility(cid, false)
addEvent(doChangeVisibility, 3000, cid, true)

CreatureScript example: [not sure]
LUA:
function onCombat(cid,target)
		if(isPlayerGhost(cid))
			doChangeVisibility(cid, true)
	return true
end
 
Last edited:
Back
Top