• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 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!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

different hero, different army

Status
Not open for further replies.
Level 16
Joined
May 2, 2011
Messages
1,346
hi guys
in a map I edited,I wanted that a player can build specific units,or do certain upgrades only if he has specific hero.
for that I used the specific hero in the tech-tree requirements
the problem I am facing is that I want some units to be built with more then a hero(e.g. if a player want to build a sorcerer he has to have a bloodmage or an archmage,not with any other hero)
does anybody have an Idea how to do this
please tell if there is previously-opened thread discussing this Issue.
thank you
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,156
Use a trigger system to disable the units and technologies based on hero.

To do this you could make a table to map a list of exclusions to hero types. Thus when a hero is choosen, you itterate through all the exclusions setting them in place. For the table I would advise a hashtable as you can use one of the parent/child fields for the hero type. You could then eithor use the other to make the list or store an index to an array list system.
 
Level 16
Joined
May 2, 2011
Messages
1,346
Use a trigger system to disable the units and technologies based on hero.

To do this you could make a table to map a list of exclusions to hero types. Thus when a hero is choosen, you itterate through all the exclusions setting them in place. For the table I would advise a hashtable as you can use one of the parent/child fields for the hero type. You could then eithor use the other to make the list or store an index to an array list system.
Hashtable!!this is to hard for me,is there no easier way?
I think I am going to use the map constants for tier 4 and let the sorcerer to depend(in techtree) requirements on tier 4
thank for the reply
 
Level 5
Joined
Sep 1, 2010
Messages
168
There is an easier solution than hashtables.
Add all the upgrades you want in a building to it.
Use a trigger that disables all upgrades (means sets current and max research levels of that upgrade/number of trained units of type to 0) for every player that are not for everyone to use one by one on map initialisation

use another trigger
even - unit enters playable map
condition - none
actions
if (triggering unit == unit type) (e.g. paladin)
then (set max research research level of upgrade to whatever you desired max is for owner of triggering unit) -> You can have players have the same ability with different ranges of how many upgrades of an ability they have and at which level they start (set current level of upgrade to YXZ).

Just make a condition for each hero type.
Not too sure how this works if you want the same with units from buildings that all players can build but might be worth a try too :thumbs_up:
 
Level 16
Joined
May 2, 2011
Messages
1,346
Thank you so much my friend.your solution works fine.amazing:thumbs_up:.
If I could just shorten the the too long trigger,I would be in no need of the ''hashtables''
I mean for e.g. to write(somehow):
make units x,y,z unavailable
instead of:
make units x unavailable
make units y unavailable
make units z unavailable
 
Level 5
Joined
Sep 1, 2010
Messages
168
I fear that limiting the training of unit type / set avalability of unit type must be 1 command line for each unit type you want to disable.
If you're lost in your trigger, make for each builder a a trigger that you run (run trigger without checking conditions) where you limit training of unit types / set availability. Remember that the trigger should have no condition and no event, but needs via global variable (integer where you stored the player number of triggering player) to know for whom to set the stuff.
This way you keep the detection trigger slim and still get everything done the way you need to.
Hope this helps a bit :)
 
Level 16
Joined
May 2, 2011
Messages
1,346
I found an easy way.
it is just to use the the techtree proprieties under scenario menu to enable/disable melee,campaign and custom units initially,instead of the too long trigger.
and then using the trigger u talked about to enable what I want.
maybe this method does not go well some units(like orc warlock).
thank you so much for your help :)
 
Level 16
Joined
May 2, 2011
Messages
1,346
What do you think of these triggers about the mercenary case I explained(It did not work)
  • NBP
    • Events
      • Time - Every 110.00 seconds of game time
    • Conditions
      • NB Less than 4
    • Actions
      • Set NB = (NB + 1)
  • NBM
    • Events
      • Unit - Mercenary Camp (Village) 0047 <gen> Sells a unit
    • Conditions
      • (Triggering unit) Equal to Mercenary Camp (Village) 0047 <gen>
      • (Unit-type of (Sold unit)) Equal to Brigand
    • Actions
      • Set NB = (NB - 1)
  • mercenary
    • Events
      • Unit - A unit enters Region 000 <gen>
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Cheif Zalbag The Mighty
    • Actions
      • Neutral Building - Add Brigand to Mercenary Camp (Village) 0047 <gen> with NB in stock and a max stock of 4
      • Neutral Building - Add Rogue to Mercenary Camp (Village) 0047 <gen> with NR in stock and a max stock of 4
      • Neutral Building - Add Assassin to Mercenary Camp (Village) 0047 <gen> with NA in stock and a max stock of 4
      • Neutral Building - Add Enforcer to Mercenary Camp (Village) 0047 <gen> with NE in stock and a max stock of 4
 
Level 16
Joined
May 2, 2011
Messages
1,346
why is the third trigger not connected,I made the third trigger because what want is that only players with that hero can hire the human mercenaries(the orcs cannot hire human mercenaries).
and for that ,I wanted the building to have no units to hire.But when the that hero enter the region I specified (it contains the building and when the hero enter it, he gets near the building),when he enter that region, human mercenaries will be added to that mercenary camp,is it clear now?
what is not working is that when the hero enters,no units are added to the building.
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
Here is map with working Enter Region trigger.

You did not add 'Sell unit' ability to your shop. Additionaly to work properly (so stock wont be 0) i set default values to 4.

Wasnt looking on anything except that, although i think your triggers with manipulating those numbers are wierd.
 

Attachments

  • (4)Goldshire v1.14b.w3x
    309 KB · Views: 35
Level 16
Joined
May 2, 2011
Messages
1,346
but how would it be if I want them to be in the beginning 0 so if someone tries to buy in the early game he cannot. But after while(e.g. 210 second for the assassin) when the variable becomes it's initial value+1=0+1=1, after that time when the hero enter the region the unit will be added to that shop with number of 1(in our e.g. is should be 1 assassin is added to the shop), why does that not happen in my trigger?
 
Status
Not open for further replies.
Top