• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

"Random Race" button appearing in the wrong place

Status
Not open for further replies.
Level 12
Joined
Dec 11, 2014
Messages
662
[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:
Level 12
Joined
Dec 11, 2014
Messages
662
I have a question before referring to an answer :
- When do players choose their own races ? Before the game? Or in-game?

In game, in the "race market" where they choose what building they want and train that 1 builder.

Zwiebelchen said:
I don't think Triggering Unit can be used in this case.

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
 
Level 13
Joined
Jul 15, 2007
Messages
763
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).
 
Level 12
Joined
Dec 11, 2014
Messages
662
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)

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
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:
Status
Not open for further replies.
Top