JCarter426 1,215 Posted June 2, 2017 Oh, I thought he wanted it to load based on wherever the player last left off. So if you if you're on Onderon it shows Onderon, for either trip. I guess you could use the current planet integer instead, though. If the script to store the global data checks for that first, then it doesn't really matter. Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted June 2, 2017 I was aiming at the planet you are currently on. You are on Dantooine, show the Dantooine menu. You are on Nar Shaddaa, show the Nar Shaddaa menu, etc. Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted June 2, 2017 Darth Parametric: In that case, it would probably be best to indeed do the injection into the Galaxy Map script, though this could run into issues with other mods that use that script, like M4-78 and Coruscant; shouldn't take much for compatibility, though. What you'd want to do is open k_sup_galaxymap.nss and go to the void main() function. From here, you go down a ways until you see this: // Do other stuff like play movies, do stuff to Ebon Hawk // we need two movies - the planet that we are leaving, and then the dest planet // after we get those two string, we can then play the two movies in sequence // we are setting two variables on the ebon hawk. One is for the background, and the // other is for the exit module. switch(nPlanet) { This is the beginning of a switch-case statement for all of the planets. Here is where you'd probably want to change the global to handle the menus, as this is done when you travel to a new planet. The only exceptions to this I can think of would probably be the multiple skips between Duxn and Onderon, and the transition between end-game Dantooine and Telos. In the first case, I believe you were doing a menu that encompassed or stood in for both Duxn and Onderon; in the second, you could probably find a script to piggyback or a dialog (like the Kreia-Atris cutscene) to add a quick script to. Quote Share this post Link to post Share on other sites
JCarter426 1,215 Posted June 2, 2017 That's why my first thought was OnEnter... while the galaxy map does account for most travel, it doesn't account for all of it. And, for example, if you wanted to have a menu for the Ebon Hawk (perhaps as the standard, "anything else" option) then it would never tell you that. The code to attach to OnEnter would be something like: int nCurrentModule = StringToInt(GetStringLeft(GetModuleName(), 3)); if( nCurrentModule < 100 || nCurrentModule == 950 ) SetGlobalNumber("K_CURRENT_PLANET", 0); else if( nCurrentModule >= 100 && nCurrentModule < 200) SetGlobalNumber("K_CURRENT_PLANET", 1); ...etc You should be able to write one generic thing and then throw it into each OnEnter. Quote Share this post Link to post Share on other sites
zbyl2 811 Posted June 2, 2017 I feel like you're overthinking it especially when it comes to checking module code. You can do one number check like JC suggested first and go with a single switch statement,. void setMainMenu() { int nCurrentModule = StringToInt(GetStringLeft(GetModuleName(), 3)); switch(nCurrentModule) { case 0: // Ebon Hawk SetGlobalNumber("GBL_MAIN_SITH_LORD", 1); break; case 1: // Peragus SetGlobalNumber("GBL_MAIN_SITH_LORD", 1); break; case 2: // Telos SetGlobalNumber("GBL_MAIN_SITH_LORD", 1); break; case 3: // Nar Shaddaa SetGlobalNumber("GBL_MAIN_SITH_LORD", 2); break; case 4: // Dxun SetGlobalNumber("GBL_MAIN_SITH_LORD", 3); break; /* and so on */ default: break; } } Only problem I see with that is that you get a different background for the Ebon Hawk, and we probably don't want that. Keep in mind though that there's already a 003EBO_BACKGROUND variable controlling the background outside of the Ebon Hawk, so maybe use that for planet reference instead - no idea if it ever sets properly for Telos 2 or Malachor, but we can force it to in proper modules. So it's the same script but int nCurrentModule = GetGlobalNumber("003EBO_BACKGROUND"); DP mentiond k_align_movie, which would be potentially a good script to use for this purpose, instead of modifying bunch of OnEnters, or even worse, adding OnExit scripts (sorry FS, but it's a bad idea if you think about compatibility issues - best to avoid this kind of module editing). I don't really know when k_align_movie fires, or whether it fires at all in the end game, so that's the only potential problem I see. Or just link it to the galaxy map script. Quote Share this post Link to post Share on other sites
JCarter426 1,215 Posted June 2, 2017 If I recall correctly, k_align_movie only fires once, after the player has shifted towards the light side or dark side 25 points, or if they're neutral but have gotten a total of 50 alignment points, or once they've found three masters. So I don't think it would work here. The only reason the menu crops up in that script is this just happens to be when the menu is shifted to Darth Nihilus. Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted June 2, 2017 So you'd still have to edit k_align_movie anyway, right? If for no other reason than to excise the menu swapping bit. Although I suppose it would be overridden soon enough if you have some other script constantly checking the module you're in. Quote Share this post Link to post Share on other sites
zbyl2 811 Posted June 2, 2017 If I recall correctly, k_align_movie only fires once, after the player has shifted towards the light side or dark side 25 points, or if they're neutral but have gotten a total of 50 alignment points, or once they've found three masters. So I don't think it would work here. There's a if(movie_already_played) check, so it probably still tries to fire after that. It also has checks for player alignment and number of Jedi found, so it probably fires despite you having enough points, and then it checks whether to play a movie or not. It's possible it fires each time you get LS/DS points or something. Not a clue TBH. Quote Share this post Link to post Share on other sites
JCarter426 1,215 Posted June 2, 2017 So you'd still have to edit k_align_movie anyway, right? If for no other reason than to excise the menu swapping bit. Although I suppose it would be overridden soon enough if you have some other script constantly checking the module you're in. Yes, that's true. As well as whichever one triggers Kreia. For fun I typed up a full table based on my old planet script. This one accounts for a bit more, too: /* CURRENT PLANET GLOBALS 000 - Ebon Hawk 100 - Peragus 150 - Harbinger 200 - Citadel Station 220 - Citadel Station (Battle of Telos) 230 - Telos Restoration Zone 260 - Telos Polar Plateau 290 - HK Factory 300 - Nar Shaddaa 400 - Dxun 500 - Onderon 600 - Dantooine 700 - Korriban 800 - M4-78 850 - Ravager 900 - Ebon Hawk 1000 - None of the Above */ //Ebon Hawk if( GetStringLeft(GetModuleName(), 1) == "0" || GetModuleName() == "950COR" ){ SetGlobalNumber("K_CURRENT_PLANET", 0); } //Peragus if( GetStringLeft(GetModuleName(), 1) == "1" ){ SetGlobalNumber("K_CURRENT_PLANET", 100); } //Citadel Station if( GetStringLeft(GetModuleName(), 1) == "2" && !(GetStringLeft(GetModuleName(), 2) == "22") && !(GetStringLeft(GetModuleName(), 2) == "23") && !(GetStringLeft(GetModuleName(), 2) == "26") && !(GetStringLeft(GetModuleName(), 2) == "29") ){ SetGlobalNumber("K_CURRENT_PLANET", 200); } //Citadel Station (Battle of Telos) if( GetStringLeft(GetModuleName(), 2) == "22" ){ SetGlobalNumber("K_CURRENT_PLANET", 220); } //Telos Restoration Zone if( GetStringLeft(GetModuleName(), 2) == "23" ){ SetGlobalNumber("K_CURRENT_PLANET", 230); } //Telos Polar Plateau if( GetStringLeft(GetModuleName(), 2) == "26" ){ SetGlobalNumber("K_CURRENT_PLANET", 260); } //HK Factory if( GetStringLeft(GetModuleName(), 2) == "29" ){ SetGlobalNumber("K_CURRENT_PLANET", 290); } //Nar Shaddaa if( GetStringLeft(GetModuleName(), 1) == "3" ){ SetGlobalNumber("K_CURRENT_PLANET", 300); } //Dxun if( GetStringLeft(GetModuleName(), 1) == "4" ){ SetGlobalNumber("K_CURRENT_PLANET", 400); } //Onderon if( GetStringLeft(GetModuleName(), 1) == "5" ){ SetGlobalNumber("K_CURRENT_PLANET", 500); } //Dantooine if( GetStringLeft(GetModuleName(), 1) == "6" ){ SetGlobalNumber("K_CURRENT_PLANET", 600); } //Korriban if( GetStringLeft(GetModuleName(), 1) == "7" ){ SetGlobalNumber("K_CURRENT_PLANET", 700); } //M4-78 if( GetStringLeft(GetModuleName(), 1) == "8" && !(GetStringLeft(GetModuleName(), 2) == "85") ){ SetGlobalNumber("K_CURRENT_PLANET", 800); } //Ravager if( GetStringLeft(GetModuleName(), 2) == "85" ){ SetGlobalNumber("K_CURRENT_PLANET", 850); } //Malachor if( GetStringLeft(GetModuleName(), 1) == "9" && !(GetModuleName() == "950COR") ){ SetGlobalNumber("K_CURRENT_PLANET", 900); } else SetGlobalNumber("K_CURRENT_PLANET", 1000); That should cover every conceivable area you'd want to distinguish... unless you really want Goto's yacht or something too. But anyway, if you throw that into the OnEnter script, then in your menu script you can just check the planet global and do another if tree to narrow it down to the 5 options. The reason I'd suggest splitting it in two scripts is a ) you're editing at least two scripts anyway, but more importantly b ) once you have one script setting the planet, you can then edit the menu script to put in alternative options, since we're limited to 5 total. There's a if(movie_already_played) check, so it probably still tries to fire after that. It also has checks for player alignment and number of Jedi found, so it probably fires despite you having enough points, and then it checks whether to play a movie or not. It's possible it fires each time you get LS/DS points or something. Not a clue TBH. Yeah, that would be my guess as well. And I guess if it is always firing when you get alignment points, then it could be of some use... but there's no guarantee. It's firing a lot, but not necessarily every time you go to a new location, if you don't encounter any choices. And I know for a fact there are no alignment shifts at all once the masters are found. Quote Share this post Link to post Share on other sites
zbyl2 811 Posted June 2, 2017 Yeah, that's true. I'd use the galaxy map script instead, the one that sets the view outside the Ebon Hawk, and set proper main menu variable from there - and maybe use something else for Telos and Malachor, since they don't use galaxy map. Peragus would be default when you start the game. Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted June 3, 2017 But anyway, if you throw that into the OnEnter script So every OnEnter script? That's like 80-odd scripts. Doesn't seem particularly practical, especially if you take into account having to double the work in order to make TSLRCM and non-TSLRCM versions. I'd use the galaxy map script instead That's k_sup_galaxymap I believe? Btw, I noticed this in k_inc_hawk, the include for k_sup_galaxymap // GetCurrentPlanet // returns a planet constant based on background // will return -1 if not on a planet int GetCurrentPlanet() { int nRoomAnimation = GetGlobalNumber("003EBO_BACKGROUND"); switch(nRoomAnimation) { case 0://106PER { //return PLANET_PERAGUS; return PLANET_EBON_HAWK; }break; case 1://201TEL { return 10; // citadel station }break; case 2://262TEL { return PLANET_TELOS; }break; case 3://301NAR { return PLANET_NAR_SHADDAA; }break; case 4://401DXN { return PLANET_DXUN; }break; case 5://601DAN { return PLANET_DANTOOINE; }break; case 6://701KOR { return PLANET_KORRIBAN; }break; case 7://801DRO { return PLANET_M4_78; }break; case 8://space { return PLANET_EBON_HAWK; }break; case 9://901MAL { return PLANET_MALACHOR_V; }break; case 10://Hyperspace { return PLANET_EBON_HAWK; }break; default://error { return PLANET_EBON_HAWK; } } return PLANET_EBON_HAWK; } I figured it might be possible to slip in the menu swapping code into the main body of k_sup_galaxymap just after this: void main() { int nSelected = GetSelectedPlanet(); int nPrevPlanet = GetCurrentPlanet(); And take advantage of it already finding the planet you are on, which is what Fair Strides suggested earlier (which I kind of missed at the time). Quote Share this post Link to post Share on other sites
Kexikus 995 Posted June 3, 2017 That's the script part that sets the Ebon Hawk cockpit skybox zbyl was talking about. I agree that this would probably be a good solution but you'll have to edit some other scripts depending on the location you want if those are not visited with the Ebon Hawk (i.e. Polar Plateau, Ravager, Telos Endgame?, Malachor). Slightly off topic from your current discussion: With these new model editing capabilities, would it now be possible for this mod to also change the Sion main menu model? Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted June 3, 2017 That's the script part that sets the Ebon Hawk cockpit skybox zbyl was talking about. I agree that this would probably be a good solution but you'll have to edit some other scripts depending on the location you want if those are not visited with the Ebon Hawk (i.e. Polar Plateau, Ravager, Telos Endgame?, Malachor). Menu #1 will have to be a catch-all for Peragus, Telos, the Ebon Hawk, Malachor, etc. Maybe some of those edge cases will need OnEnter modifications, I'm not sure. I'll probably need someone else to do the heavy lifting on the scripting side of things. I am way out of my depth with this stuff. Slightly off topic from your current discussion: With these new model editing capabilities, would it now be possible for this mod to also change the Sion main menu model? Yeah if you just wanted a replacement for the vanilla Sion menu it would be easy enough. You just have to edit mainmenu01 - delete the old Sion meshes, import the new Sion model and skin it to the rig, export. Seems like there are no permissions issues to worry about, just credit required for Deadman and Sapiens. Quote Share this post Link to post Share on other sites
JCarter426 1,215 Posted June 3, 2017 So every OnEnter script? That's like 80-odd scripts. Doesn't seem particularly practical, especially if you take into account having to double the work in order to make TSLRCM and non-TSLRCM versions. No, not every one. Just all the landing areas. 101, 201, 301, etc. Plus some stuff to account for anything unusual, like all the warping around in the endgame. You could use the galaxy map for the bulk of it, and then edit OnEnters as needed. Although, honestly if I were doing it I'd edit every OnEnter - if only to have each and every module executing one universal script. I'm a little surprised they don't already do that, because of how useful it would be to have that ability. Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted June 3, 2017 Although, honestly if I were doing it I'd edit every OnEnter - if only to have each and every module executing one universal script. I'm a little surprised they don't already do that, because of how useful it would be to have that ability. So in essence what you are suggesting is to first make some sort of generic/universal hook, allowing 3rd party scripts to access that functionality without needing to directly edit the OnEnter scripts themselves? Is it possible to make something flexible enough that it would have much application outside of the menu idea? would it now be possible Yes, like so: Although I will say there are quite a few problems with that model in terms of skin weights. I had to skin wrap the vanilla mesh to generate new weights for the torso and arms because the original couldn't handle the level of deformation in the arms crossed animation. Given the way it is set up, I wonder if it wouldn't just be better to make a hybrid version that reverts to the original arms and torso and just adds on Deadman's skirt and pauldron. Also, something I never noticed before - Sion is floating about a foot off the ground in that menu. You just can't see it because of the fog. Maybe he looked too short otherwise. 1 Quote Share this post Link to post Share on other sites
JCarter426 1,215 Posted June 3, 2017 So in essence what you are suggesting is to first make some sort of generic/universal hook, allowing 3rd party scripts to access that functionality without needing to directly edit the OnEnter scripts themselves? Is it possible to make something flexible enough that it would have much application outside of the menu idea? Pretty much, yeah. As it is now, each module has its own OnEnter script doing whatever that particular module needs. My proposal would be to replace every single one of those with one universal script. The universal OnEnter script would have a bunch of code, like setting the current planet, whatever you want, and then a huge if tree. If 001EBO, execute a_bet3m4. If 512OND, execute k_512_enter. All the original OnEnter scripts. Any mods that edit the original scripts (including TSLRCM) would be unaffected. Any future mods would only have the issue of editing the one universal script. The biggest compatibility hurtle here is that every module's ARE file would have to be edited. But if everybody could get on board with that, then it would be a lot more convenient than it is now. Quote Share this post Link to post Share on other sites