• 🏆 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] Teleport and Cast System for a Boss

Level 16
Joined
Feb 28, 2016
Messages
684
Hello, I would like to ask about the way this system works.
So, this is a boss fight that I would like to implement for a level. I'm not looking to do anything more complicated yet, this is just the basic outline of what I would like to do. I would like to know if these actions are correct and would perform the way I imagine it to be (the doubted actions are below the comments): (Note: There's no base event here because it is looped by another trigger in the level)

1. DifficultyRating is an integer used to define the difficulty in the level. This integer was selected from the first level and loaded over to the next maps. What I did here was converting that integer to real, and subtract the 3.00 second real value with the DifficultyRating. So, if for example the DifficultyRating is 2, will changing it to a real value subtract the second?

2. For this one, I was imagining that the boss would teleport to a random area, then from there, cast Carrion Swarm to the position of a random unit owned by the player with the condition that the unit is within the range of Carrion Swarm's default cast range which is 700.00 (so in the bossfight, it will have troops as well so the goal is to just target a random one of those every set period). However, I do not feel confident about the matching condition yet. The ability, too, it casts Carrion Swarm (Neutral Hostile) but the only available one in issuing the order is Undead - Dreadlord - Carrion Swarm, not sure if it's right.

  • TeleportAraj
    • Events
    • Conditions
    • Actions
      • Set TeleportAraj = (Random integer number between 1 and 3)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TeleportAraj Equal to 1
        • Then - Actions
          • Special Effect - Create a special effect at (Position of Araj) using Abilities\Spells\Items\AIil\AIilTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit - Hide Araj
          • Unit - Pause Araj
          • Wait 0.01 seconds
          • Unit - Move Araj instantly to (Center of ArajTeleport01 <gen>), facing 360.00 degrees
          • -------- 1. Is this the right way to reduce time by an assigned difficulty rating? --------
          • Wait (3.00 - (Real(DifficultyRating))) seconds
          • Special Effect - Create a special effect at (Center of ArajTeleport01 <gen>) using Abilities\Spells\Items\AIil\AIilTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit - Unhide Araj
          • Animation - Play Araj's stand channel animation
          • Unit - Create 1 Dummy Carrion Swarm for Player 7 (Green) at (Position of Araj) facing Default building facing degrees
          • Set DummySwarm = (Last created unit)
          • -------- 2. Is this the right way to say it? --------
          • Unit - Order DummySwarm to Undead Dreadlord - Carrion Swarm (Position of (Random unit from (Units owned by P01_Blue matching ((Distance between (Position of DummySwarm) and (Position of (Matching unit))) Less than or equal to 700.00))))
          • Wait 1.00 seconds
          • Animation - Reset Araj's animation
          • Unit - Unpause Araj
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TeleportAraj Equal to 2
        • Then - Actions
          • Special Effect - Create a special effect at (Position of Araj) using Abilities\Spells\Items\AIil\AIilTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit - Hide Araj
          • Unit - Pause Araj
          • Wait 0.01 seconds
          • Unit - Move Araj instantly to (Center of ArajTeleport02 <gen>), facing 360.00 degrees
          • -------- 1. Is this the right way to reduce time by an assigned difficulty rating? --------
          • Wait (3.00 - (Real(DifficultyRating))) seconds
          • Special Effect - Create a special effect at (Center of ArajTeleport02 <gen>) using Abilities\Spells\Items\AIil\AIilTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit - Unhide Araj
          • Animation - Play Araj's stand channel animation
          • Unit - Create 1 Dummy Carrion Swarm for Player 7 (Green) at (Position of Araj) facing Default building facing degrees
          • Set DummySwarm = (Last created unit)
          • -------- 2. Is this the right way to say it? --------
          • Unit - Order DummySwarm to Undead Dreadlord - Carrion Swarm (Position of (Random unit from (Units owned by P01_Blue matching ((Distance between (Position of DummySwarm) and (Position of (Matching unit))) Less than or equal to 700.00))))
          • Wait 1.00 seconds
          • Animation - Reset Araj's animation
          • Unit - Unpause Araj
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TeleportAraj Equal to 3
        • Then - Actions
          • Special Effect - Create a special effect at (Position of Araj) using Abilities\Spells\Items\AIil\AIilTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit - Hide Araj
          • Unit - Pause Araj
          • Wait 0.01 seconds
          • Unit - Move Araj instantly to (Center of ArajTeleport03 <gen>), facing 360.00 degrees
          • -------- 1. Is this the right way to reduce time by an assigned difficulty rating? --------
          • Wait (3.00 - (Real(DifficultyRating))) seconds
          • Special Effect - Create a special effect at (Center of ArajTeleport03 <gen>) using Abilities\Spells\Items\AIil\AIilTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Animation - Play Araj's stand channel animation
          • Unit - Unhide Araj
          • Unit - Create 1 Dummy Carrion Swarm for Player 7 (Green) at (Position of Araj) facing Default building facing degrees
          • Set DummySwarm = (Last created unit)
          • -------- 2. Is this the right way to say it? --------
          • Unit - Order DummySwarm to Undead Dreadlord - Carrion Swarm (Position of (Random unit from (Units owned by P01_Blue matching ((Distance between (Position of DummySwarm) and (Position of (Matching unit))) Less than or equal to 700.00))))
          • Wait 1.00 seconds
          • Animation - Reset Araj's animation
          • Unit - Unpause Araj
        • Else - Actions
Now, I understand that the triggers may look basic, but I would like to know if there is a way to say it correctly from that position, if there is a different issue order I should use, OR if there are alternative functions that can make the system look cleaner. Although, I would love if there is a better way of saying it.

Thank you.
 
Level 26
Joined
Sep 26, 2009
Messages
2,416
In short:
#1 subtracting DifficultyRating will work the way you have it

#2 That will work. Most abilities (basically everything but item abilities) have an 'order'. Some abilities share the 'order', one of them is Carrion Swarm from Dreadlord and its Neutral Hostile versions. But same applies for example to Paladin's Holy Light and its neutral hostile versions, etc.

---
There are some other things in your trigger worth mentioning:
#1 You leak a lot of locations and unit group, see Things That Leak. The leaking unit group is:
"(Random unit from (Units owned by P01_Blue matching ((Distance between (Position of DummySwarm) and (Position of (Matching unit)))"

#2 Waits are not accurate. For example in my few tests a wait of 1.00 was actually waiting somewhere between 1.1 and 1.35 seconds.
I imagine you want accurate waits. In that case you will need to split the trigger into two: First part happens before wait and starts a countdown timer. Second trigger has an event "Timer has expired" and continues on.

#3 This wait is not really needed:
  • Unit - Hide Araj
  • Unit - Pause Araj
  • Wait 0.01 seconds
  • Unit - Move Araj instantly to (Center of ArajTeleport02 <gen>), facing 360.00 degrees
Pausing and hiding unit happens instantly, there is no need to wait .01 seconds before moving Araj.

#4 Overall structure of the trigger can be simplified.
From what I see, the only reason you have those 3 If/Then/Else blocks over TeleportAraj is to determine whether you teleport Araj to ArajTeleport01 ArajTeleport02 or ArajTeleport03. Everything else is the same.

So you can create a region variable and just assign different region to it based on value of TeleportAraj, or you can put all three regions into a Region variable array at map initialization and have it like this:
  • Map Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet ArajTeleportRegions[1] = ArajTeleport01 <gen>
      • Set VariableSet ArajTeleportRegions[2] = ArajTeleport02 <gen>
      • Set VariableSet ArajTeleportRegions[3] = ArajTeleport03 <gen>
  • TeleportAraj
    • Events
    • Conditions
    • Actions
      • Set TeleportAraj = (Random integer number between 1 and 3)
      • Special Effect - Create a special effect at (Position of Araj) using Abilities\Spells\Items\AIil\AIilTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Unit - Hide Araj
      • Unit - Pause Araj
      • Wait 0.01 seconds
      • Unit - Move Araj instantly to (Center of ArajTeleportRegions[TeleportAraj]), facing 360.00 degrees
      • -------- 1. Is this the right way to reduce time by an assigned difficulty rating? --------
      • Wait (3.00 - (Real(DifficultyRating))) seconds
      • Special Effect - Create a special effect at (Center of ArajTeleportRegions[TeleportAraj]) using Abilities\Spells\Items\AIil\AIilTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Unit - Unhide Araj
      • Animation - Play Araj's stand channel animation
      • Unit - Create 1 Dummy Carrion Swarm for Player 7 (Green) at (Position of Araj) facing Default building facing degrees
      • Set DummySwarm = (Last created unit)
      • -------- 2. Is this the right way to say it? --------
      • Unit - Order DummySwarm to Undead Dreadlord - Carrion Swarm (Position of (Random unit from (Units owned by P01_Blue matching ((Distance between (Position of DummySwarm) and (Position of (Matching unit))) Less than or equal to 700.00))))
      • Wait 1.00 seconds
      • Animation - Reset Araj's animation
      • Unit - Unpause Araj
 
Level 16
Joined
Feb 28, 2016
Messages
684
Hey, that's quite a comprehensive explanation!

I imagine you want accurate waits.

Well, in reality I was trying to figure out if I create a special effect at the position of the unit and move the unit instantly, the special effect would still stay in that location or not even if the unit is moved instantly at the same time. But, what you described is helpful too!
 
Level 16
Joined
Feb 28, 2016
Messages
684
There's another trouble I need help with:

So this is roughly the last part of the boss where he summons a barrage of Carrion Swarms. I would like to do it exactly like the TeleportAraj trigger which worked, but for some reason, it does not work here. Here is the trigger and the comparison (top is TeleportAraj, the one that works):

  • TeleportAraj
    • Events
    • Conditions
    • Actions
      • Set TeleportAraj = (Random integer number between 1 and 3)
      • Set loc = (Position of Araj)
      • Special Effect - Create a special effect at loc using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_loc)
      • Unit - Hide Araj
      • Unit - Pause Araj
      • Wait 0.01 seconds
      • Set loc = (Center of ArajTeleportRegions[TeleportAraj])
      • Unit - Move Araj instantly to (Center of ArajTeleportRegions[TeleportAraj]), facing ArajDirection[TeleportAraj] degrees
      • Custom script: call RemoveLocation(udg_loc)
      • Wait (3.00 - (Real(DifficultyRating))) seconds
      • Set loc = (Center of ArajTeleportRegions[TeleportAraj])
      • Special Effect - Create a special effect at loc using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_loc)
      • Unit - Unhide Araj
      • Animation - Play Araj's stand channel animation
      • Set loc = (Position of Araj)
      • Unit - Create 1 Dummy Carrion Swarm for Player 7 (Green) at loc facing Default building facing degrees
      • Set DummySwarm = (Last created unit)
      • Unit - Hide DummySwarm
      • Set GroupVar = (Units owned by P01_Blue matching ((Distance between (Position of DummySwarm) and (Position of (Matching unit))) Less than or equal to 800.00))
      • Unit - Order DummySwarm to Undead Dreadlord - Carrion Swarm (Position of (Random unit from GroupVar))
      • Custom script: call RemoveLocation(udg_loc)
      • Custom script: call DestroyGroup(udg_GroupVar)
      • Wait 1.00 seconds
      • Unit - Remove DummySwarm from the game
      • Animation - Reset Araj's animation
      • Unit - Unpause Araj

And here is the trigger that I have a problem with:

  • WavesFirstCast
    • Events
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • Set loc = (Position of Araj)
      • Unit - Create 1 Dummy Carrion Swarm for Player 7 (Green) at loc facing Default building facing degrees
      • Set DummySwarm = (Last created unit)
      • Unit - Hide DummySwarm
      • Set GroupVar = (Units owned by P01_Blue matching ((Distance between (Position of DummySwarm) and (Position of (Matching unit))) Less than or equal to 800.00))
      • Unit - Order DummySwarm to Undead Dreadlord - Carrion Swarm (Position of (Random unit from GroupVar))
      • Custom script: call RemoveLocation(udg_loc)
      • Custom script: call DestroyGroup(udg_GroupVar)
      • Wait 0.01 seconds
      • Unit - Remove DummySwarm from the game
      • Wait (2.25 - (Real(DifficultyRating))) seconds
      • Unit - Create 1 Dummy Carrion Swarm for Player 7 (Green) at loc facing Default building facing degrees
      • Set DummySwarm = (Last created unit)
      • Unit - Hide DummySwarm
      • Set GroupVar = (Units owned by P01_Blue matching ((Distance between (Position of DummySwarm) and (Position of (Matching unit))) Less than or equal to 800.00))
      • Unit - Order DummySwarm to Undead Dreadlord - Carrion Swarm (Position of (Random unit from GroupVar))
      • Custom script: call RemoveLocation(udg_loc)
      • Custom script: call DestroyGroup(udg_GroupVar)
      • Wait 0.01 seconds
      • Unit - Remove DummySwarm from the game
      • Wait (2.25 - (Real(DifficultyRating))) seconds
      • Set loc = (Position of Araj)
      • Unit - Create 1 Dummy Carrion Swarm for Player 7 (Green) at loc facing Default building facing degrees
      • Set DummySwarm = (Last created unit)
      • Unit - Hide DummySwarm
      • Set GroupVar = (Units owned by P01_Blue matching ((Distance between (Position of DummySwarm) and (Position of (Matching unit))) Less than or equal to 800.00))
      • Unit - Order DummySwarm to Undead Dreadlord - Carrion Swarm (Position of (Random unit from GroupVar))
      • Custom script: call RemoveLocation(udg_loc)
      • Custom script: call DestroyGroup(udg_GroupVar)
      • Trigger - Turn on CastUndeadHordeWaves <gen>
      • Wait 0.01 seconds
      • Set StopCombat = False
      • Unit - Remove DummySwarm from the game
      • Unit - Make Araj Vulnerable
      • Unit - Unpause Araj
He'll first teleport to a specified point which already works, but it's the Carrion Swarm that doesn't.
 
Level 26
Joined
Sep 26, 2009
Messages
2,416
Do not use "Unit - Hide DummySwarm" as that prevents the unit from interacting with anything in the game.
If you want your dummy unit to be invisible, set its object editor data "Art - Model File" to "none" (or "none.mdl"). In abilities, give the unit the "Locust" ability - that makes the unit unselectable by player.
 
Top