Feature request: upgrade detection

Started by planetfall, March 22, 2014, 11:21:31 PM

Previous topic - Next topic

planetfall

I have a lot of custom friendly units in my maps, and would find it useful if I could make forge upgrades to apply to them.
What's more, upgrades are probably a better indicator of overall progress than, say, unit count, for adapting enemies.
Unfortunately, a crpl command to see what upgrades the player has seems to be lacking.

It would take a string as input and output the number of levels of that upgrade purchased by the player.
Example: "ENERGYEFFICIENCY" GetUpgradeLevel
Pretty sure I'm supposed to be banned, someone might want to get on that.

Quote from: GoodMorning on December 01, 2016, 05:58:30 PM"Build a ladder to the moon" is simple as a sentence, but actually doing it is not.

Flabort

I would like to second this, and also the obvious companions, SetUpgradeLevel, UpgradesRequireForge (default true), and SetUpgradeLimit.

Even better, if using SetUpgradeLimit allowed for higher max values then the current hardcoded max. Such as going to level 40 in ore efficiency.

Such as the following control code, with external codes that increment CurrentLevel through SetScriptVar.
once
  false UpgradesRequireForge
  "OREEFFICIENCY" 40 SetUpgradeLimit
  "FORGE" 0 SetBuildLimit
  0 ->CurrentLevel
endonce

"OREEFFICIENCY" GetUpgradeLevel <-CurrentLevel lt if
  "OREEFFICIENCY" <-CurrentLevel SetUpgradeLevel
endif
My maps: Top scores: Sugarplum, Cryz Dal, Cryz Torri, Cryz Bohz (Click fetch scores, page courtesy of kwinse)

planetfall

Quote from: Flabort on March 22, 2014, 11:39:08 PM
I would like to second this, and also the obvious companions, SetUpgradeLevel, UpgradesRequireForge (default true), and SetUpgradeLimit.

Actually, there's GetTechLimit and SetTechLimit (separate from Get/SetBuildLimit) already. They're used in the Egos system so that no matter what order you visit planets in, the first will have the fewest upgrades available and the last will have the most. It always struck me as a little odd that you could mess with the limits, but not even look at the actual upgrade state.

Quote from: Flabort on March 22, 2014, 11:39:08 PM
Even better, if using SetUpgradeLimit allowed for higher max values then the current hardcoded max. Such as going to level 40 in ore efficiency.

Such as the following control code, with external codes that increment CurrentLevel through SetScriptVar.
once
  false UpgradesRequireForge
  "OREEFFICIENCY" 40 SetUpgradeLimit
  "FORGE" 0 SetBuildLimit
  0 ->CurrentLevel
endonce

"OREEFFICIENCY" GetUpgradeLevel <-CurrentLevel lt if
  "OREEFFICIENCY" <-CurrentLevel SetUpgradeLevel
endif


Pretty sure upgrades are stored in the forge's unit data. That's why you lose upgrades if the forge is destroyed and why they are disabled if the forge is turned off. So upgrades without the forge is probably a thing to come much later (if ever)

But my 2 cents on how that would work:
It would be stored on a per-upgrade basis. So you could say
"OREEFFICIENCY" false UpgradeWithForge
This would make it impossible to upgrade ore efficiency at the forge, as though the tech limit were 0, but allow it to be set to other values behind the scenes. The "behind the scenes" value would be used by ore mines and/or crpl cores regardless of whether the forge is present, powered, etc. and will not go away if the forge is lost.
Meanwhile it would allow other things to be upgraded at the forge like normal.
Pretty sure I'm supposed to be banned, someone might want to get on that.

Quote from: GoodMorning on December 01, 2016, 05:58:30 PM"Build a ladder to the moon" is simple as a sentence, but actually doing it is not.

Flabort

*facepalm about Tech/Upgrade Limit part* I even went to the reference to get the right notation for buildLimit, and accidentally clicked Tech instead.  ::)

And that is far more eloquently put and organized then I could have ever made that. Thank you, that was exactly what I was thinking.
My maps: Top scores: Sugarplum, Cryz Dal, Cryz Torri, Cryz Bohz (Click fetch scores, page courtesy of kwinse)

Vanguard

#4
While certainly nifty, simply caclulcating the tech gained from totems by time does the same trick. So if you want to strengthen enemies when a player has 200 technites/ether, you could simply say that it takes a totem 5 seconds for one ether, so with 3 totems on the map its ((200*5)/3)*30 Frames before taking your enemies to the next level. Works for me so far. :)

Edit: Rereading it, it is quite a nice idea to apply The players tech to your units. I am not far enough into the CRPL to mess with that for now, so I will keep looking into that later.

Grayzzur

Quote from: Vanguard on April 15, 2014, 10:04:12 AM
While certainly nifty, simply caclulcating the tech gained from totems by time does the same trick. So if you want to strengthen enemies when a player has 200 technites/ether, you could simply say that it takes a totem 5 seconds for one ether, so with 3 totems on the map its ((200*5)/3)*30 Frames before taking your enemies to the next level. Works for me so far. :)

Edit: Rereading it, it is quite a nice idea to apply The players tech to your units. I am not far enough into the CRPL to mess with that for now, so I will keep looking into that later.

Are you taking into account that someone can turn off the totems to conserve energy, and won't be gaining ether during that time?
"Fate. It protects fools, little children, and ships named 'Enterprise.'" -William T. Riker

Vanguard

Quote from: Grayzzur on April 15, 2014, 06:29:06 PM
Are you taking into account that someone can turn off the totems to conserve energy, and won't be gaining ether during that time?

Depends on the layout of the map. I agree the scripted way of getting the Techs upgrades "scales" a bit better. But the simple timing method has the advantage of a more streamlined difficulty, making scores on the map better to evaluate. How do you, for example, take into account people who accumulate 30000 Aether without upgrading?

Grayzzur

Quote from: Vanguard on April 16, 2014, 09:05:48 AM
Quote from: Grayzzur on April 15, 2014, 06:29:06 PM
Are you taking into account that someone can turn off the totems to conserve energy, and won't be gaining ether during that time?

Depends on the layout of the map. I agree the scripted way of getting the Techs upgrades "scales" a bit better. But the simple timing method has the advantage of a more streamlined difficulty, making scores on the map better to evaluate. How do you, for example, take into account people who accumulate 30000 Aether without upgrading?
People who gather 30,000 aether without bothering to upgrade aren't going to be competing for top scores. I wouldn't bother to account for them.
"Fate. It protects fools, little children, and ships named 'Enterprise.'" -William T. Riker

Annonymus

What if someone uses most of the aether he/she gathers for the singularity weapon?
If a topic started by me is in the wrong place feel free to move it at anytime.

Vanguard

Quote from: Grayzzur on April 16, 2014, 03:09:08 PM
People who gather 30,000 aether without bothering to upgrade aren't going to be competing for top scores. I wouldn't bother to account for them.

The ironic thing is that writing a script is MORE bother than just counting the seconds. Haha, never argue with me. I drag you down to my level and beat you with experience.  ::)

Nah, just kidding. I agree. The more you can script, the better ( usually ) it gets. I will probably still conitnue to use the linear time method, simply because I like to time my map(s soon) meticulously.