• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Why won't my trigger work?

Status
Not open for further replies.
Level 3
Joined
Feb 7, 2009
Messages
42
This is a small part of a trigger that runs some abilities
The ability in this trigger is Bloodlust

Bloodlust - Casts bloodlust on all friendly heroes

Somehow the trigger is not working correctly, but I use a similiar trigger for another ability that casts Inner Fire on all friendly heroes and it works perfectly, it's exactly the same actions and same order, but the bloodlust does not work correctly

Does anyone know what's wrong with my trigger?

Info:
The 'Bloodlust' ability is based on a 'Thunder Clap' ability with no Aoe
The dummy unit does have the dummy ability
The dummy unit does have mana to use the dummy ability
The dummy ability is based on wc3 default bloodlust, but with levels
Trigger : The complete trigger runs whenever a 'Shaman' starts the effect of an ability and sets the initial variables before checking what ability was used.

  • Bloodlust
  • Events
    • Unit - A unit starts the effect of of an ability
  • Conditions
  • Actions
    • Set Caster = (Triggering Unit)
    • Set Player = (Owner of (Triggering Unit)
    • Set Player_Number = (Player number of (Owner of (Triggering Unit)
    • Set Target = (Target unit of ability being cast)
    • Set Ability_Level = (Level of (Ability veing cast) for (Triggering Unit))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Ability being cast) equal to Bloodlust
      • Then - Actions
        • Set Integer = 0
        • Set tempGroup = (Units in (Playable map area)((((Matching unit) is a Hero) Equal to True) and (((Matching unit) is alive) Equal to True)))
        • Set tempPoint = (Position of Caster)
        • Unit Group - Pick every unit in tempGroup and do (Actions)
          • Loop - Actions
            • Set Integer = (Integer + 1)
            • Set Unit_A[Integer] = (Picked unit)
            • Create 1 Dummy(Bloodlust) for Player at tempPoint facing (270.0) degrees
            • Set Caster_A[Integer] = (Last created unit)
            • Unit - Set level of Dummy(Bloodlust) for Caster_A[Integer] to Ability_Level
            • Unit - Order Caster_A[Integer] to (Convert bloodlust to unit targeted order) Unit_A[Integer]
            • Unit - Add a 3.00 Generic expiration timer to Caster_A[Integer]
      • Set Integer = 0
      • Custom script: call RemoveLocation (udg_tempPoint)
      • Custom script: call DestroyGroup (udg_tempGroup)
      • Skip remaining actions
      • Else - Actions
 
Last edited:
Level 10
Joined
Jan 28, 2009
Messages
394
Would it not be easier to use the ability Howl of Terror and change the effect to positive ones and targets to friendly?
 
Level 3
Joined
Feb 7, 2009
Messages
42
Would it not be easier to use the ability Howl of Terror and change the effect to positive ones and targets to friendly?
How of terror doesn't have bloodlust effect at all
change all your triggering unit variables to (Casting unit)
Do you mean? I'm sorry i didn't get your point.
  • Set Caster = (Casting unit)
and make sure the target is valid
The ability is based on wc3 default bloodlust ability, with it defaut targets.
Btw, there is no enemy hero on the map, so there is no need to add a friendly condition for the unit group

I hate when this happens, WE is weird, i have another ability that casts Inner Fire on all friendly heroes and it used exactly the same triggering method, i mean, exactly. And it works perfectly

And fyi, this is a pastebin situation.
I'm sorry but what's a pastebin situation?
 
Level 11
Joined
Feb 22, 2006
Messages
752
Thunder clap doesn't have a target unit, so that line where you set a global to target unit of ability being cast might cause some trouble.

Does your bloodlust ability (the one that the dummy caster casts) have sufficient range? You create the dummy caster at the caster instead of at the target, so if the targets are too far away, the caster will have to move before it can cast. You can either increase the range of the bloodlust to 99999.9 or create the dummy caster at the target.

By the way, are you killing your dummy casters after they're done casting?

As a final note, you're leaking a boolexpr every time you populate tempGroup (though there's really no way to fix this unless you know JASS).

EDIT: One last thing: Using CustomScript: set bj_wantDestroyGroup = true right before you call the Unit Group - Pick every unit in... action will cause the game to destroy the group without you having to save the group in a global and destroy it yourself.
 
Level 3
Joined
Feb 7, 2009
Messages
42
Thunder clap doesn't have a target unit, so that line where you set a global to target unit of ability being cast might cause some trouble.
Bloodlust is not the only ability in this trigger, the Target variable is used in other abilities on the same trigger.

Does your bloodlust ability have sufficient range?
Yes it has max range

By the way, are you killing your dummy casters after they're done casting?
Yes i am giving them an expiration timer, i just forgot to add it in here, thanks

As a final note, you're leaking a boolexpr every time you populate tempGroup (though there's really no way to fix this unless you know JASS).
I'm sorry but i didn't get that, is there a topic somewhere explaining that? Or maybe it is simple and you could explain it yourself?

EDIT: One last thing: Using CustomScript: set bj_wantDestroyGroup = true right before you call the Unit Group - Pick every unit in... action will cause the game to destroy the group without you having to save the group in a global and destroy it yourself.
Hmm that's useful, I wonder if that works for other variables as well
 
Im saying that it's safer to use casting unit. It's just poor and lazy not to. Triggering unit is so broad and can be mistaken for different units. It's happened with me. and no, don't create a new variable.

Pastebin is a place to check triggers. maybe someone could give you more feedback if you posted it there.

My best suggestion would be to use another type of bloodlust. like frenzy or something. see if it changes anything. or find some other ability that could apply
 
Level 3
Joined
Feb 7, 2009
Messages
42
Problem solved.
I changed this line
  • Unit - Create 1 Dummy(Bloodlust) for Player at tempPoint facing 270.0 degrees
into this one
  • Unit - Create 1 Dummy(Bloodlust) for (owner of (picked unit)) at tempPoint facing 270.0 degrees
And somehow it worked lol
WE is very strange sometimes
 
Level 11
Joined
Feb 22, 2006
Messages
752
Quote:
As a final note, you're leaking a boolexpr every time you populate tempGroup (though there's really no way to fix this unless you know JASS).

I'm sorry but i didn't get that, is there a topic somewhere explaining that? Or maybe it is simple and you could explain it yourself?

The action that does pick every unit in... creates a boolexpr to check the conditions. Even though it's using the same conditions (cuz the trigger never changes) it still creates a new boolexpr every time the action runs. The boolexpr needs to be destroyed otherwise you get memory leaks (like with groups and positions and special effects, etc.). In JASS I just create the boolexpr once at map init and save it to a global and pass the variable to the enum function, but in GUI this isn't possible (to my knowledge). You can get around this by setting no conditions for that action and putting an if-then-else block inside the loop that checks the conditions instead of having the enum action check the conditions. This way the game never creates a boolexpr.
 
Status
Not open for further replies.
Top