• 🏆 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!

Prevent player to hire another hero

Status
Not open for further replies.
Level 24
Joined
Jun 26, 2020
Messages
1,853
Hello, I'm making a multiplayer map where you can choose a hero (by hiring it), but the place where is choosed is reachable for the normal units, so instead of make it unreachable I wanna know I can make it impossible to hire another one just for that player. I tried adding techtree requiriments and limit the number of heros but it didn't work.
 
Level 24
Joined
Jun 26, 2020
Messages
1,853
you could add a trigger that detects when you try to buy a hero, and cancels the order (and shows error text) when the player already has one.
It could be, but if I use the "Sells a unit event" I can't remove the unit sound, and with the "Issues an order event" how can I refer to the buying player? Because the triggering unit is the shop.
You need to set limit of hero to 1 AND add the hero to gameplay constant. Since the constant is limited to 52 heroes (you can delete entries there, but the limit is hard-coded IIRC), create a dummy 'Hero' unit and make all heroes have techtree equivalent to it.
I followed the instructions, but didn't work.
 
Last edited:
Level 10
Joined
Mar 25, 2008
Messages
339
You can make a simple Integer, array it to as many players as there are in the game so 12/24?
Add a trigger when they hire the hero their integer (player number of owner of buying unit) or whatever +1 or = true if you use a boolean

And in that same trigger you could add it so if its already =1 or =True it just auto-deletes the hero that was just purchased.
 
Level 10
Joined
Mar 25, 2008
Messages
339
1657464756032.png

1657464771212.png

1657464806005.png
 
Level 24
Joined
Jun 26, 2020
Messages
1,853
You can make a simple Integer, array it to as many players as there are in the game so 12/24?
Add a trigger when they hire the hero their integer (player number of owner of buying unit) or whatever +1 or = true if you use a boolean

And in that same trigger you could add it so if its already =1 or =True it just auto-deletes the hero that was just purchased.
Thank you but, this is what @Cheshire suggested me and I've already done this, and this is not my ideal solution because it still sounds the when I hire the hero.
 
Status
Not open for further replies.
Top