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

getTileNonPVP(pos) for use with RME...

tatu hunter

Insane Mind~
Joined
Jun 6, 2007
Messages
354
Reaction score
23
Location
Itaporã, Brazil
I request a function to check if the tile is non-pvp, it can be like getTilePzInfo(pos), but for check the NonPVP tile.

thx
 
This function should be changed to getTileInfo(pos) and should return: 0 - if tile have no state, 1 = pz, 2 = no pvp, 3 = pvp.

Request too.
 
Here you have script for nonpvp checking (little modification oldest getTilePzInfo(pos)

Code:
int32_t LuaScriptInterface::luaGetTileNonPvpInfo(lua_State* L)
{
	//getTilePzInfo(pos)
	PositionEx pos;
	popPosition(L, pos);
	
	Tile *tile = g_game.getMap()->getTile(pos);
	if(tile)
	{
		if(tile->hasFlag(TILESTATE_NOPVPZONE))
			lua_pushnumber(L, LUA_TRUE);
		else
			lua_pushnumber(L, LUA_FALSE);
	}
	else
	{
		reportErrorFunc(getErrorDesc(LUA_ERROR_TILE_NOT_FOUND));
		lua_pushnumber(L, LUA_ERROR);
	}
	return 1;
}
 
Omg, really thx...
but dont forget to register the lua function, so add:
//getTileNonPvpInfo(pos)
//1 is non-pvp. 0 no non-pvp.
lua_register(m_luaState, "getTileNonPvpInfo", LuaScriptInterface::luaGetTileNonPvpInfo);
and in luascript.h
static int32_t luaGetTileNonPvpInfo(lua_State* L);
 
Last edited:
@slawkens
about your idea to change the function "getTilePzInfo"...
I want to know if this code wil work:
Code:
int32_t LuaScriptInterface::luaGetTileInfo(lua_State* L)
{
    //getTilePzInfo(pos)
    PositionEx pos;
    popPosition(L, pos);
    
    Tile *tile = g_game.getMap()->getTile(pos);
    if(tile)
    {
        if(tile->hasFlag(TILESTATE_PROTECTIONZONE))
            lua_pushnumber(L, LUA_TRUE);
        else if(tile->hasFlag(TILESTATE_NOPVPZONE))
            lua_pushnumber(L, 2);
        else if(tile->hasFlag(TILESTATE_PVPZONE))
            lua_pushnumber(L, 3); 
        else if(tile->hasFlag(TILESTATE_NOLOGOUT))
            lua_pushnumber(L, 4); 
        else
            lua_pushnumber(L, LUA_FALSE);
    }
    else
    {
        reportErrorFunc(getErrorDesc(LUA_ERROR_TILE_NOT_FOUND));
        lua_pushnumber(L, LUA_ERROR);
    }
    return 1;
}
I dont know nothing about c++, but i know php language...

edit...

nvm, the code works good ;P
 
Last edited:
Yes, but remember that sometimes tile have more than 1 state. But if you arent using it often, then it will work, but in some situactions not.
 
a question, im using now the RME editor, looks alot good and etc...that thing PVP tile... it means players can duel there and if they die they won't loose anything or they loose the things (exp, items, etc)?

thanks
 
@up
NO if you die you will lose items...
NON-PVP tool in RME is only to make areas non-pvp where players cant attack other players.
 
Back
Top