Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Flyff > Flyff Private Server
You last visited: Today at 05:03

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



little bug Rift System

Discussion on little bug Rift System within the Flyff Private Server forum part of the Flyff category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Oct 2012
Posts: 948
Received Thanks: 157
little bug Rift System

Hi all,

Some of you know that i am working on an rift system for flyff.

Well i need an bit of help once again xD.

I thought i finished it but then i noticed an little bug.
Ok here it goes.

.lua file contains
AddWorld(WorldID, TotalMonster, StartPosition)

SetMonsterSpawn(WorldID, Position)
SetMonsterSpawn(WorldID, Position)
SetMonsterSpawn(WorldID, Position)

now for test its filled like this

AddWorld(1, 5, 123, 100, 20)

SetMonsterSpawn(1, 127,100,25)
SetMonsterSpawn(1, 50,100,300)
SetMonsterSpawn(2, 150,100,500)

Ok so far so good.
The problem is when i enter the rift at world id 1 instead of random 5 monsters it sometimes set just 2 monsters at 2 diff locations.

That is because its also using the SetMonsterSpawn (2).

So my question is how can i make it so that it only loops true the RIFT_SPAWN vector if the WorldId is the same as SetMonsterSpawn(WorldId).

Atm i have it like this
Code:
D3DXVECTOR3 CRiftMatch::GetMoverSpawnPoints(DWORD dwWorldId)
{
	vector<RIFT_MONSTER_SPAWN> vecSpawn = CRiftMng::GetInstance()->m_vecMSpawnPoint;
	for (int i = 0; i < vecSpawn.size(); i++)
	{
		if (vecSpawn[i].dwWorldId == dwWorldId)
		{
			OUTPUTDEBUGSTRING("\n GetSpawnPoints %d", vecSpawn.size());
		}
	}
	int nRand = rand() % vecSpawn.size();
	return vecSpawn[nRand].vPos;
}
Output is still 3! it should be 2. Cause only 2 SpawnPoints exists with the same WorldId.

@ i will tag you to cause you already have helped me an lot in understanding vectors. but i can't seem to solve this one.

With kind regards/.
raventh1984 is offline  
Old 12/29/2016, 16:27   #2
 
elite*gold: 0
Join Date: Mar 2008
Posts: 333
Received Thanks: 284
Code:
OUTPUTDEBUGSTRING("\n GetSpawnPoints %d", vecSpawn.size());
You are printing the size of the vector, of course it's 3. Put the spawn points you need into a new vector or even better save the spawnpoints per world and not globally
Nortix is offline  
Old 12/29/2016, 16:36   #3
 
elite*gold: 0
Join Date: Oct 2012
Posts: 948
Received Thanks: 157
well actualy they are saved per world.

Code:
while (Lua.TableLoop(-2))
		{
			RIFT_MONSTER_SPAWN rSpawnPoint;
			rSpawnPoint.dwWorldId = static_cast<int>(CScript::GetDefineNum(Lua.GetFieldToString(-1, "dwWorldId")));
			rSpawnPoint.vPos.x = static_cast<float>(Lua.GetFieldToNumber(-1, "x"));
			rSpawnPoint.vPos.y = static_cast<float>(Lua.GetFieldToNumber(-1, "y"));
			rSpawnPoint.vPos.z = static_cast<float>(Lua.GetFieldToNumber(-1, "z"));

			m_vecMSpawnPoint.push_back(rSpawnPoint);
			Lua.Pop(1);
		}
The only thing i need to figure out if that if dwWorldId == the same as the vectors world id then output the correct positions. so yeah then i can make an new vector that contains the proper Positions per worldId and then loop true it.

Maybe its that i am to long awake xD.
raventh1984 is offline  
Old 12/29/2016, 16:43   #4
 
elite*gold: 0
Join Date: Mar 2008
Posts: 333
Received Thanks: 284
No, they are not saved per world, just with the ID of the world. Have a look at PartyDungeon.lua and how it is loaded

But to address your problem, it's almost the same
Nortix is offline  
Thanks
1 User
Old 12/29/2016, 17:04   #5
 
elite*gold: 0
Join Date: Mar 2008
Posts: 665
Received Thanks: 230
You have to loop the entire spawn vector but cannot return when the first result is found.
Also you could use std::find_if() with a lambda expression, but this is fine.

For returning all data correctly, use pointers.

Code:
void CRiftMatch::GetMoverSpawnPoints(DWORD dwWorldId, std::vector<RIFT_MONSTER_SPAWN>* vec)
{
	vector<RIFT_MONSTER_SPAWN> vecSpawn = CRiftMng::GetInstance()->m_vecMSpawnPoint;
	for (int i = 0; i < vecSpawn.size(); i++)
	{
		if (vecSpawn[i].dwWorldId == dwWorldId)
		{
			int nRand = rand() % vecSpawn.size();
			vec.push_back(vecSpawn[nRand]);
			OUTPUTDEBUGSTRING("\n GetSpawnPoints %d", vecSpawn.size());
		}
	}
}

std::vector<RIFT_MONSTER_SPAWN> v;
GetMoverSpawnPoints(WORLD, &v); //v is filled with data from function
I won't do using this way. I will use an enum for defining each phase (hope there are not many phases) and a container for each phase to keep the progress of the instance.
Removing monsters from container when dying and adding at the start of each phase. A std::map(MONSTER_ID, MONSTER_DATA) or std::map(WORLD, MONSTER_DATA) or std::map(WORLD+PHASE_DATA, MONSTER_DATA).
alfredico is offline  
Thanks
2 Users
Reply


Similar Threads Similar Threads
[Show] Rift System( Almost Finished)
01/28/2017 - Flyff Private Server - 11 Replies
Hi Elitepvpers, With an big thanks to alfredico and some other players xD i have managed to create an Diablo 3 ish Rift game for flyff What it does? First speak to an NPC Players will see this http://image.prntscr.com/image/08ebfa8dde9049d990 37b3e9eeae4d6f.png
Aion Rift System Details Unveiled
10/15/2009 - Gaming News - EN - 0 Replies
Aion Rift is the port between Elyos and Asmodians, the Rift randomly appears in the maps(>Level 20). Through the Rift, Elyos or Asmodians can enter in the land of oppoisite faction, its the only way to pvp except Abyss, of course you can only use it to collect materials, do quests or go to common instances. Some rules about the Rift: Appear randomly, but in a certain area The number of Rifts that appear in the same time is 2~6 Time Limit, Number of Players Limit and Level Limit The...



All times are GMT +1. The time now is 05:04.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.