HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

need help with trigger

11-06-2003, 06:29 AM#1
The_Inquisitor3
well i just want to do this

Pick 1 unit in X region and picked unit must be

allied to player 7
Hero with most experience (of allies of player 7)


Pick 1 unit in X region and picked unit must be

allied to player 8
Hero with most experience (of allies of player 8)

thats all i want to do.. its hard to do???

thanks
11-06-2003, 07:22 AM#2
AllPainful
Well I ain't in any way, shape or form an expert.. but I think I got what you need...

2 Variables... (note: I ain't infront of WE right now, so I don't recall if there is a action to get the units exp, but I believe there is.)

Variables:
MostExp7 = Unit
Count = Integer

Code:
Most Exp Allied to 7
  Event
  Condition
  Action
    set variable count = 0
    Pick all units in region matching condition player(owner of(matching unit)) equal to ally of player 7
      Set variable count = count +1
      If 
          Count = 1 
        then 
          set variable "Mostexp7" = Picked unit
        Else
          if
           Interger comparison experience of Mostexp7 less then or euqal to picked unit
          then
           set variable Mostexp7 = Picked unit
          Else 
           do nothing

And after the "pick all units" loop is done then the unit with the most exp will be in the variable "mostexp7"....

Although it 2 units have the same amount of EXP the one picked SECOND will be the one put in the variable...

Do the same for allies of player 8...

Just an idea..

The "If count = 1" thing is so that the first unit picked will be the one set in the variable, and then it goes through picking all the others and comparing them...