Issues with your account? Bug us in the Discord!
How to end missions?
Indie
Moderator
How does one end a mission and return the player to the (previous) menu screen? Giving the player the death script and then blowing him up does the trick, but thats not what I want.
Besides, its not polite to blow him up every time he has completed a tough mission. :D
Besides, its not polite to blow him up every time he has completed a tough mission. :D
Comments
[QUOTE][i]Originally posted by Indie [/i]
[B]Besides, its not polite to blow him up every time he has completed a tough mission. :D [/B][/QUOTE]
The world is that unfair (have probs with my (ex)girlfriend again ... becomes usualness *heh*) so this isn't that unrealistic ;) :D .
I thought, Warlord has focused on that? If not, we could remove the mission screen ... so a Fade In Black with Director Mode, maybe a docking sequence/planet/wreck sequence (bnk vid or engine animation) before.
Then removing the mission screen with iGUI.RemoveLastOverlaysAfter( "TheMissionScreen" ); and then should the last Screen .. the GUI screen appear. Have to be tested.
Hmmm... well, its not exactly the same. From the main menu you go to the briefing screen of the next mission so I guess what I'd really want is to go back two screens... I guess it won't be that much of a problem if one can go back once.
Still you could just end mission -> go back one screen ie debriefing (actually there is several screens between mission and your gui) -> from there to next mission or back to main screen. Just that I don't know how to change briefing into debriefing. If we remove overlays it just goes back screens. Also when you go back screens, I don't know if game automatically "cleans" space or not. So if you would go to main screen and after that back to same place in space would the same ships still be there (that's probably not desired). I know that in I-War 2 root folder there is scripts.ini which tells what script to run when player enters and exits space but I don't know if they work in our case because I don't know how Particle handled moving from base to space and back to base (scriptwise).
On a side note (when I remember it) you have to destroy top groups in group hierarchy manually. Otherwise there will be memory leakage (probably small but still). I don't know if it's necessary if all sims in group are destroyed.
[QUOTE][i]Originally posted by Warlord II [/i]
[B]Removing overlays after gui screen won't work because all screens between gui and mission aren't overlays (overlay is kind of layer above screen). Instead PopScreensTo( string screen class ); works. Replace screen class with class name you want to go to. Only problem is that our main screen class name is the same as briefing screen / skirmish gui which is "CustomGUIScreen".[/B][/QUOTE]
The screen class I used (Mission Collection) is the [i]icPDAOverlayManager[/i] which works for our custom overlays. Example from the SkGen.pkg:
[code]
ScenarioMain()
{
GUI.StopAllMovies();
GUI.PushScreen("icPDAOverlayManager");
Initialize();
}
[...]
GUI.RemoveOverlaysAfter( "icPDAOverlayManager" );
GUI.PopScreen(); //icPDAOverlayManager
GUI.SetRHSShadyBarWidth( 0 );
[/code]
So we can't change the single screen names b/c we have no influence on it. But for example it should be possible to overlay our wished custom screen like this:
[code] GUI.PopScreenTo("icPDAOverlayManager");
iGUI.OverlayCustomScreen( "Buda5_SkGen.StartScreen" );
iGUI.OverlayCustomScreen( "[i]Screen you wanna show[/i]" );
[/code]
But as you wrote that unknown behaviour with the ships by popping the screen the following is worth a try, too:
[code] GUI.PushScreen("icPDAOverlayManager");
[...]
iGUI.OverlayCustomScreen( "[i]Screen you wanna show[/i]" );[/code]
So you won't destroy the misssion screen. And on continuing the mission:
[code] GUI.RemoveOverlaysAfter( "icPDAOverlayManager" );
GUI.PopScreen();
[/code]
[QUOTE][b]On a side note (when I remember it) you have to destroy top groups in group hierarchy manually. Otherwise there will be memory leakage (probably small but still). I don't know if it's necessary if all sims in group are destroyed. [/B][/QUOTE]
All subgroups and IMHO all sims will be destroyed when you destroy the top group.
[B]All subgroups and IMHO all sims will be destroyed when you destroy the top group. [/B][/QUOTE]Actually the function is:
[code]prototype Group.Destroy( hgroup group, bool including_sims );[/code]
So you can choose. But when ending mission it's probably best to destroy sims too. I don't know if it's necessary though.
Also regarding the space cleanup. I used PopScreensTo function with skirmish and then looked into flux.log. Looks like it still cleans up the space. A little piece of log
[code]....mission ends with PopScreens.....
SCRIPT: [unknown] iStartSystem.ShutdownSpace: Shutting down spaceflight...
SCRIPT: [unknown] iStartSystem.strip_player_ship: Reimbursing ship to loadout...
SCRIPT: [unknown] iStartSystem.strip_player_ship: Completed
SCRIPT: [unknown] iStartSystem.unload_localised_text: Removing localised text...
SCRIPT: [unknown] iStartSystem.unload_localised_text: Done...
SCRIPT: [unknown] iStartSystem.ShutdownSpace: Completed
SCRIPT: [unknown] iBackToBase.Terminate: Terminating iBackToBase
SCRIPT: [unknown] iBackToBase.Terminate: ERROR: global g_ibacktobase_level does not exist.
SCRIPT: [unknown] iBackToBase.Terminate: ERROR: global g_have_started_ibacktobase_detector does not exist.
....back to gui.....[/code]
Still I think we should have debriefing after mission so you would replace RemoveLastOverlay with a command that makes a new overlay above briefing screen or you can go to main screen as described above and create debriefing above main screen.
[B]Still I think we should have debriefing after mission[/B][/QUOTE]
In regular missions yes. So for regular mission we could include a function "Debriefing" in the Buda.pkg, so you only need to fill out some variables (text, background image, ..).
For the other mission (wreck etc where the player doesn't dock to the explorer) there needn't to be a debriefing. There could be an epilog or smthg.
Wohoo! It works! The spaceflight screen seems to shut down properly. Thanks guys. :)
Now, the only thing. Current version doesn't support debrief, but it shouldn't cause any problem to make it go straight to briefing screen after it has returned to main menu level.
[QUOTE][i]Originally posted by Indie [/i]
[B]but it shouldn't cause any problem to make it go straight to briefing screen after it has returned to main menu level. [/B][/QUOTE]
iGUI.OverlayCustomScreen("debriefingscreen"); ;)