I need help with a system I have for hero buying!

Marsmallos

Member
Reaction score
17
In my map, the human players will be able to have a maximum of ten heroes, divided to one hero per player. You get a hero by picking it in a tavern.

Then, there'll be three "types" of heroes, Tank, DPS and Healer. There are three different Tank heroes, four different Healer heroes, and at least seven different DPS heroes. However, once two Tank heroes have been picked, all the Tank heroes dissappear from the tavern, same goes for Healers, once three (of any of the healers, Shaman, Druid, Priest, Paladin) have been bought the Healer heroes dissappear from the tavern, and same for DPS, once five have been picked, all DPS heroes disappear from the tavern.

So, there can never be more than two Tanks, three Healers and five DPS:ers.

Does anyone have any ideas how to get this working? I've been playing around a bit with array unit variables but I'm not sure that's the right way to go...

EDIT: Ooops just realised how gramatically incorrect the title was...
 

und34d-rul3

New Member
Reaction score
12
Try This:

Code:
Hero Buy
    Events
        Unit - A unit enters (Entire map)
    Conditions
        ((Triggering unit) is A Hero) Equal to True
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Unit-type of (Triggering unit)) Equal to Footman
                (Unit-type of (Triggering unit)) Equal to Priest
            Then - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Heroes[0] Less than or equal to 1
                    Then - Actions
                        Set Heroes[0] = (Heroes[0] + 1)
                    Else - Actions
                        Unit - Remove (Triggering unit) from the game
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Unit-type of (Triggering unit)) Equal to Sorceress
                        (Unit-type of (Triggering unit)) Equal to Rifleman
                        (Unit-type of (Triggering unit)) Equal to Gryphon Rider
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                Heroes[1] Less than or equal to 2
                            Then - Actions
                                Set Heroes[1] = (Heroes[1] + 1)
                            Else - Actions
                                Unit - Remove (Triggering unit) from the game
                    Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Unit-type of (Triggering unit)) Equal to Footman
                                (Unit-type of (Triggering unit)) Equal to Knight
                                (Unit-type of (Triggering unit)) Equal to Siege Engine
                                (Unit-type of (Triggering unit)) Equal to Blood Mage
                                (Unit-type of (Triggering unit)) Equal to Dragonhawk Rider
                            Then - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        Heroes[1] Less than or equal to 4
                                    Then - Actions
                                        Set Heroes[2] = (Heroes[2] + 1)
                                    Else - Actions
                                        Unit - Remove (Triggering unit) from the game
                            Else - Actions

You need an integer Heroes with an array of 3. First, if a unit is created, the trigger checks if its a hero. Then it checks the unit type, these should be changed - the first if/then/else checks for the max 2 Tank heroes, then second checks for max 3 healers, then third checks for max 5 dps. You probably want to expand this more so that instead of just removing the unit it sends them a message and gives their money back.
 

Ithladir

Member
Reaction score
5
Well i think u could make 3 integer variables (naming them Tank,Healer and DPS just for example, all being 0 to start with).

ok, here it goes:

Code:
Sell
    Events
        Unit - A unit Sells a unit
    Conditions
        (Unit-type of (Selling unit)) Equal to (any of your tanks)
    Actions
        Set Tank = Tank +1

Code:
Sell2
    Events
        Unit - A unit Sells a unit
    Conditions
        (Unit-type of (Selling unit)) Equal to (any of your tanks)
        Tank is equal to 3
    Actions
        Player - Make (your tank) Unavailable for training/construction by (Triggering player)

and just add the last action for every tank. this should work for all your heroes.

[EDIT]: forgot, you've gotta put all your tanks in the condition.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top