howlingflute Posted April 28, 2012 Report Share Posted April 28, 2012 So I created a patch that puts a red overlay over icons if there are not enough resources to build that building or unit. Additionally it puts in the unit tooltip how much more resources are required to build that building. Buildings that are already greyed out because of technologies remain so but with how many more resources are required to build them added to the tooltip. I would have added this to Trac, but I am not to be able to log into Trac for some reason.resourceCheck.diff.zip Quote Link to comment Share on other sites More sharing options...
MishFTW Posted April 28, 2012 Report Share Posted April 28, 2012 If you created a Trac account, then you should. Nice patch BTW, this would be better than the little message that shows up. Quote Link to comment Share on other sites More sharing options...
wraitii Posted April 29, 2012 Report Share Posted April 29, 2012 (edited) Good idea.Not sure if that's actually feasible, but I think using the resource icon and not the name would improve readability. Ever so slightly, but still.Also: it might make it look a lot like a Christmas tree, which would be bad, but have you tried coloring more and more red as the resource lacking are important (with alpha)? So that at a glance, we'd now how much we need more. If it works from an aesthetic point of view, it could be useful. I think the effect can be quite potent even with small differences in the alpha, so that it looks good, and useful.Edit: I also recommend changing your code in Unit_command.js to this:if(guiName == CONSTRUCTION || guiName == TRAINING){ selection.hidden = true; var totalCosts = {}; var multiplier = 1; if (guiName == TRAINING && Engine.HotkeyIsPressed("session.batchtrain")) multiplier = 5; for each (var r in ["food", "wood", "stone", "metal"]) totalCosts[r] = Math.floor(template.cost[r]*multiplier); var neededC = Engine.GuiInterfaceCall("FindCostNeeded", totalCosts); if(neededC.length){ //only put on the red overlay if the button is not already grayed out if(button.enabled != false){ button.enabled = false; selection.hidden = false; } button.tooltip += "\n[font=\"serif-bold-13\"]Insufficient resources:[/font]\n"+neededC.join(", "); } }It will show red properly if the user clicks on "shift", which is much more intuitive. It doesn't take into account the batch size, though, I'm not too sure how to get that. Edited April 29, 2012 by wraitii Quote Link to comment Share on other sites More sharing options...
FeXoR Posted April 29, 2012 Report Share Posted April 29, 2012 (edited)  This sounds very nice! A helpful feature. The 'amount' of minimum red could be tweaked so you can see it clearly. But what about the maximum? Should it depend on the resources the unit/building needs to be build or a fixed amount (lets say 1000)? Edited April 29, 2012 by FeXoR Quote Link to comment Share on other sites More sharing options...
wraitii Posted April 29, 2012 Report Share Posted April 29, 2012 I tried it quickly (in an inelegant way, and I want to leave the implementation to howlingflute anyway) and I guess something that ranges from alpha 75 to alpha 175 for a lack of resource from 0 to 500 would work well. Quote Link to comment Share on other sites More sharing options...
feneur Posted April 29, 2012 Report Share Posted April 29, 2012 but I am not to be able to log into Trac for some reason.Take a look at your private messages here in the forums if you haven't already... Quote Link to comment Share on other sites More sharing options...
fabio Posted April 29, 2012 Report Share Posted April 29, 2012 Nice .Maybe you can also enfatize the missing resources using a red color for them in the tooltip. Quote Link to comment Share on other sites More sharing options...
historic_bruno Posted April 29, 2012 Report Share Posted April 29, 2012 Maybe you can also enfatize the missing resources using a red color for them in the tooltip.Agreed. Quote Link to comment Share on other sites More sharing options...
Mythos_Ruler Posted April 29, 2012 Report Share Posted April 29, 2012 Another enhancement is to have the resource up in the ribbon flash when you hover over the icon of the building or unit to be built. Quote Link to comment Share on other sites More sharing options...
wraitii Posted May 8, 2012 Report Share Posted May 8, 2012 Any update? Quote Link to comment Share on other sites More sharing options...
majapahit Posted May 8, 2012 Report Share Posted May 8, 2012 Thats practical & helpful Quote Link to comment Share on other sites More sharing options...
wraitii Posted August 1, 2012 Report Share Posted August 1, 2012 Since we haven't heard from the original poster in a few weeks (on this post anyway) and I really liked that patch, I've taken the liberty to update it.Some small differences:For units, when you push "shift" it will display accordingly if you an create a batch of 5. The "rediness" of icons will increase slightly as the resources needed increase (I'm not sure if it's useful).It works for technologies too, but I wasn't too sure how to handle paired resources (since they already have a red overlay). They gain an additional faintly red overlay and the tooltip indication.redIcons.patch Quote Link to comment Share on other sites More sharing options...
k776 Posted August 2, 2012 Report Share Posted August 2, 2012 Please put this in a Trac ticket if it isn't already. Don't leave patches on the forum. They will disappear and die... 2 Quote Link to comment Share on other sites More sharing options...
wraitii Posted August 2, 2012 Report Share Posted August 2, 2012 Allright Quote Link to comment Share on other sites More sharing options...
howlingflute Posted August 3, 2012 Author Report Share Posted August 3, 2012 Awesome job Wraitii. I am glad someone was interested in updating this patch to be more usefull. Looks like you made some nice improvements. Hopefully this patch will help some with the user interface making it easier to identify at a glance what can be built and what cannot be built. Quote Link to comment Share on other sites More sharing options...
zoot Posted August 26, 2012 Report Share Posted August 26, 2012 I think there is a small bug/lack in this feature: if several buildings of the same type (e.g. fortress) is selected, the icon will not show as red if there aren't enough resources to build the given unit from all the selected buildings, even though that is what will happen if clicking the icon.Also, it would IMO be nice if in addition to turning the icon red, it actually disabled the button - it's annoying to Shift-click the icon 10 times, see it turn red, accidentally click it another time, and then get the "not enough resources" message and having to start all over. Quote Link to comment Share on other sites More sharing options...
Deiz Posted August 26, 2012 Report Share Posted August 26, 2012 I think the training behaviour is desirable, as it mirrors the command implementation. The training command is sent to each entity individually, so if you have 3 fortresses selected and are trying to train a batch that requires 500 metal while you have 1400 metal in total, one of the fortresses will fail to queue the batch, but the other two will succeed.Buttons are supposed to be disabled when the red overlay is present. Can you tell me how to reproduce that issue? I can presently manage to do it because the overlay display is calculated at render-time, so if I click more than once per rendered frame, I can end up attempting to queue more than I have resources for.I was thinking that right click should probably decrement the batch size by five, much as left click increments it by five. That'd at least allow you to correct mistakes (whether your batch is about to fail or you just didn't want that many units). Quote Link to comment Share on other sites More sharing options...
zoot Posted August 26, 2012 Report Share Posted August 26, 2012 Buttons are supposed to be disabled when the red overlay is present. Can you tell me how to reproduce that issue? I can presently manage to do it because the overlay display is calculated at render-time, so if I click more than once per rendered frame, I can end up attempting to queue more than I have resources for.Indeed, that was what I meant. Perhaps a check could be made when the button is clicked ("sufficient resources? if not, ignore click")? Quote Link to comment Share on other sites More sharing options...
fabio Posted September 2, 2012 Report Share Posted September 2, 2012 The phase button is grey rather than red when resources are missing. Is this intended? Quote Link to comment Share on other sites More sharing options...
Shield Bearer Posted September 2, 2012 Report Share Posted September 2, 2012 Its greyed out when you haven't built the required buildings, after you have and still don't have enough resources its red Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.