Trained unit owned by player 1? is it possible?

aliminator8

New Member
Reaction score
3
Hi all and thanks in advance.

My problem is this... i made a map based kinda off x hero line wars,
and basically i want to make a -int command that puts the typing players heroes inteligence up by his current lumber then sets lumber to 0.

I realised for this, i needed to set the players heroe to a unit variable.

So what i wanted to do was, once the person trained his hero from the hero tavern its sets the trained hero to 'hero' (array=trained unit owner *is it possible?*)

(Oh yeh, im usin WEU)

Ok so this is what i had.

Event
---Unit owned by Player 1 (Red) Finished training a unit.
Condition
---((Trained unit) is a Hero) equal to true
Action
---Set Hero[1]= Trained Unit **(player 1 red = [1])**

It didn't work.... I realised it was because the Hero Tavern was ownd by neutral Hostile. sigh.....

i made 2 hero tavern for 2 teams, makes sense... one each

So my second attempt at the triger was like this...i got stuck halfway//lol//

Action
---Unit- A unit Finishes training a unit
Condition
---((Trained unit)is a Hero) Equal to true
---??((Trained unit) owned by player 1) Equal to true??
Action
---Set Hero[1]

I got the -int command written so i could test this.... but so fare i cant find a way to check if the trained unit was trained by player 1... do u get what im talking about?
 
M

Mythic Fr0st

Guest
I got the -int command written so i could test this.... but so fare i cant find a way to check if the trained unit was trained by player 1... do u get what im talking about?

~ No

But do this first, when you copy paste code highlight it all, and press the # tag, (next to Quote)
Code:
    Events
        Unit - A unit Finishes training a unit
    Conditions
        Trained unit is a Hero) Equal to true
    Actions
        Set Hero[Player number of owner of trained unit] = trained unit

Code:
    Events
        Player 1 red types a chat message containing -int as an exact match
    Conditions
    Actions
        Set Price_Per_Int = 20
        Set CurrGold = triggering player current gold
        Set AmountToAdd = CurrGold / Price_Per_Int
        Set Triggering Player Current Gold to AmountToAdd
        Hero - Add AmountToAdd to Hero[Player number of triggering player] intelligence

Just repeat the event for each player (put the events all in 1 trigger)

Is that what you wanted?
 

aliminator8

New Member
Reaction score
3
yeh that helps and ty for the code tip,
but i wanted to know - when i click buy hero "ranger"(for example) from tavern how i can set him up as a unit variable "Hero[1]"
 
G

g1real

Guest
A unit gets sold
Set hero[Playernumber of owner of sold unit] = Sold unit
 
M

Mythic Fr0st

Guest
Use the code I gave you

to load Hero[] with any hero the player buys

Code:
    Events
        Unit - A unit Finishes training a unit
    Conditions
        Trained unit is a Hero) Equal to true
    Actions
        Set Hero[Player number of owner of trained unit] = trained unit
 
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