Hoping to get a little bit of insight here. I had a problem that seemed fairly trivial at first, but I ended up having to do a lot of crazy things to take care of it. My solution works but seems extremely inelegant, so I'm wondering if there was a better way. A word of warning though, what follows is a massive wall of text. I won't be offended if nobody has the patience to read through the whole thing, but I figured I'd give it a try on the off chance that somebody makes it through and has some wisdom to share.
First, the problem. I wanted to add the Ultra-Capacitor and Vanadium Plating upgrades from the campaign into a map. For anybody who hasn't played the campaign, these add an attack speed bonus to weapon upgrades and a maximum life bonus to armor upgrades, respectively.
Unfortunately it turned out that the way the upgrades are implemented, it's a little more complex than just adding a couple research abilities. The way it works is that each normal weapon and armor upgrade has a corresponding "enhanced" version for when you have the appropriate research. The normal upgrades have an additional requirement to make them not show when you have the research for the better versions and likewise the better ones have a requirement to make them only show when you do.
At any rate, here's the problem if it's not immediately obvious: this setup was not designed to allow you to get the Ultra-Capacitor or Vanadium Plating upgrades during the course of a mission, since that would never happen in the campaign. What happens is that when you research either of these upgrades, you simply lose access to the original upgrades and gain access to the new ones, which are completely separate entities. Thus you retain all the normal upgrades that you may have already gotten and now start back at level 1 for the buffed ones.
So here's what I did. I made two triggers, one that runs when you complete the Ultra-Capacitor research, one for Vanadium Plating. Basically for each level of infantry, vehicle and ship weapons and armor I set the level of the enhanced upgrade to be the level of the normal upgrade, then I set the level of the normal upgrade to 0. This works perfectly, though it's basically two triggers with 18 very similar actions that seems like could have been done more efficiently using some sort of loop, maybe using galaxy script?
Anyway, that fixes the existing upgrades but does nothing for upgrades in progress. If the player is researching one of the normal upgrades when they complete the research for Ultra-Capacitors or Vanadium Plating, that upgrade will continue as normal. In addition, they'll have the same level of the enhanced version of the upgrade available to them (so if they're researching Infantry Weapons Level 3 when the Ultra-Capacitors research finishes, they'll still get that upgrade when it completes AND they'll be able to research the Ultra-Capacitors version of level 3 as well). My fix for this was to make 18 more triggers, one that fires upon the completion of each of the 18 normal upgrades that each check to see if the research for the enhanced version has been obtained. If so, the normal version's level is set to 0 and the better version's to 1.
Finally I just added requirements to all of the enhanced versions so that they won't show if the same level of the normal version is queued or better, removing the issue of the better version showing up while the normal is in progress. That part seems like the only thing I might have actually done right.
Whew! Okay, so if anybody is still with me and in the mood to give this some thought, was this just the stupidest way to go about things? Is there some ridiculously simple change I could have made or just a couple lines of script I could have written to avoid having to make all these triggers and requirements?
Since it sounds like you learned quite a bit about the upgrade system why not just create your own Upgrades. It does not sound like your map is going to be using mellee type of play ..... so instead of offering the two lines of upgrades..... just make your own upgrades and do it with out all the triggering.
Rollback Post to RevisionRollBack
Skype
KageNinpo = SN
My Libraries
DialogLeaderboard & TeamSort
My Projects
SPACEWAR Tribute
Infinite TD
I definitely considered that, but my plan for the map is to basically give the player(s) access to strictly melee units and upgrades in the beginning and then offer the opportunity to find/research all of the extra stuff that the campaign had as well during the course of exploring the map. That being the case I decided it would be more appropriate to do it the same way as the campaign and have a pair of research options that make the original upgrades better.
Hah, this is exactly what I want to do. If you've got a good system now, I'd like to see it especially since I'm hopelessly lost with the new editor (I'm just a casual mapmaker). Doing a Terran vs Zerg siege map where the Terrans can get all the campaign upgrades after a certain number of kills.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hoping to get a little bit of insight here. I had a problem that seemed fairly trivial at first, but I ended up having to do a lot of crazy things to take care of it. My solution works but seems extremely inelegant, so I'm wondering if there was a better way. A word of warning though, what follows is a massive wall of text. I won't be offended if nobody has the patience to read through the whole thing, but I figured I'd give it a try on the off chance that somebody makes it through and has some wisdom to share.
First, the problem. I wanted to add the Ultra-Capacitor and Vanadium Plating upgrades from the campaign into a map. For anybody who hasn't played the campaign, these add an attack speed bonus to weapon upgrades and a maximum life bonus to armor upgrades, respectively.
Unfortunately it turned out that the way the upgrades are implemented, it's a little more complex than just adding a couple research abilities. The way it works is that each normal weapon and armor upgrade has a corresponding "enhanced" version for when you have the appropriate research. The normal upgrades have an additional requirement to make them not show when you have the research for the better versions and likewise the better ones have a requirement to make them only show when you do.
At any rate, here's the problem if it's not immediately obvious: this setup was not designed to allow you to get the Ultra-Capacitor or Vanadium Plating upgrades during the course of a mission, since that would never happen in the campaign. What happens is that when you research either of these upgrades, you simply lose access to the original upgrades and gain access to the new ones, which are completely separate entities. Thus you retain all the normal upgrades that you may have already gotten and now start back at level 1 for the buffed ones.
So here's what I did. I made two triggers, one that runs when you complete the Ultra-Capacitor research, one for Vanadium Plating. Basically for each level of infantry, vehicle and ship weapons and armor I set the level of the enhanced upgrade to be the level of the normal upgrade, then I set the level of the normal upgrade to 0. This works perfectly, though it's basically two triggers with 18 very similar actions that seems like could have been done more efficiently using some sort of loop, maybe using galaxy script?
Anyway, that fixes the existing upgrades but does nothing for upgrades in progress. If the player is researching one of the normal upgrades when they complete the research for Ultra-Capacitors or Vanadium Plating, that upgrade will continue as normal. In addition, they'll have the same level of the enhanced version of the upgrade available to them (so if they're researching Infantry Weapons Level 3 when the Ultra-Capacitors research finishes, they'll still get that upgrade when it completes AND they'll be able to research the Ultra-Capacitors version of level 3 as well). My fix for this was to make 18 more triggers, one that fires upon the completion of each of the 18 normal upgrades that each check to see if the research for the enhanced version has been obtained. If so, the normal version's level is set to 0 and the better version's to 1.
Finally I just added requirements to all of the enhanced versions so that they won't show if the same level of the normal version is queued or better, removing the issue of the better version showing up while the normal is in progress. That part seems like the only thing I might have actually done right.
Whew! Okay, so if anybody is still with me and in the mood to give this some thought, was this just the stupidest way to go about things? Is there some ridiculously simple change I could have made or just a couple lines of script I could have written to avoid having to make all these triggers and requirements?
Since it sounds like you learned quite a bit about the upgrade system why not just create your own Upgrades. It does not sound like your map is going to be using mellee type of play ..... so instead of offering the two lines of upgrades..... just make your own upgrades and do it with out all the triggering.
@SouLCarveRR: Go
I definitely considered that, but my plan for the map is to basically give the player(s) access to strictly melee units and upgrades in the beginning and then offer the opportunity to find/research all of the extra stuff that the campaign had as well during the course of exploring the map. That being the case I decided it would be more appropriate to do it the same way as the campaign and have a pair of research options that make the original upgrades better.
Hah, this is exactly what I want to do. If you've got a good system now, I'd like to see it especially since I'm hopelessly lost with the new editor (I'm just a casual mapmaker). Doing a Terran vs Zerg siege map where the Terrans can get all the campaign upgrades after a certain number of kills.