• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

i HATE triggers (why don't they work?)

Status
Not open for further replies.
Level 6
Joined
Aug 29, 2004
Messages
159
Hey guys
I thought i'd make a set of triggers to fulfill the most common things you see in maps: A wisp-controlled hero selection, auto hero revive trigger, etc. Well. In modifying mine own trigger to make it a single trigger compatible for multiple heroes, i came across some really random stuff.
The trigger ALWAYS works fine when selecting hero 2. It works occasionally for heroes 1 and 4, and hasn't worked once yet for hero 3. It uses exaclty the same trigger for all of them, using array variables to distinguish between the activation regions.
ARGH it is really ticking me off not knowing why it works so randomly. by rights it should work.
I'll post the map in a sec so anyone who wants to help can. :).

(*EDIT* Map posted, author is =][= Bort)


=][= Bort
(PS The revive trigger works perfectly)
 
Level 4
Joined
Aug 14, 2005
Messages
49
Now Fubb, please do not be rude.

I bet you haven't started diffrently, so plz do not start discriminating some people.

Ok to answer your question, it's a bit hard to answer this, cuz you haven't really spezified where the problem is, but well I offer you two options here:

a) You could also study an old Hero arena map, and copy and paste those triggers, and alter them a bit for your map.

b) I will try to have a look at your map, see if I can help. Will contact you later.

Yours,

Oug
 
Level 6
Joined
Aug 29, 2004
Messages
159
No no no you guys have got it all wrong
I know how to create this trigger, its very easy, just "unit enters region, spawn 1 hero for player"
However, all the maps that i've seen (ie the ones i've been able to open) they use a separate trigger for each hero. I thought it might be not that difficult to create ONE trigger, for other people to import into their own maps, which worked for ALL the heroes, using a simple For Each Integer A fuction and two array variables. :). Ironically, the trigger i wrote for people who can't write triggers doesnt work.

The trigger as it is seems flawed somehow, but in a very strange way. I have created the map with 4 heroes and 4 teams, just to make sure it will work for nearly every type of map. When moving to select the 2nd hero, it will work 100% of the time. Selecting the 1st and 4th heroes works about 60% of the time, and selecting the 3rd hero hasn't worked once yet. I have checked, double-checked and re-written the triggers to make sure i didnt set the variables wrong, but it still doesnt work.
If anyone knows why the trigger would be only operating so selectively, enlighten me
=][= Bort
 
Level 3
Joined
Aug 18, 2005
Messages
45
I think I know how you can fix this. If not, describe here the exact script of your triggers.

Open up your Trigger Editor. Take your functions. You said you wanted to use only one trigger for the whole thing... first off, try reading Draqz's Tutorial on Arrays. From what I've seen, he uses one variable. We'll create 4 regions, one for each hero. We'll name our array HeroSelectRegion. Give it a number using Set variable= action, setting each region a number of HeroSelectRegion.
Here would be your script:
Code:
Events-
   A unit enters HeroSelectRegion.

Conditions-
   Entering unit is a Wisp.

Actions-
   For each Integer 1 to 4, do actions:
     Create 1 Hero for all owners of every unit of type Wisp entering HeroSelectRegion.
     *Repeat for each region.

There's also a second solution.
Code:
Events-
   A units receives an order with a point as target.

Conditions-
   Ordered unit is a Wisp.

Actions-
   If point of issued order is HeroSelectRegion[1], then create *Unit for owner of entering unit
   *Repeat for each region.

Tell me if those doesn't work, I hope I helped.
 
Level 6
Joined
Aug 29, 2004
Messages
159
AHA!
Got the little sucker!
I changed my script to function around a periodic picking of units within range of each hero. It also means now that i have less variables in the map.

:( Although that solves the problem of getting the trigger to work, it doesnt do anything for me wondering why on earth my original script wasnt functioning. It started to work better when i changed it to a 'unit comes within range' fuction but still not 100% of the time. Hmmm...
Oh well, thats a puzzle for another day. Gonna piss me off for a while tho...
=][= Bort
 
Level 6
Joined
Aug 29, 2004
Messages
159
yes it does solve the problem, the trigger now works perfectly.
No, it doesnt ease my concience.

Heres the code of the old one
Code:
Select Hero Old
    Events
        Unit - A unit enters HeroRegion1 <gen>
        Unit - A unit enters HeroRegion2 <gen>
        Unit - A unit enters HeroRegion3 <gen>
        Unit - A unit enters HeroRegion4 <gen>
    Conditions
        (Unit-type of (Triggering unit)) Equal to Hero Spirit
    Actions
        For each (Integer A) from 1 to 4, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Heroregion[(Integer A)] contains (Triggering unit)) Equal to True
                    Then - Actions
                        Unit - Create 1 HeroType[(Integer A)] for (Owner of (Entering unit)) at (Center of Region 008 <gen>) facing (Center of Region 008 <gen>)
                        For each (Integer B) from 1 to 4, do (Actions)
                            Loop - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        ((Owner of (Entering unit)) is in Team[(Integer B)]) Equal to True
                                    Then - Actions
                                        Unit - Move (Last created unit) instantly to (Center of TeamRegion[(Integer B)]), facing (Center of Region 008 <gen>)
                                        Camera - Pan camera for (Owner of (Entering unit)) to (Position of (Last created unit)) over 0.01 seconds
                                        Special Effect - Create a special effect attached to the origin of (Last created unit) using Abilities\Spells\Human\ReviveHuman\ReviveHuman.mdl
                                        Hero - Create Potion of Greater Healing and give it to (Last created unit)
                                        Unit - Remove (Entering unit) from the game
                                    Else - Actions
                    Else - Actions

yeah. I *think* thats what it used to be, i had to reconstruct it, but yeah. It uses a unit-type variable array HeroType, region array HeroRegion, playergroup array Team, and region array TeamRegion. I can't notice any flaws, and i thinkthe fact that that it works sometimes proves that its alright...

=][= Bort
 
Level 3
Joined
Aug 18, 2005
Messages
45
I think I know what you've put in your trigger is wrong.

First off, use the array as event, don't put every one region as event. The game gets confused, sometimes.

Second, don't use Triggering unit. Entering unit works better.

Next, create group of players, and make it a variable. Don't use integers on that one. Create two clear groups so the game will identify them well.

To make it even simpler, add Do nothing functions where you want the game to execute no action, as in your Else - Actions parts.

Maybe this will work better.
 
Level 7
Joined
Aug 5, 2005
Messages
218
No, no, no. I think the problem is where you say:

Code:
(Heroregion[(Integer A)] contains (Triggering unit)) Equal to True

after the unit enters the region. From my experience, doing that never worked at all. I guess when the unit "enters" as an event it's not considered in the region, but how your trigger actually worked is beyond me.
 
Level 6
Joined
Aug 29, 2004
Messages
159
aah that could be it, makes sense.. maybe a short wait function would fix it?. Oh well, no matter, my other way works fine, every time. And it only really requires one variable array :).
 
Level 3
Joined
Aug 18, 2005
Messages
45
I'm sorry if I confused you, I sometimes get lost amidst all those triggers too. Luckily I don't get around JASS, I'd be... completely dumped.
 
Status
Not open for further replies.
Top