Accessing Engine.GameEngine?

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

SuperDre

New Member
May 6, 2002
254
0
0
Helmond.nl
www.superteam.tk
I'm sorry to have to ask this, but how can I access things like GameEngine.LastURl and GameEngine.GPendingLevel

And then next question.. LOL.. How/where can I see the PendingLevel or Level properties/methods? (cause I couldn't find them anywhere)..
 

SuperDre

New Member
May 6, 2002
254
0
0
Helmond.nl
www.superteam.tk
Daid303 said:
You can always try to find the GameEngine with Allobjects()

As for those properties/methods, if it's about map switching, looking at one of the current map votes could be a nice idea.

I tried setting it something like: (this is from the top of my head as I'm sitting at the office at the moment)
Code:
   local GameEngine  ge;

   ge = Gameengine(Findobject('Package.GameEngine'), class'GameEngine');
   if(ge.GLever==none)
       Log("Ohno GLever is none");

It was something like above.. Hmm.... Maybe I should try to replace 'Package' with 'Engine'... But then again, maybe I already did that..

But I'll check out the latest map switching stuff
 

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
SuperDre said:
Code:
ge = Gameengine(Findobject('Package.GameEngine'), class'GameEngine');
The object's name is just "GameEngine" (double quotes because it must be a string variable, not a name variable) and you should check where your function call ends and the casting operator starts.

Code:
ge = GameEngine(FindObject("GameEngine", class'GameEngine'));
 
I use this code in my main menu class to add serverpackages. Maybe it helps.
It's from a main menu. (I'm not going to distubute my mod with it's own ini file because that seems to mess up on some systems)
Code:
	if (bFirstRun)
	{
//		LOG("First run, fixing up Serverpackages and stuff");
		foreach AllObjects(class'GameEngine', gEngine)
		{
			bAddServerPackage1 = True;
			bAddServerPackage2 = True;
			for (i=0;i<gEngine.ServerPackages.Length;i++)
			{
				if (gEngine.ServerPackages[i] == "UMS_Code")
					bAddServerPackage1 = False;
				if (gEngine.ServerPackages[i] == "UMS_Mutators")
					bAddServerPackage2 = False;
			}
			if (bAddServerPackage1)
				gEngine.ServerPackages[gEngine.ServerPackages.Length] = "UMS_Code";
			if (bAddServerPackage2)
				gEngine.ServerPackages[gEngine.ServerPackages.Length] = "UMS_Mutators";
			
			gEngine.LoadingClass = "UMS_Code.UMS_GuiVignette";
//			gEngine.ConnectingMenuClass = "" //Not even used? the default 'MenuConnecting' class can't even be found.
			gEngine.DisconnectMenuClass = "UMS_Code.UMS_GuiNetworkStatusMsg";
			gEngine.SaveConfig();
		}
		bFirstRun = False;
		SaveConfig();
	}
 

SuperDre

New Member
May 6, 2002
254
0
0
Helmond.nl
www.superteam.tk
Hmmm Daid303, you've got something there ;) as there normally is only 1 GameEngine this would also be a good solution..

And @ Wormbo, thanx, I'll definitly will check out the code I'm really using at the moment, cause I think it's nicer coding to do it with the findobject way as there is only one GameEngine active..
 

SuperDre

New Member
May 6, 2002
254
0
0
Helmond.nl
www.superteam.tk
Hmmm,
Code:
FindObject("GameEngine", class'GameEngine')
doesn't return anything, while
Code:
foreach AllObjects(class'GameEngine', ge)
{
  Log("ge is none="$(ge==none));
}
Does work (ge==none)=False

Weird as hell.

But Now I have the ge, where can I find info on the Level object, since I can't find anything on UDN or wiki..
 
Last edited:

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
SuperDre said:
But Now I have the ge, where can I find info on the Level object, since I can't find anything on UDN or wiki..
Do you mean the Level object accessible through any actor's XLevel property or the LevelInfo actor accessible through any actor's Level property? You can find both through AllObjects, but note that there's always an entry level with its own Level and LevelInfo unless your code is executed on a dedicated server.
 

SuperDre

New Member
May 6, 2002
254
0
0
Helmond.nl
www.superteam.tk
Wormbo said:
Do you mean the Level object accessible through any actor's XLevel property or the LevelInfo actor accessible through any actor's Level property? You can find both through AllObjects, but note that there's always an entry level with its own Level and LevelInfo unless your code is executed on a dedicated server.

No I was refering to the GLevel,GEntry properties which are of the Level object type and properties of the GameEngine object. But I can't find any information like what kind of properties/methods the level object has..

And Any Idea why the findobject wouldn't work but the foreach method does?
 

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
FindObject requires you to specify the exact object name nad that doesn't need to be "GameEngine" in your case. Try logging the GameEngine object you found in the ForEach loop.

The Engine.Level class doesn't have any UnrealScript code, so you can only access the properties inherited from Object. It's the same with more useful classes like Engine.Input: You can propably use console commands to access certain properties, but you can't use UnrealScript.
 

SuperDre

New Member
May 6, 2002
254
0
0
Helmond.nl
www.superteam.tk
Damn, I hoped to use those for retrieving the current Server info.. Cause I want to show some extra server info when loading the map.. And I can't seem to find any other info on how to optain the current server.