[Research] Scripted heroes in instant action playlists
Posted: Mon Apr 20, 2020 1:07 pm
I've gotten side tracked from the issue I had in this thread here. I've started to think that instant action playlists aren't designed to handle missions which contain the lua command EnableSPScriptedHeroes(). And potentially there are other bits of lua from campaign scripts which also aren't supposed to be used in instant action. I don't want this topic to take over my first thread (which is supposed to be about getting a user script to work) so now I'm making a new one just to cover how lua affects instant action playlists.
So here's what I'm talking about: When you play a mission in instant action which contains the lua EnableSPScriptedHeroes(), every other mission you play after that, in the same playlist, will also act as if you've enabled scripted heroes. (Or at least, something similar is happening). So for most conquest or capture the flag missions, they'll suddenly lose the prompt for players to play as heroes because those missions aren't supposed to have scripted heroes; they're supposed to unlock heroes with the instant action settings. But this only occurs after you play a mission which uses scripted heroes in the same playlist. I've seen this happening a few times but now I've done an actual test.
Test 1: A stock mission with EnableSPHeroRules() added to ScriptPostLoad()
To test the effects of EnableSPScriptedHeroes(), the first thing I did was make a new mod (called SPE). For the whole test, Zerted's patch and SPE were the only mods on my game. After making SPE, I added a copy of Death Star conquest in GCW era. Then I added the line EnableSPScriptedHeroes() to the ScriptPostLoad() function of this mission's lua. So this is the mission lua I ran:
For the sake of sharing everything, here is also the addme and mission.req which I used to apply this mission. No other changes were made to SPE:
Addme
mission.req
The next thing I did after that was a play test. I put the following playlist into instant action (using the actual game not the debug version):
This lines up with what I was expecting to see (and have experienced in the past) where the heroes stop working after the mission containing EnableSPScriptedHeroes(). It also shows that playlists don't reset when they cycle back around to the beginning again. I've used the same Polis Massa mission twice to show that it can go from working to non-working in a single run. I tried to mix the heroes up so if Luke was broken then Mygeeto would break first (not the Death Star), the two mission's either side of the Death Star both use Leia so she goes from working to non-working in a single run, and Dagobah's at the end because it has a unique hero and I wanted an indication for if they're all broken.
Test 2) The control test
In order to test this properly, I did second test run with no EnableSPScriptedHeroes() added to the Death Star conquest. I commented out the line, but kept the mission in SPE. This is the mission lua used for the control test:
For this test I did the exact same playlist as test 1:
I also stuck to the same settings and rules. This is what happened:
This rules out the possibility that something else in the Death Star mission lua was causing the change.
Test 3) A vanilla campaign mission
Before I did any of these tests, I'd tried playlists with vanilla campaign missions and had the same thing happen (most of which contain EnableSPScriptedHeroes()) so I wanted to test them too. I kept the mod SPE installed, with no changes made since the control test. But I didn't put the Death Star mission into the playlist. This is the playlist I used:
I have an extra note to make about this. I had a 5 minute timer applied to the conquest missions in the instant action settings. None of the conquest missions had that timer after the Utapau mission. The first two games in this test were the ones where the 5 minute timer applied; they didn't get the timer back in the second cycle; it completely disappeared after Utapau. I did not have this problem in test 1, which is making me think there might be other lua commands with negative effects on whole instant action playlists. After the test, I looked at the instant action settings (without closing the game) and it still said that there was a 5 minute timer on conquest. Weird. But the test itself, in the context of what I was testing for, shows hero unlocks breaking after the mission with EnableSPScriptedHeroes() again. It also shows the heroes were still working, because the second cycle of Utapau (which had the scripted hero unlocks set up) functioned just as well as the first. I suppose this problem never comes up in vanilla, since campaign missions are normally hidden from instant action anyway. But it's worth people knowing that using EnableSPScriptedHeroes() in a mission will have a negative affect on the heroes in all of the missions after it. And, if anyone else wants to try it out, hopefully this is repeatable.
So here's what I'm talking about: When you play a mission in instant action which contains the lua EnableSPScriptedHeroes(), every other mission you play after that, in the same playlist, will also act as if you've enabled scripted heroes. (Or at least, something similar is happening). So for most conquest or capture the flag missions, they'll suddenly lose the prompt for players to play as heroes because those missions aren't supposed to have scripted heroes; they're supposed to unlock heroes with the instant action settings. But this only occurs after you play a mission which uses scripted heroes in the same playlist. I've seen this happening a few times but now I've done an actual test.
Test 1: A stock mission with EnableSPHeroRules() added to ScriptPostLoad()
To test the effects of EnableSPScriptedHeroes(), the first thing I did was make a new mod (called SPE). For the whole test, Zerted's patch and SPE were the only mods on my game. After making SPE, I added a copy of Death Star conquest in GCW era. Then I added the line EnableSPScriptedHeroes() to the ScriptPostLoad() function of this mission's lua. So this is the mission lua I ran:
Hidden/Spoiler:
Addme
Hidden/Spoiler:
Hidden/Spoiler:
- Mygeeto GCW Conquest
- Polis Massa GCW Conquest
- Death Star GCW Conquest (modified, with EnableSPScriptedHeroes() added)
- Tantive IV GCW Conquest
- Polis Massa GCW Conquest
- Dagobah GCW Conquest
Hidden/Spoiler:
Test 2) The control test
In order to test this properly, I did second test run with no EnableSPScriptedHeroes() added to the Death Star conquest. I commented out the line, but kept the mission in SPE. This is the mission lua used for the control test:
Hidden/Spoiler:
Hidden/Spoiler:
Hidden/Spoiler:
Test 3) A vanilla campaign mission
Before I did any of these tests, I'd tried playlists with vanilla campaign missions and had the same thing happen (most of which contain EnableSPScriptedHeroes()) so I wanted to test them too. I kept the mod SPE installed, with no changes made since the control test. But I didn't put the Death Star mission into the playlist. This is the playlist I used:
- Mygeeto GCW Conquest
- Polis Massa GCW Conquest
- Utapau CW Campaign
- Tantive IV GCW Conquest
- Polis Massa GCW Conquest
- Dagobah GCW Conquest
Hidden/Spoiler: