Purchase Random Hero

Status
Not open for further replies.
Level 7
Joined
Sep 4, 2016
Messages
116
I am running into an interesting challenge and am wondering if someone has already solved this before I spend too much time trying to figure it myself.
I have a map where all user heroes are purchased from a Tavern, essentially. I wanted to add an option where you can purchase a random hero, but the issue I run into is that replacing the stand-in hero unit with a random hero counts both the stand-in and then the replaced hero toward the hero count. This prevents the purchase of another hero at second tier.
Any ideas for a smooth resolution?
Thanks in Advance!
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Does it work if you "remove" and "create" instead of "replace"?
I believe replace already removes the unit before creating a new one.

I wonder if Cheshire's method would work, my fear is that a non-hero unit as the Dummy will have it's own problems like ignoring tier limitations.

If that doesn't work then maybe Changing the owner before removing it could help?
 
Level 7
Joined
Sep 4, 2016
Messages
116
Cheshire's method is what I did first, but it does ignore tier limitations. I tried removing and creating, and it did no better. Finally, I tried your method of changing ownership, and it did not work.

I think I am going to have to make non-hero classified units, and replace the random unit available to be sold with one that requires second tier, once the player has bought their first hero. It's not the most elegant, but I think I'll be able to make it work.
If anyone comes up with a better idea, please do tell.
 
Status
Not open for further replies.
Top