• 🏆 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!

Need assistance with this trigger

Status
Not open for further replies.
Level 4
Joined
Aug 2, 2015
Messages
50
  • Count
    • Events
      • Unit - 0458 <gen> Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Demonic Vapor
    • Actions
      • Set VariableSet Vapor_I = (Vapor_I + 1)
      • Unit - Create (Random integer number between 8 and 10) Unyielding Dead for Player 21 (Coal) at (Position of (Damage Target)) facing Default building facing degrees
      • Region - Center Vapor_R on (Target point of ability being cast)
      • Special Effect - Create a special effect at (Center of Vapor_R) using war3mapImported\Toxic Air.mdx
      • Set VariableSet Vapor = (Last created special effect)
      • Trigger - Turn on Vapor tick <gen>
      • Trigger - Turn on Enter Vapor <gen>
      • Wait 10.00 seconds
      • Trigger - Turn off Vapor tick <gen>
      • Trigger - Turn off Enter Vapor <gen>
      • Special Effect - Destroy (Last created special effect)
I picked Breath of Frost as base skill, would maybe an aoe skill similar to Silence be a better choice?, as now noting happens.
Is the [Create unit] trigger rightly performed? Ive tried using [Event - Target position] also without success.
 
Last edited:
Level 13
Joined
May 10, 2009
Messages
868
Damage Target doesn't work with that event. It belongs to the "A unit Takes Damage".

Could you please post the "Vapor Tick" and "Enter Vapor" triggers? Also, use [trigger] code here [/trigger] tags. It's easier to read your code with them.

Example:

[trigger]
Melee Initialization
Events
Map initialization
Conditions
Actions
Melee Game - Enforce victory/defeat conditions (for all players)
[/trigger]

->

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Melee Game - Enforce victory/defeat conditions (for all players)
 
Level 4
Joined
Aug 2, 2015
Messages
50
Those triggers are kinda unrelevant but here goes

  • Setup 4
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet Vapor_R = Vapor <gen>
  • Enter Vapor
    • Events
      • Unit - A unit enters Vapor <gen>
    • Conditions
      • (Owner of (Entering unit)) Not equal to Player 21 (Coal)
    • Actions
      • Unit - Create (Random integer number between 1 and 3) Unyielding Dead for Player 21 (Coal) at (Position of (Entering unit)) facing Default building facing degrees
  • Vapor tick
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in Vapor <gen> matching ((Owner of (Matching unit)) Not equal to Player 21 (Coal))) and do (If ((Life of (Picked unit)) Greater than 0.00) then do (Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 200.00)) else do (Do nothing))
 
Level 13
Joined
May 10, 2009
Messages
868
Ive tried all kind of combinations :/
Thats why I began to wonder if the base skill is the black sheep here?
Am I right that BoF is just instant targetless skill, so if I change to silence im sorted?
Or would carrion swarm be my best choice?

If a player targets a unit with breath of fire, then "target unit of ability being cast" will point to such unit properly. However, if they click on a point, then "no unit" is returned, and position of "no unit" will probably return a non-existent location (null). IIRC, create unit action doesn't work if any of its first four parameters is invalid.

Use the point data instead - (Target point of ability being cast). Even if a player clicks on a unit, the game will still provide the correct location.
  • Set point = (Target point of ability being cast)
  • Unit - Create 1 Peasant for Player 21 (Coal) at point facing Default building facing degrees
  • Custom script: call RemoveLocation(udg_point)
Now, let's analyse your code, step by step.

1) Vapor_I isn't being used anywhere.
  • Set VariableSet Vapor_I = (Vapor_I + 1)
2) (Position of (Damage Target)) - Damage Target is invalid for that event, and a position of a null unit is a null point - this entire action probably doesn't work at all because of it. Use target point of ability being cast instead.
  • Unit - Create (Random integer number between 8 and 10) Unyielding Dead for Player 21 (Coal) at (Position of (Damage Target)) facing Default building facing degrees
3) Moving Vapor_R doesn't work with "A unit enters/leaves a region" events. Unfortunately, when the game starts, that type of event copies the original size and position of such regions and won't dynamically update their location anymore. So, Enter Vapor trigger doesn't work. The unit group action within vapor tick trigger will get the current position of Vapor_R though.
  • Region - Center Vapor_R on (Target point of ability being cast)
4) The special effect should be created normally at the center of Vapor_R. However, there's a problem regarding its destruction. The (Last created special effect) is only capable of storing only one special effect at a time (this applies to all triggers in your map which creates special effects).

On the other hand, destroying the effect stored in Vapor (the special effect variable) only affects effects created by Count trigger. Still, this doesn't solve the problem of multiple units casting this spell at once, because Vapor is still a variable that can hold only one special effect at a time, too.

We need to remake this trigger in order to handle multiple effects, spell target positions and when DoT triggers should start and stop working.
  • Special Effect - Create a special effect at (Center of Vapor_R) using war3mapImported\Toxic Air.mdx
  • Set VariableSet Vapor = (Last created special effect)
  • Wait 10.00 seconds
  • Special Effect - Destroy (Last created special effect)
5) The unit group enumeration in Vapor tick will affect any unit that doesn't belong to player 21. That is, buildings, magic immune, invulnerable, allies, etc...

The action applied to those units just reduces their life by 200 points, but if a unit is killed during this process, the game won't know who the killer is. If the caster is a hero, they won't earn any experience point. Use "Unit - Damage Target" function.
  • Vapor tick
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in Vapor <gen> matching ((Owner of (Matching unit)) Not equal to Player 21 (Coal))) and do (If ((Life of (Picked unit)) Greater than 0.00) then do (Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 200.00)) else do (Do nothing))
Overall, the solution would be to re-create your triggers entirely, taking into account leaks (mentioned by Uncle), multiple units casting the spell at once (if needed), and properly handling units/effects. Though, we need more information about how exactly your spell works.
 
Level 4
Joined
Aug 2, 2015
Messages
50
3) Moving Vapor_R doesn't work with "A unit enters/leaves a region" events. Unfortunately, when the game starts, that type of event copies the original size and position of such regions and won't dynamically update their location anymore. So, Enter Vapor trigger doesn't work. The unit group action within vapor tick trigger will get the current position of Vapor_R though.
  • Region - Center Vapor_R on (Target point of ability being cast)


Overall, the solution would be to re-create your triggers entirely, taking into account leaks (mentioned by Uncle), multiple units casting the spell at once (if needed), and properly handling units/effects. Though, we need more information about how exactly your spell works.

Ive changed the base skill to Carrion Swarm so now my main trigger functions like I want it. There is only
one unit in map with this skill, so no worries about multiphy.

Is there a way around it, to make "Enter Vapor" work properly?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
I wasn't sure how you wanted "Enter Vapor" to work exactly, so I created two sets of triggers. One without the Unyielding Dead, and one with what I think you wanted.
  • Cast Vapor
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Vapor
    • Actions
      • Set VariableSet Vapor_Point = (Target point of ability being cast)
      • Set VariableSet Vapor_Counter = 0
      • Special Effect - Create a special effect at Vapor_Point using Abilities\Spells\Other\AcidBomb\BottleImpact.mdl
      • Special Effect - Set Scale of (Last created special effect) to 2.25
      • Set VariableSet Vapor_Sfx = (Last created special effect)
      • Trigger - Turn on Vapor Tick <gen>
  • Vapor Tick
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 200.00 of Vapor_Point.) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
              • (Owner of (Picked unit)) Not equal to Player 21 (Coal)
            • Then - Actions
              • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\NightElf\Immolation\ImmolationDamage.mdl
              • Special Effect - Destroy (Last created special effect)
              • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 200.00)
            • Else - Actions
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Vapor_Counter Less than 9
        • Then - Actions
          • Set VariableSet Vapor_Counter = (Vapor_Counter + 1)
        • Else - Actions
          • -------- Vapor_Counter has reached 10 --- End the spell --------
          • Special Effect - Destroy Vapor_Sfx
          • Custom script: call RemoveLocation (udg_Vapor_Point)
          • Trigger - Turn off (This trigger)
Now here's what I think you wanted to do with "Enter Vapor". This will spawn "Unyielding Dead" on enemies inside of the Vapor cloud every single damage tick.
  • Vapor Tick with Unyielding Dead
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 200.00 of Vapor_Point.) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
              • (Owner of (Picked unit)) Not equal to Player 21 (Coal)
            • Then - Actions
              • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\NightElf\Immolation\ImmolationDamage.mdl
              • Special Effect - Destroy (Last created special effect)
              • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 200.00)
              • -------- --------
              • -------- This will spawn "Unyielding Dead" on enemies inside of the Vapor cloud --------
              • Set VariableSet Vapor_Point2 = (Position of (Picked unit))
              • Unit - Create (Random integer number between 1 and 3) Unyielding Dead for Player 21 (Coal) at Vapor_Point2 facing Default building facing degrees
              • Custom script: call RemoveLocation (udg_Vapor_Point2)
            • Else - Actions
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Vapor_Counter Less than 9
        • Then - Actions
          • Set VariableSet Vapor_Counter = (Vapor_Counter + 1)
        • Else - Actions
          • -------- Vapor_Counter has reached 10 --- End the spell --------
          • Special Effect - Destroy Vapor_Sfx
          • Custom script: call RemoveLocation (udg_Vapor_Point)
          • Trigger - Turn off (This trigger)

In the test map I disabled the Unyielding Dead triggers by default, so if you want to test them out then Enable them. Just make sure to disable the non-Unyielding Dead triggers so both sets of triggers don't go off at the same time.
 

Attachments

  • Vapor Example.w3m
    19.4 KB · Views: 22
Last edited:
Level 4
Joined
Aug 2, 2015
Messages
50
Works perfectly!, cheers for that.

If I may ask one last thing I need looked that... :)

Boss does its final move:
  • Vapor done
    • Events
      • Unit - Hive 0458 <gen> Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Demonic Vapor
      • Vapor_I Greater than or equal to 2
    • Actions
      • Wait 1.00 seconds
      • Unit - Remove Demonic Vapor from Hive 0458 <gen>
      • Set VariableSet Vapor_I = 0
      • Wait 10.00 seconds
      • Set VariableSet Random_01 = (Random integer number between 1 and 1)
      • Set VariableSet Random_01 = (Random integer number between 1 and 4)
      • Trigger - Run Fog <gen> (ignoring conditions)
      • Trigger - Turn on Enter Fog1 <gen>
      • Wait 5.00 seconds
      • Wait 5.00 seconds
      • Trigger - Turn off Enter Fog1 <gen>
      • Wait 1.00 seconds
      • Animation - Change Hive 0458 <gen> flying height to 90.00 at 150.00
      • Wait 1.00 seconds
      • Unit - Set Unit: Hive 0458 <gen>'s Integer Field: Targeted as ('utar') to Value: 2
      • Unit - Remove Cargo Hold (Orc Burrow) from Hive 0458 <gen>
(Reason I have both random interger 1-1, 1-4 is cus its still in test phase, 1-4 is cancled.)
 
Level 4
Joined
Aug 2, 2015
Messages
50
  • Fog
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Random_01 Equal to 1
        • Then - Actions
          • Special Effect - Create a special effect at (Center of Fog1 <gen>) using war3mapImported\Toxic Air.mdx
          • Special Effect - Set Scale of (Last created special effect) to 6.00
          • Set VariableSet Fog1 = (Last created special effect)
          • Wait 5.00 seconds
          • Wait 5.00 seconds
          • Special Effect - Destroy Fog1
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Random_01 Equal to 2
        • Then - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Random_01 Equal to 3
        • Then - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Random_01 Equal to 4
        • Then - Actions
        • Else - Actions
  • Enter Fog1
    • Events
      • Unit - A unit enters Fog1 <gen>
    • Conditions
      • (Owner of (Entering unit)) Not equal to Player 21 (Coal)
      • ((Entering unit) is A Hero) Equal to False
    • Actions
      • Unit - Change ownership of (Entering unit) to Player 21 (Coal) and Change color
      • Unit - Set Base Damage of (Entering unit) to ((Base Damage of (Entering unit) for weapon index 0) x 5) for weapon index: 0
Most things works as intended, but why doesnt "Enter fog1" trigger work?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
I'm assuming those triggers are actually finished.

Anyway, I don't think units will fire the "A unit enters region" event if they're already standing in the region when it's turned on. I'm not entirely sure though.

I'd have to see your map to figure out why it's not working.

That being said, I generally avoid regions for interactions like these.
1) regions are square while pretty much every AoE in the game is based on a circular radius
2) by default they don't work properly for things like "Region contains unit" (a bug Blizzard should've fixed 15 years ago) --- I post about a solution here: [code=jass] - Region to rect
3) Other issues like Move Region not working properly, it's just not designed well

You can use a periodic loop to achieve the same effect:
Every 0.03 seconds -> pick every unit within X range of point -> if picked unit is not a Hero and not owned by Player 21 then change it's owner/set base damage

Turn it on when the ability starts and off again when the ability ends.
 
Status
Not open for further replies.
Top