Variable for which commander the player selected?

Discussion in 'Mod Support' started by gardian20, January 25, 2015.

  1. gardian20

    gardian20 New Member

    Messages:
    29
    Likes Received:
    9
    This may have already been answered, but I'm wondering if there is a variable that a factory could look up to see which commander the player selected. I want to use this for a decoy commander mod (TA, anyone?).

    Thanks in advance.
  2. wondible

    wondible Post Master General

    Messages:
    3,279
    Likes Received:
    2,084
    short answer: no.

    Only in a very limited and roundabout way - different commanders could build different everything so that that one unit would know what to build. This is awkward and limited to 16 settings (commanders) as far as we know.
  3. gardian20

    gardian20 New Member

    Messages:
    29
    Likes Received:
    9
    So there isn't even a "unit_exists" function or something? That sucks. Perhaps offer all the commanders and let the player select the one they have. Seems clunky, but it would be better than nothing...
  4. wondible

    wondible Post Master General

    Messages:
    3,279
    Likes Received:
    2,084
    You could do more with scripting. Maybe set up the factory it so can build all commanders and then use script to set the right one into the build bar. You would need to decide what to do with multiple commander team games though.
  5. gardian20

    gardian20 New Member

    Messages:
    29
    Likes Received:
    9
    That's a great idea! Any tutorials for scripting like that around here?
  6. wondible

    wondible Post Master General

    Messages:
    3,279
    Likes Received:
    2,084
    Hmm... we really ought to make one on pawiki.

    And thinking about it, this is a little tricky because you're straddling the client/server boundery. You have to change the factory properties (look at the unit/balance mods for examples), and you have to run code on every player's client to change build settings. This will mean shadowing (same ideas as the unit mods - psuedo-replacing a file at runtime) at least one file.

    I'd take this in small bites.

    Figure out how to make a simple change to a unit. Cost, damage, etc - some simple number.

    Play with unittypes and buildable types for existing units.

    Figure out how to add a single static new unit (e.g. pick one commander to make buildable)

    Take a look at some mods that do server mod UI shadows - mine include Puppetmaster, Commander Regeneration, and Mod Help Player Guide (server edition)

    Then we'll talk about putting it all together.

Share This Page