How to mark undiscovered resources on the map

PawelS

Ancient Druid
Joined
Dec 11, 2003
Messages
2,811
Location
Poland
I want to display '?' icons on the map in places where there are undiscovered resources (when resource icons are turned on). Is there a way to do it without DLL changes? I checked ResourceIconManager.lua, but, if I interpret it correctly, it relies on events that are fired only when the resource is visible. But perhaps there is another way to do it...
 
Rewrite RIM.lua to not assume the resource is visible when the event is received, but to actually check that the active player can see it, and display the ? if they can't. If the resource is visible you'll need to allow for removing any previous ?

Then, at some appropriate point, scan the entire map and fire the event yourself when the scan comes across a hidden resource

"UI - Small Resource Icons" does something similar for adding Natural Wonders and removing resource icons if the FOW is replaced on a previous revealed tile
 
I get it that I need to scan the entire map when the game is started or loaded (which can be done by putting some code directly into an InGameUIAddin).

But I have problems with the situation when the player explores the map - the newly revealed tiles should be checked if they contain hidden resources, and I can't find any event that fires when a tile is revealed.

Do I have to scan the entire map every turn? I guess this would increase the turn times, and also make the icon appear not immediately when the tile is revealed, but at the start of the next turn.
 
Thanks, I was searching for events with "Plot" in their names, but in this case they decided to call it a "Hex" instead :)
 
OK, I managed to do it and it seems to work properly, thanks to whoward's advice it was quite simple.

I can provide the code if anyone is interested.
 
I created a mod using my code and attached it to this post. It should be compatible with all mods that don't use their own version of ResourceIconManager.lua. It looks like this:
 

Attachments

  • Undiscovered Resources (v 1).civ5mod
    3 KB · Views: 105
  • UR.jpg
    UR.jpg
    103.1 KB · Views: 204
Top Bottom