1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

"Random Race" button appearing in the wrong place

Discussion in 'Triggers & Scripts' started by DaneTheBeast, Oct 13, 2015.

  1. DaneTheBeast

    DaneTheBeast

    Joined:
    Dec 11, 2014
    Messages:
    608
    Resources:
    1
    Maps:
    1
    Resources:
    1
    [Solved] "Random Race" button appearing in the wrong place

    • SetVariable
      • Events
        • Map initialization
      • Conditions
      • Actions
        • Set RandomRace[1] = Castle
        • Set RandomRace[2] = Necropolis
        • Set RandomRace[3] = Temple Of Tides
        • Set RandomRace[4] = Tree Stump
        • Set RandomRace[5] = Animal Fury
        • Set RandomRace[6] = Altar Of Heroes
        • Set RandomRace[7] = Heaven Portal
        • Set RandomRace[8] = Tree Of Life
        • Set RandomRace[9] = Dragon Nest
        • Set RandomRace[10] = Stronghold
        • Set RandomRace[11] = Poisoned Spring
    • RedRandom
      • Events
        • Unit - Race Market 0000 <gen> Sells a unit
      • Conditions
        • (Unit-type of (Sold unit)) Equal to Random race
      • Actions
        • Unit - Remove (Sold unit) from the game
        • Unit - Replace (Triggering unit) with a RandomRace[(Random integer number between 1 and 11)] using The old unit's relative life and mana
        • Selection - Select (Last replaced unit) for Player 1 (Red)


    When you don't "sell" the unit from the Race Market but choose 1 on your own ,the new building still has that Random Race button ,which can still be used
     
    Last edited: Oct 24, 2015
  2. jonhysone

    jonhysone

    Joined:
    Oct 29, 2012
    Messages:
    1,244
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I have a question before referring to an answer :
    - When do players choose their own races ? Before the game? Or in-game?
     
  3. DEE-BOO

    DEE-BOO

    Joined:
    Apr 4, 2010
    Messages:
    505
    Resources:
    1
    Icons:
    1
    Resources:
    1
    Instead of replacing, just remove it and create the new building.
     
  4. Zwiebelchen

    Zwiebelchen

    Joined:
    Sep 17, 2009
    Messages:
    7,014
    Resources:
    12
    Models:
    5
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    JASS:
    4
    Resources:
    12
    I don't think Triggering Unit can be used in this case.
     
  5. DaneTheBeast

    DaneTheBeast

    Joined:
    Dec 11, 2014
    Messages:
    608
    Resources:
    1
    Maps:
    1
    Resources:
    1
    In game, in the "race market" where they choose what building they want and train that 1 builder.

    What do you suggest I do? I will go try to remove and create

    Edit: ok i tried it and the create-remove instead of replace works fine, but it also works fine with repalce. The problem doesnt seem to be in the trigger because it works. The problem is that the button appears in the new building if it isn't click - if a race is chosen manualy, checked the "Units sold" fields and they are empty ,so i dont see why it's appearing there.
    My guess is that when they building can sell a unit and you upgrade it, it can still sell it, but I dont see a way to easily avoid that
     
  6. pick-a-chew

    pick-a-chew

    Joined:
    Jul 15, 2007
    Messages:
    734
    Resources:
    4
    Icons:
    2
    Maps:
    2
    Resources:
    4
    When building X upgrades to building Y, you could remove building Y and then create another building Y at the location via a trigger (so the new Y shouldn't inherit unit sales).

    However the inheritance of the "Units sold" field between building upgrades is new to me, and you should make sure it's genuine before making complicated solutions.

    You could also try to disallow the training of Random race once players choose their race (though i'm not 100% sure if this will work with sold units).

    Besides using sold units, is there a reason your Race Market can't directly upgrade to the racial buildings (instead of using sold units), or use an ability instead? (Abilities definitely do not inherit unless you make them permanent via custom script).
     
  7. DaneTheBeast

    DaneTheBeast

    Joined:
    Dec 11, 2014
    Messages:
    608
    Resources:
    1
    Maps:
    1
    Resources:
    1
    That building can upgrade into 11 different ones (Which then have only 1 thing to train and that is the builder in this case they have 2 because of the weird button behavior) the 12th button is not an upgrade but (as you see because of the triggers), a sell unit button which doesn't cost any gold.
    I will now try to change it to be also an upgrade and via triggers for it to replace the building like it does now. Thanks for all your suggestions. Here is the link to the current map version i am working on (it's open source) in case you want to see for yourself LINK
    You were all credited in the maps Credits
    NEW EDIT Since I got it work =)
    GOT IT TO WORK! Triggers:
    • SetVariable
      • Events
        • Map initialization
      • Conditions
      • Actions
        • Set RandomRace[1] = Castle
        • Set RandomRace[2] = Necropolis
        • Set RandomRace[3] = Temple Of Tides
        • Set RandomRace[4] = Tree Stump
        • Set RandomRace[5] = Animal Fury
        • Set RandomRace[6] = Altar Of Heroes
        • Set RandomRace[7] = Heaven Portal
        • Set RandomRace[8] = Poisoned Spring
        • Set RandomRace[9] = Tree Of Life
        • Set RandomRace[10] = Dragon Nest
        • Set RandomRace[11] = Stronghold

    • RedRandom
      • Events
        • Unit - Race Market 0000 <gen> Begins an upgrade
      • Conditions
        • (Unit-type of (Triggering unit)) Equal to Random race
      • Actions
        • Unit - Create 1 RandomRace[(Random integer number between 1 and 11)] for Player 1 (Red) at (Player 1 (Red) start location) facing Default building facing degrees
        • Unit - Remove Race Market 0000 <gen> from the game
        • Selection - Select (Last created unit) for Player 1 (Red)

    Set it to be an upgrade and use the above trigger, works now perfectly. I'll edit this post if I find anything new. I also found another topic on Hive on which Condition to use for the "Begins an Upgrade". Thanks you all
     
    Last edited: Oct 14, 2015
  8. Zwiebelchen

    Zwiebelchen

    Joined:
    Sep 17, 2009
    Messages:
    7,014
    Resources:
    12
    Models:
    5
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    JASS:
    4
    Resources:
    12
    The problem is the unit select action.
    It has quite a lot of bugs with shops and spellbooks (it does not properly refresh the command card if a similar unit was selected before).
    You can probably fix it by selecting a different unit before reselecting the shop.