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

[Solved] Too Many Custom Heroes... (Gameplay Constants entry limit)

Status
Not open for further replies.
Level 7
Joined
Sep 4, 2016
Messages
116
It appears I have created too many heroes in one of my maps.
I've included them in gameplay constants and it wont let me add any more (it appears the cap is 52). This is causing there to be no limitation on repeat purchases for the unlisted heroes (which believe I know how to dealt with through triggers) and is disrupting the limit on number of heroes per tier (which I am not sure how to approach). Any ideas on dealing with this?

The only idea I've had so far is making heroes equivalent to each other in 'dependency equivalents' field, which could have issues with over-limiting hero purchases, and possible other problems.
 
Last edited:
Level 7
Joined
Sep 4, 2016
Messages
116
As I've looked into this some more, I found a related thread here. It doesn't solve the issue, but helps me understand what is going on. It appears there is a set max number of fields between all the Gameplay Constants fields. so the 52 cap is not fixed, but dependent on the number of fields other gameplay constants use.
Continuing on, I found another approach which I may use to resolve this. This post explains an approach involving spawning in a dummy hero that is in gameplay constants when a hero is trained, then immediately removing it. I imagine this will work, but I'll try to update this when I've confirmed.
 
Level 10
Joined
May 31, 2019
Messages
139
If you want your custom heroes to respect tier-dependencies, probably the way to go is to override the file Units/NeutralUnitFunc.txt. That way you wouldn't hit the Gameplay Constants limit.

So you'd use CascView to extract the file from war3's game data, then adjust it as needed, adding your custom heroes to the [HERO] list. (need to refer to them by their custom unit id. Ex: H001)

Code:
// permits dependencies upon heroes
[HERO]
DependencyOr=Hamg,Hblm,Hmkg,Hpal,Obla,Ofar,Oshd,Otch,Edem,Ekee,Emoo,Ewar,Ucrl,Udea,Udre,Ulic,Npbm,Nbrn,Nngs,Nplh,Nbst,Nalc,Ntin,Nfir,H001

then import the modified file into your map so it overrides Units/NeutralUnitFunc.txt

Complicated? A bit. But it's probably better than messing with dummy units to get the intended effect.

Full disclosure: I have not actually tried to add that many heroes to that list.

Of course it would be nice it blizz just supported this outright lol.
 
Last edited:
Level 7
Joined
Sep 4, 2016
Messages
116
Thank you both for your responses!

It actually appears to have been pretty simple to implement it with triggers. I have only two units in gameplay constants (dummy units), and only more than the one because the other is for a random hero purchase mechanism I have.
I had to remove everything else from heroes in gameplay constants, but then I have a scalable trigger than checks if a purchased or trained unit is a hero, and if so creates and removes the dummy hero from gameplay constants. This handles the tier hero limit.

For limiting training to one per hero type, I similarly check if the unit in training (or sold--for which it can be done in the same trigger as above) is a hero, and if so, set the max units of that type trained to 1.

I still need to take the chance to test more to confirm this works, but it appears to be sound, is scalable, and I enjoy its simplicity.
 
Status
Not open for further replies.
Top