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

War System Error ;(

lewczaja

New Member
Joined
Feb 27, 2009
Messages
15
Reaction score
0
I need help.
When I want to accept war I have this error in console:

[Error - TalkAction Interface]
data/talkactions/scripts/war.luanSay
Description:
data/talkactions/scripts/war.lua:70: attempt to call global 'doGuildAddEnemy' (a nil value)
stack traceback:
data/talkactions/scripts/war.lua:70: in function <data/talkactions/scripts/war.lua:1>

Can someone help me??
 
must I add this to luascript.cpp??
doCreatureSetGuildEmblem(cid, emblem)
doCreatureSetPartyShield(cid, shield)
doGuildAddEnemy(cid, enemy, war, mode)
doGuildRemoveEnemy(cid, enemy)
dodirectory(dir)

If yes tell me how :)
 
I have added these functions to my luascrupt.cpp then I recompiled with param -D__WAR_SYSTEM__ without any errors and still is the error when I want to accept war invitation.

#ifdef __WAR_SYSTEM__

//doGuildAddEnemy(guild, enemy, war, type)
lua_register(m_luaState, "doGuildAddEnemy", LuaInterface::luaDoGuildAddEnemy);

//doGuildRemoveEnemy(guild, enemy)
lua_register(m_luaState, "doGuildRemoveEnemy", LuaInterface::luaDoGuildRemoveEnemy);
#endif

#ifdef __WAR_SYSTEM__

int32_t LuaInterface::luaDoGuildAddEnemy(lua_State* L)
{
//doGuildAddEnemy(guild, enemy, war, type)
War_t war;
war.type = (WarType_t)popNumber(L);
war.war = popNumber(L);

uint32_t enemy = popNumber(L), guild = popNumber(L), count = 0;
for(AutoList<Player>::iterator it = Player::autoList.begin(); it != Player::autoList.end(); ++it)
{
if(it->second->isRemoved() || it->second->getGuildId() != guild)
continue;

++count;
it->second->addEnemy(enemy, war);
g_game.updateCreatureEmblem(it->second);
}

lua_pushnumber(L, count);
return 1;
}

int32_t LuaInterface::luaDoGuildRemoveEnemy(lua_State* L)
{
//doGuildRemoveEnemy(guild, enemy)
uint32_t enemy = popNumber(L), guild = popNumber(L), count = 0;
for(AutoList<Player>::iterator it = Player::autoList.begin(); it != Player::autoList.end(); ++it)
{
if(it->second->isRemoved() || it->second->getGuildId() != guild)
continue;

++count;
it->second->removeEnemy(enemy);
g_game.updateCreatureEmblem(it->second);
}

lua_pushnumber(L, count);
return 1;
}
#endif


Any ideas??
 
Last edited:
Back
Top