Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Flyff > Flyff Private Server
You last visited: Today at 19:26

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

Advertisement



Generating Random dwWorldID.

Discussion on Generating Random dwWorldID. within the Flyff Private Server forum part of the Flyff category.

Closed Thread
 
Old   #1
 
elite*gold: 0
Join Date: Oct 2012
Posts: 948
Received Thanks: 157
Generating Random dwWorldID.

Hi elitepvpers,

I am working on something so that if you enter an dungeon that it randomize the dungeons.

So what i did was this
Code:
TestMng::SetRandomWorld()
{
	int x = rand() % 2;

	switch (x)
	{
	case 0:
	{
			  dwWorldTest = WI_INSTANCE_CONTAMINTRAILS;
	}
		break;
	case 1:
	{
			  dwWorldTest = WI_INSTANCE_BEHAMAH;
	}
		break;
	}

}
Code:
int TestMng::GetRandomWorld()
{
	//if (dwWorldTest != NULL_ID)
//		Error("dwWorldTest %d", dwWorldTest);
		return dwWorldTest;
}
Code:
CWorld* pWorld = g_WorldMng.GetWorld(pTestMng->GetRandomWorld());
	if (pWorld && pWorld->m_linkMap.GetLinkMap(static_cast<int>(dwPlayerID)))
		pWorld->Invalidate(dwPlayerID);
And
Code:
CWorld* pWorld = g_WorldMng.GetWorld(pTestMng->GetRandomWorld());
	ASSERT(pWorld);
	if (IsValidObj(pUser))
	{
		if (pWorld->m_linkMap.GetLinkMap(static_cast<int>(dwPlayerID)))
		{
			//pUser->REPLACE(g_uIdofMulti, WI_INSTANCE_CONTAMINTRAILS, D3DXVECTOR3(1413.187f, 100.487f, 1261.361f), REPLACE_NORMAL, static_cast<int>(dwPlayerID));
			pUser->REPLACE(g_uIdofMulti, pTestMng->GetRandomWorld(), D3DXVECTOR3(1413.187f, 100.487f, 1261.361f), REPLACE_NORMAL, static_cast<int>(dwPlayerID));
		}
	}
The problem is when i am willing to enter the dungeon its crashing.
On Debugging its telling me that its crashing on

return dwWorldTest; @stMng::GetRandomWorld()

When i enable the error logging. Then the error is saying the correct ID. for each time i try to enter. So i know that SetRandomWorld is functional.

Any tips?

With kind regards.
raventh1984 is offline  
Old 11/29/2016, 09:14   #2
 
elite*gold: 0
Join Date: Nov 2016
Posts: 11
Received Thanks: 0
DWORD dwWorldId = xRandom(2) == TRUE ? WI_INSTANCE_CONTAMINTRAILS : WI_INSTANCE_BEHAMAH;

only one line code..

and without more informations we cant help you..
XorArsen is offline  
Old 11/29/2016, 09:25   #3
 
elite*gold: 0
Join Date: Mar 2008
Posts: 665
Received Thanks: 230
Quote:
Originally Posted by XorArsen View Post
DWORD dwWorldId = xRandom(2) == TRUE ? WI_INSTANCE_CONTAMINTRAILS : WI_INSTANCE_BEHAMAH;

only one line code..

and without more informations we cant help you..
And?


The pointer pTestMng is wrong.
alfredico is offline  
Old 11/29/2016, 10:24   #4
 
elite*gold: 0
Join Date: Nov 2016
Posts: 11
Received Thanks: 0
Quote:
Originally Posted by alfredico View Post
And?


The pointer pTestMng is wrong.
Why should you write 20 lines if you can do it with only one line?
XorArsen is offline  
Old 11/29/2016, 11:35   #5
 
elite*gold: 0
Join Date: Apr 2010
Posts: 82
Received Thanks: 27
where SetRandomWorld() is called ?
Meutledaron is offline  
Old 11/29/2016, 13:24   #6
 
elite*gold: 0
Join Date: Mar 2008
Posts: 665
Received Thanks: 230
Quote:
Originally Posted by XorArsen View Post
Why should you write 20 lines if you can do it with only one line?
It's optional the programming style you want to do, but in this case I'm pretty sure many programmers will agree with this way. You have in this case, different worlds to load which will load for the moment two cases but you could have many other worlds. I prefer to use abbreviations when you have for example just two cases, like true o false; or similar.

Personally, I would use a struct and a vector for the random maps @.
alfredico is offline  
Old 11/29/2016, 14:53   #7
 
elite*gold: 0
Join Date: Oct 2012
Posts: 948
Received Thanks: 157
Thanks all.

I solved the problem by re-scripting some of the code.

And for the Switch cases yeah the intention is to load all dungeons.

So its indead better for struct and vector. I will do that one. xD.

Thanks for the tips all.
raventh1984 is offline  
Closed Thread


Similar Threads Similar Threads
[Released] Monster legends (Random Gold) (Random Food) (Random Exp)
02/03/2015 - Facebook - 6 Replies
Monster legends New Tools !! *1 - Random Gold *2 - Random Food *3 - Random Exp All Tested And Working 100% Without Any Problem :handsdown: !!! Link
[Release] Monster legends (Random Gold) (Random Food) (Random Exp)
02/03/2015 - Dragon City - 5 Replies
Monster legends New Tools !! *1 - Random Gold *2 - Random Food *3 - Random Exp All Tested And Working 100% Without Any Problem :handsdown: !!! Link
Generating random region,x,y and z using c#!
12/04/2014 - SRO Coding Corner - 3 Replies
As title says, I would like to generate random Region ID, PosX, PosY and PosZ using c#. however that may happen by generating x & y coords and converting them into r,x,y,z or just generate them directly. P.S. Those those points should be non-safe zone area. Thanks in advance.



All times are GMT +1. The time now is 19:27.


Powered by vBulletin®
Copyright ©2000 - 2026, 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 ©2026 elitepvpers All Rights Reserved.