HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

[Q]About "A unit comes within Range" Event...

01-14-2004, 04:35 AM#1
danny760311
I last wrote a trigger like the following:

Code:
Hero Information
    Events
        Unit - A unit comes within 150.00 of Blood Mage 0000 <gen>
        Unit - A unit comes within 150.00 of Archmage 0002 <gen>
        Unit - A unit comes within 150.00 of Mountain King 0001 <gen>
        Unit - A unit comes within 150.00 of Paladin 0003 <gen>
    Conditions
        (Unit-type of (Triggering unit)) Equal to Shade
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Distance between (Position of (Triggering unit)) and (Position of Blood Mage 0000 <gen>)) Less than or equal to 175.00
            Then - Actions
                -------- Show Information about BM --------
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Distance between (Position of (Triggering unit)) and (Position of Archmage 0002 <gen>)) Less than or equal to 175.00
            Then - Actions
                -------- Show Information about AM --------
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Distance between (Position of (Triggering unit)) and (Position of Mountain King 0001 <gen>)) Less than or equal to 175.00
            Then - Actions
                -------- Show Information about MK --------
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Distance between (Position of (Triggering unit)) and (Position of Paladin 0003 <gen>)) Less than or equal to 175.00
            Then - Actions
                -------- Show Information about Pal --------
            Else - Actions


Sometimes it works, sometimes it doesn't. WHY?
01-14-2004, 06:13 AM#2
Grater
Why on earth don't you use seperate triggers?
01-14-2004, 10:24 AM#3
Cubasis
Hah!,

Why on Earth don't you do it in 1 trigger :) just smartly.

How i would do it (btw, this may not fix your problem, i'm just...ehrm...sumtin) is...

Create 2 arrays, a Unit array and a String array.

At map init i'd put each hero into the unit array, and put the information concerning them in the string array in the same elements that the units are in. F.ex. If the MKing is in element 1, then the information-string concerning him would be in string element 1.

Then, you'd have the same "events" as you have in that trigger, but in the action-list, you'd do a

For each integer A from 1 to Number-Of-Heros-Available do actions:
If Triggering Unit is equal to UnitArray[Integer A] then do actions:
display StringArray[ Integer A ] To all players

and voila, that's it. note that It's pseudocode, but if you can't understand what i was saying above, then....ehrm...unlucky you :X

Cubasis :-)