[QUESTION] Custom Icon Menu to customize icons

Discussion in 'Mod Discussions' started by killerkiwijuice, December 27, 2014.

  1. killerkiwijuice

    killerkiwijuice Post Master General

    Messages:
    3,879
    Likes Received:
    3,597
    With the trollous nature of my Strategic Troll Icon mod , I want to take it a step further and make a settings addon to change commander icons from a troll face to something else in the files, like a [​IMG] . So, first question:

    Is this possible?

    If yes, I have no idea how to do it, and I don't think anyone else has made something like this, so I can't use existing UI mod structure to make mine. So, if possible:

    Where would I start?
    How would I make the settings addon select different icons?

    Thanks for reading, I hope something like this isn't too complicated where it includes lots of JS functions.
  2. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    I won't say it's impossible, but you may be choosing a hard road.

    Icons are usually selected by name matching. Units (ex: all the different commanders use one icon) can override the name used. Icons are a bit trickier. I think it's done by index matching between the elements created in the atlas html and the names in the list sent to engine call handle_icon_list.

    I currently know of no way to runtime modify the unit specs outside of GW. It might be possible with a GW/regular server-script mashup.

    As of many months ago, the icons in icon_atlas were dynamically used by the game - make one a canvas or js-modify an image source and it would be picked up by the running game.

    There is just one huge monstrous problem though: atlases aren't traditional child scenes. They don't have ids or names for messaging or to pass to reload. Some day I'll get around to testing localStorage polling as a communication mechanism, and for your purposes polling settings directly might work.

    So... having essayed the space, my recommendation would be to do a slow poll on your mod's settings, find the index of the icon you want to modify, and try changing the src attribute.
    killerkiwijuice likes this.
  3. killerkiwijuice

    killerkiwijuice Post Master General

    Messages:
    3,879
    Likes Received:
    3,597
    Even though I understood 20% of that post, I'll try and work with the src attributes. :)

Share This Page