PDA

View Full Version : Quick Question: Non Map-Specific Menu



flatland69
09-10-2010, 09:29 AM
Hi guys

A few quick questions:

1) Say I have a menu that pops up for the player to choose weapons before he spawns. Obviously I always want this to happen, regardless of the map. From what i can gather, I think UIscene and kismet will end up with a map-specific menu. What will I use to make a menu that will always be there when a player spawns, regardless of game type or map? I'm guessing some Unrealscript that calls a uiScene??

2) where should this piece of code be placed for the scene to be called before the player pawn is spawned, but whenever it is about to? Ie, when the player has just joined the game, or he respawns after dying. Would putting it in PlayerController function ServerRestartPlayer be appropriate?

3) Once I have achieved 1 and 2, how can I stop the player spawning until a selection is made and the menu is closed?

Thanks in advance

flatland69
09-11-2010, 01:56 PM
OK, I've got a bit of code that starts a UIscene now... I'm just not sure where would be the best place to put it to make sure the player sees it before he spawns, or how to make sure he doesn't spawn until the menu is done. Any help would be appreciated.

Pranav
09-11-2010, 03:20 PM
in GameInfo, on the add default inventory, you can open the UI scene, figure hte weapon he chooses and place it in the inventory :) cheers :D

flatland69
09-11-2010, 04:41 PM
Thanks, it works, but the thing is the player still spawns in the background, while the uiscene is still open. Is there a way I can stop the player spawning until the uiscene is closed?

Crusha K. Rool
09-11-2010, 05:07 PM
Would be interesting to know... I don't have in mind right now at which point (function) the player is spawned, but you could just interrupt the chain in AddDefaultInventory() by neither calling the super function nor calling the next function that would continue in the startup chain. Only your UIScene (for players; for bots you could probably do some random picking of a weapon and continue as usual) is called.
Then you should somehow get the UIScene to call the function that continues the chain when the player made a choice. I don't know if UIScene can call plain UnrealScript functions, but maybe you can write an exec function in your GameInfo that does nothing else than continue the chain in script and call that function with a ConsoleCommand in UIScene.

Pretty hacky, I know. That's why I hope that someone comes up with a better solution. ;)

flatland69
09-11-2010, 05:16 PM
I think uiScene can call a function, but I'm not entirely sure... I'll fiddle a bit and see, thanks for the help :D I'd love to know exactly where the playercontroller requests a pawn to be spawned, that would help me out quite a bit...

I'll call back in a few hours when I make some headway :D

Pranav
09-11-2010, 05:18 PM
I believe I saw this problem, look at the 3dbuzz tutorials for UIScenes, they showed how to fix that problem. I believe it was setting bHidden = true, or Mesh.SetHidden(true); The 3dbuzz tutorials have the answers for a fact I know :D

flatland69
09-11-2010, 05:18 PM
:O I have all of those saved on my desktop! Thanks for the headsd up :D

Pranav
09-11-2010, 05:27 PM
no problem, I hope you get the answer but I know for a fact its the UIScene series that tells the answer :)

flatland69
09-11-2010, 07:24 PM
I watched the video, they use an option to pause the game while active, which isn't really going to work in multiplayer xD I think the solution will be in the code... unfortunately :P

flatland69
09-11-2010, 07:53 PM
Double post -.-

flatland69
09-11-2010, 07:59 PM
After a bit of looking about, I think I'm going to use the restartPlayer function, since it calls both the SpawnDefaultPawnFor() Function and AddDefaultInventory() Function, allowing me to add menus to allow th player to choose a pawn and a default inventory. Now I just need to find out how the hell to make it stop doing things until the menu is closed!

Crusha K. Rool
09-11-2010, 09:15 PM
Override the RestartPlayer function, don't call the super function, call only the UIScene. Then set the DefaultInventroy from the UIScene, depending on the choice of the player and then let it call the function as described below:



function RestartPlayer()
{
if (bPlayerHasChosenWeapon)
{
SpawnDefaultPawnFor();
AddDefaultInventory();
.
.
*everything else that gets done in RestartPlayer usually*
}
else
{
// Activate UIScene
}

// This should get called by the UIScene
function WeaponSelectionComplete()
{
bPlayerHasChosenWeapon = True;
// Maybe other stuff, if necessary
}

function PlayerDied() // or however that was named..
{
super.PlayerDied();

bPlayerHasChosenWeapon = False;
}

Pranav
09-11-2010, 09:44 PM
Well stil you have the problem of the game being active, well what you coul do is use GhostRecon tactics, because they have a similar system, and what they do is that in the beginning, EVERYONE's game is paused while choosing weapons, and if you die and you have to choose weapons again, you will be invincible a short while after you spawn :)., sometimes the best way out is a workaround :D

flatland69
09-12-2010, 05:36 AM
Thanks for the replies! I'll try that right now Crusha. Just wondering, why should I not call the super function?

Regarding the stopping the game, could I make a loop something like:

do
{

}while (WHPlayerController(NewPlayer).mustWait() == true);

This would result in a 'busy waiting' kindof thing, that would repeat until the player closes the uiScene and a boolean returned by the mustWait() function is set to false.

Is this busy waiting technique a good idea? I tend to think no but I'm at a loss for ideas :/

Thing is that if the player spawns, but is invincible, he still won't get the pawn he chooses...

Thanks for all the input though! Gets the brain going :D

EDIT: Tried the busy waiting, UDK didn't like it at all :/

flatland69
09-12-2010, 07:20 AM
Crusha, I just realized what you said! Should work, but it seems to jam and crash :/

toxicFork
09-12-2010, 08:05 AM
Well it might enter an infinite loop...
Try putting some sleep maybe?

flatland69
09-12-2010, 12:23 PM
Finally got it working! Crusha, you're brilliant!