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

Lua weird spell error

Raiden

Developer
Joined
Sep 16, 2008
Messages
486
Reaction score
32
Location
Venezuela
Hello, i make a custom spell what got the function "doPlayerAddMana(cid, -50)" the problem is the next when i use the spell i lose 40 mana and it show like a magic shield hit (IT show the blue numbers with the "40" and in console say "You lose 40 mana")

What is this? i put to lose 50 mana and it only quit me 40 and also show it like mana shield...

All of this on avesta 7.6 help please
 
it is because you put "addplayermana(cid, -50)" to make the mana cost (if it is what you want) you need to make it on the spells.xml where says mana=xxx
 
QUOTE=Cykotitan;1176850]I don't think it can be done on avesta without a source edit[/QUOTE]

No problem i can compile the server... What sources i need edit?
 
Uhm... luascript.cpp and more. Find the function in there and post it here.

Sorry for the delay here it go!

Luascript.cpp Line 1281

Code:
	//doPlayerAddMana(cid, mana)
	lua_register(m_luaState, "doPlayerAddMana", LuaScriptInterface::luaDoPlayerAddMana);

Line 2568
Code:
int LuaScriptInterface::luaDoPlayerAddMana(lua_State *L)
{
	//doPlayerAddMana(cid, mana)
	int32_t manaChange = (int32_t)popNumber(L);
	uint32_t cid = popNumber(L);

	ScriptEnviroment* env = getScriptEnv();

	Player* player = env->getPlayerByUID(cid);
	if(player){
		g_game.combatChangeMana(NULL, player, manaChange);
		lua_pushnumber(L, LUA_NO_ERROR);
	}
	else{
		reportErrorFunc(getErrorDesc(LUA_ERROR_PLAYER_NOT_FOUND));
		lua_pushnumber(L, LUA_ERROR);
	}
	return 1;
}

Luascript.h Line 384
Code:
static int luaDoPlayerAddMana(lua_State *L);
 
Back
Top