hi elitepvpers,
I am having an question about adding stuff to an vector.
What i have done is this
Inside my Lua
[code]
dofile( ".\\LuaFunc\\RiftFunc.lua" )
-----------------------------------------------------
------------Define WORLD Information----------------
-----------------------------------------------------
AddWorld("WI_INSTANCE_CONTAMINTRAILS", 1413.187f, 100.487f, 1261.361f)
AddWorld("WI_INSTANCE_KALGAS", 626.433f, 300.086F, 1119.150F)
[code]
LuaFunc
Now the next part is this
For testing i added Error("%s", nWorldId); to see if its returning an id.
However its giving an NULL as return.
Now is the code i produce correct? espacialy the part to set an Variable nWorldId?
@[Only registered and activated users can see links. Click Here To Register...] you have some experience according to your post can you take an look at it?
With kind regards
I am having an question about adding stuff to an vector.
What i have done is this
Code:
BOOL CRiftMng::LoadScript()
{
if (m_Lua.RunScript("Rift.lua") != 0)
{
Error("Rift.lua Load Failed!!!");
exit(0);
}
m_Lua.GetGloabal("tWorld");
m_Lua.PushNil();
while (m_Lua.TableLoop(-2))
{
__RANDOM_WORLD srRndWorld;
srRndWorld.dwWorldID = static_cast<int>(CScript::GetDefineNum(m_Lua.GetFieldToString(-1, "strWorldID")));
srRndWorld.vPosX = static_cast<int>(m_Lua.GetFieldToNumber(-1, "vPosX"));
srRndWorld.vPosY = static_cast<int>(m_Lua.GetFieldToNumber(-1, "vPosY"));
srRndWorld.vPosZ = static_cast<int>(m_Lua.GetFieldToNumber(-1, "vPosZ"));
m_vecWorld.push_back(srRndWorld);
m_Lua.Pop(1);
}
m_Lua.Pop(0);
return TRUE;
}
[code]
dofile( ".\\LuaFunc\\RiftFunc.lua" )
-----------------------------------------------------
------------Define WORLD Information----------------
-----------------------------------------------------
AddWorld("WI_INSTANCE_CONTAMINTRAILS", 1413.187f, 100.487f, 1261.361f)
AddWorld("WI_INSTANCE_KALGAS", 626.433f, 300.086F, 1119.150F)
[code]
LuaFunc
Code:
tWorld[nIndex] = {}
function AddMonster(strWorldID, vPosX, vPosY, vPosZ)
nIndex = table.getn( tWorld ) + 1
tWorld[nIndex].strWorldID = strWorldID
tWorld[nIndex].vPosX = vPosX
tWorld[nIndex].VposY = VposY
tWorld[nIndex].VposZ = VposZ
end
Code:
void CRiftMatch::SetRandomWorld()
{
vector<__RANDOM_WORLD> m_vecRndInfo = CRiftMng::GetInstance()->m_vecWorld;
for (int i = 0; i < (int)m_vecRndInfo.size(); i++)
{
nWorldId = m_vecRndInfo.at(i).dwWorldID;
}
}
However its giving an NULL as return.
Now is the code i produce correct? espacialy the part to set an Variable nWorldId?
@[Only registered and activated users can see links. Click Here To Register...] you have some experience according to your post can you take an look at it?
With kind regards