Spawn auto have my commander already selected so that I don't have to click on it at the start.

Discussion in 'Mod Discussions' started by tatsujb, March 2, 2014.

  1. tatsujb

    tatsujb Post Master General

    Messages:
    12,902
    Likes Received:
    5,385
    admit it, you all want it.

    I don't have the hide for this I couldn't know where to start.
    If there's any questions as to what I mean don't hesitate.
    Last edited: March 3, 2014
    Quitch likes this.
  2. brianpurkiss

    brianpurkiss Post Master General

    Messages:
    7,879
    Likes Received:
    7,438
    I'd love this. :)
  3. stawos

    stawos Member

    Messages:
    79
    Likes Received:
    46
  4. Raevn

    Raevn Moderator Alumni

    Messages:
    4,226
    Likes Received:
    4,324
    Just need to call the following once the game starts:

    api.select.commander();
  5. stawos

    stawos Member

    Messages:
    79
    Likes Received:
    46
  6. Corang

    Corang Well-Known Member

    Messages:
    772
    Likes Received:
    313
  7. tatsujb

    tatsujb Post Master General

    Messages:
    12,902
    Likes Received:
    5,385
    right you are. and I'm going to do some tests with raven's code.
  8. Quitch

    Quitch Post Master General

    Messages:
    5,861
    Likes Received:
    6,045
    wheeledgoat likes this.
  9. tatsujb

    tatsujb Post Master General

    Messages:
    12,902
    Likes Received:
    5,385
    I tried everything that I could, I couldn't make use of that call.
  10. proeleert

    proeleert Post Master General

    Messages:
    1,681
    Likes Received:
    1,656
    Should work.
    Just make sure you call it when the time is right in a live_game scene.
  11. tatsujb

    tatsujb Post Master General

    Messages:
    12,902
    Likes Received:
    5,385
    arg gonna try again.
  12. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    The timeout is kind of a hack, but I'd have to read live_game in detail to look for a better signal.

    Code:
     model.showLanding.subscribe(function(show) {
        if (show == false) {
          setTimeout(api.select.commander, 200)
        }
      })
    
  13. tatsujb

    tatsujb Post Master General

    Messages:
    12,902
    Likes Received:
    5,385
    OK, here's where I'm at :
    [​IMG]

    why do both :
    Code:
    for (var k=0;k<1;k++) {
    api.select.commander();
    }
    
    and
    Code:
    for (var k=2;k>1;k--) {
    api.select.commander();
    }
    
    Keep the commander infinitely selected?

    is that NOT a one time loop? WTF? (I place this at line 321 inside the SelectViewModel function)

    not to mention @wondible is right, other than mimiking the game startup timeout duration we have no choice!
    Last edited: March 3, 2014
  14. LavaSnake

    LavaSnake Post Master General

    Messages:
    1,620
    Likes Received:
    691
  15. Corang

    Corang Well-Known Member

    Messages:
    772
    Likes Received:
    313
  16. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    The code gets run every time the selection changes, and then changes the selection. You've created an form of recursive function with a detour through the game engine event system. ;^)
  17. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    I think you need to edit the title and/or OP, lots of people seem to be confused.
  18. tatsujb

    tatsujb Post Master General

    Messages:
    12,902
    Likes Received:
    5,385
    to what?

    EDIT: changed title, we'll probably still have this issue anyways.
  19. proeleert

    proeleert Post Master General

    Messages:
    1,681
    Likes Received:
    1,656
    Won't this select all commanders in team games though ?
    It used to be like this. Maybe Gamma fixed it ?
  20. tatsujb

    tatsujb Post Master General

    Messages:
    12,902
    Likes Received:
    5,385
    no. even if the UI makes it unclear as hell, you have one commander. that call selects YOUR commander
    that was when you both had the same commander and double-clicked on one, since they were the same type of unit it just selected both.

Share This Page