Flashing capped population box

I recently had an idea with this already existing feature, the flashing capped population box:

image

To further utilize it, I thought it would be beneficial to have more things to be “flashy” on the UI. Like for example, every resource stockpile that exceeds 500 (e.g. white colored flash), to remind the user to avoid the stockpiling of resources.

In the resourcepanel.json, line 520 to 545, there is this text:

            {
              "Widget": {
                "Type": "Base",
                "Name": "PopulationFlash",
                "ViewPort": {
                  "xorigin": 900,
                  "yorigin": 60,
                  "width": 140,
                  "height": 72,
                  "alignment": "CentreLeft"
                },
                "ZPlaneLocalOffset": 1,
                "StateMaterials": {
                  "StateNormal": {
                    "Material": "FlatColorWithAlpha",
                    "Color": {
                      "r": 1,
                      "g": 1,
                      "b": 0,
                      "a": 0.7
                    }
                  }
                },
                "ChildWidgets": []
              }
            },
            {

I duplicated this entry to see what will happen, but only I got is an additional identical yellow overlay, non-flashing, always visible.

Does anyone know how to 1) reproduce properly this function, and how to 2) correlate it with different elements of the resource panel (like a resource stockpile), or other panels, or idle buildings to remind you to use them (e.g. a 1920x1080 pixels flash overlay on your whole screen when you forget to produce villagers :laughing:).

These are the red, green, blue, alpha values. If you want white, I assume RGB should be 1,1,1.
If you want it more or less opaque, I assume adjust the Alpha value up or down, accordingly

To move the box, I assume moving the xorigin and yorigin to where on the screen or menu you want the box… though it may be locked to the menu bar. Giving width and height dimensions is self explanatory. Maybe you can make the box huge to fill up the entire viewport for that whole screen effect with something like this?

  • xorigin: 0
  • yorigin: 0
  • width: 1920
  • height: 1080

The current 900 / 60 vals for x/y lead me to believe the above won’t do it, and you’ll have to experiment.

ZPlaneLocalOffset might be to layer the box beneath or on top of other UI elements, but not sure. E.g., “2” would be higher than (on top of) a UI element that has a “1” value. “0” is on top of “-1”, and so on.

I’m guessing you might know all the above, though. Wasn’t sure

I don’t mod AoE (aside from custom random maps long ago), so I’m not the best person to answer anything more than the superficial stuff I already have – which may or may not be accurate. I’m just basing it off of other stuff I’ve seen in life. Good luck! Not the type of mod I’d personally want, but hope you get what you want someday

PS: I think part of the solution would be to figure out if a function or script is being called with “PopulationFlash”. And, if found, create code variations that do what you want for the other things. And have those other things point to your customized versions (e.g., “FoodFlash”) instead of “PopulationFlash”.

In the snippet of code you show, I don’t see anything explicitly saying, “When pop cap is reached, then flash.” Where is THAT code. I think “PopulationFlash” probably points to it.

EDIT: I succeeded in making a white box, 90% opaque, offset a bit, lol. See behind “Dark Age”:

1 Like

I’ve moved it to the food count:

image


image

            {
              "Widget": {
                "Type": "Base",
                "Name": "PopulationFlash",
                "ViewPort": {
                  "xorigin": 270,
                  "yorigin": 57,
                  "width": 100,
                  "height": 72,
                  "alignment": "CentreLeft"
                },
                "ZPlaneLocalOffset": 0,
                "StateMaterials": {
                  "StateNormal": {
                    "Material": "FlatColorWithAlpha",
                    "Color": {
                      "r": 0,
                      "g": 1,
                      "b": 0,
                      "a": 0.6
                    }
                  }
                },
                "ChildWidgets": []
              }
            },		

Where can I find the code that tells the PopulationFlash function to flash when pop cap is reached?

1 Like

I knew only some of them, your contribution is appreciated indeed. I thank you very much.

Exactly, perfectly described. This is what we are missing.

1 Like

I found that that yorigin is actually distance from the top of the screen in this case.

I was able to edit the code and view the results realtime, which was a happy surprise. If you didn’t know this, here is how:

  1. Make a copy of the original .json file, of course, as backup in case you screw the file up.
  2. Open the original .json file in Notepad
  3. Launch the game and start a skirmish map
  4. Press ALT+Tab to open your Notepad doc. Scale and move Notepad so you can see your game’s menu bar in background while being able to edit the .json code
  5. Edit the code. Hit ALT+S to save when done
  6. The game should refresh almost real-time in the background
  7. Make more edits, hit ALT+S to see game refresh with updates

There was one time I crashed the game with my code experiments. I just fixed the code (reverted) and relaunched the game and it was fine. (I think it crashed when I changed Alignment from “CentreLeft” to “Left” (or maybe “Centre”), accidentally. Or perhaps the game just didn’t like me making so many edits, in general, in a short time span)

I tried to cover the whole screen in a semi-transparent color, but it seems constrained to the menu area for the most part.

Am hoping a resident expert or actual dev can chime in and educate us on the next steps. Like, how to see the PopulationFlash script or make our own script to refer to from a new FoodFlash, WoodFlash, StoneFlash, etc. code. Or how to color the whole screen with an overlay color (to eventually flash).

I have programming software, so should be able to see whatever code/file we’re directed to. I opened mannny files, but didn’t see the code we’re looking for yet

1 Like

@Prokman7582, did you ever have any success or luck with this? Or hear any solutions? I’d be interested to know if you figured anything out or if others have ideas

I’d really like to know:

And is that code editable by us

Following, I’d like this mod, or some variation of it. Though I’d be more interested in resources I’m running out of than things I’m stockpiling

1 Like

That’s a good idea, ReanimationXP. I was mainly just curious how to make it work… but that idea would make sense

I honestly don’t pay a ton of attention to resource levels – well, at least not to the point where I need the resource quantities to flash, highlight, or anything. I look at them a lot, but I mainly just build when I can, and when I can’t, I look up and see I’m low in a resource and promptly adjust or wait :slight_smile: In other words, I wouldn’t need an alert

Nop. I left an explanatory question in an advanced developer & modding community of aoe2, but nobody bothered to reply. Maybe it’s not that innovative as idea.

1 Like

That’s too bad. Thanks for trying!

Guess modders want to keep their knowledge a secret, or they just don’t know… or. like you say. just don’t care

If they don’t care about the ideas presented, they may like to know the implementation methods are just curiosities for me, with potential benefits elsewhere. You guys would benefit with more direct gratification, of course. So there is good benefit all around.

Modding is usually a community effort, but it’s not so evident in this thread :smile:

1 Like