Will this work?

BSJikan

New Member
Reaction score
5
So I'm trying to set it so that I can track what unit a player buys from the hero tavern.
Would;
Code:
Player 1s Hero
    Events
        Unit - A unit owned by Player 1 (Red) Finishes training a unit
    Conditions
    Actions
        If ((Trained unit-type) Equal to Auran) then do (Set Player1Hero = (Trained unit)) else do (Do nothing)
Work?

There will be others, such as;
Code:
Player 1s Hero
    Events
        Unit - A unit owned by Player 1 (Red) Finishes training a unit
    Conditions
    Actions
        If ((Trained unit-type) Equal to Magician) then do (Set Player1Hero = (Trained unit)) else do (Do nothing)
But would it set that specific unit into that unit variable?
 

MurderMode

Giving new meaning to co-op... slowly
Reaction score
154
here is an easier way to do it, just create a unit type variable and when the hero enters the map put this action into the trigger -

Code:
Hero Track
    Events
    Conditions
    Actions
        Set Hero_track[(Player number of (Owner of (Last created unit)))] = (Unit-type of (Last created unit))

....basically you are just setting the variable to the type of unit last created. (it's a unit type variable with an array of 12 if you didn't catch it)

Make the event something like 'unit enters playable map area', and a condition to say 'unit type is a hero equal to true'. It will cut alot of the work out for you if you do it with this single line instead of for each unit type ;P
 

hasslarn

New Member
Reaction score
20
i think this may work

Code:
Manual Hero Pick
    Events
        Unit - A unit Sells a unit
    Conditions
        ((Sold unit) is A Hero) Equal to True
    Actions
        Player Group - Pick every player in (All players) and do (Actions)
            Loop - Actions
                Player - Make (Unit-type of (Sold unit)) Unavailable for training/construction by (Picked player)
        Game - Display to (All players) the text: (A player has chosen  + (Name of (Sold unit)))
        Selection - Select (Sold unit) for (Owner of (Sold unit))


Code:
Move Heroes
    Events
        Unit - A unit enters (Playable map area)
    Conditions
        ((Entering unit) is A Hero) Equal to True
    Actions
        Unit - Move (Entering unit) instantly to ((Owner of (Entering unit)) start location)

it worked for me
 

BSJikan

New Member
Reaction score
5
It took me a minute to understand that line fully, but I get it now, thanks, MurderMode.

hasslarn I see what you are trying to accomplish, but it's not what I was looking for. I was trying to get the sold unit into a variable, so I can track it later. Your code would simply make the unit unselectable again. I already did that by setting the rebuy time to a huge amount and the gold cost to 750 while the players only own 1000. Thanks though :D.

Don't know i anyone is going to get to see this,
But I couldn't find, for the end, (Unit-type of (Last created unit))
So I set it like;
Code:
Set HeroTracker[(Player number of (Owner of (Last created unit)))] = (Last created unit)
What's the difference?
 

MurderMode

Giving new meaning to co-op... slowly
Reaction score
154
is your variable a unit variable or a unit-type variable? because it needs to be a unit-type variable to make it the same as the trigger on my post
 
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