• 🏆 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] Help with simple boomerang spell.

Status
Not open for further replies.
Level 1
Joined
Mar 8, 2009
Messages
3
I'm fairly new at making spells, so please excuse the bad triggering :/
I am trying to make a simple boomerang spell that is MPI (doesn't have to be MUI).
What it's supposed to do is:
- Create a boomerang unit [with immolation] at the caster, which travels to the target point and returns to the caster after reaching it.

*"Giant Glaive [Group 1] is the main spell"
*"Giant Glaive [Projectile Dummy]" is the name of the boomerang unit.
*"Giant Glaive [Immolation Dummy] is the immolation spell given to the boomerang unit.
*"Giant Glaive [Recharge Dummy]" is what the main spell is replaced with while the boomerang unit is still traveling.

  • Giant Boomerang 1
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Giant Glaive [Group 1]
    • Actions
      • Set boomerangcastpt[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
      • Set boomerangtargpt[(Player number of (Owner of (Triggering unit)))] = (Target point of ability being cast)
      • Unit - Create 1 Giant Glaive [Projectile Dummy] for (Owner of (Triggering unit)) at (boomerangcastpt[(Player number of (Owner of (Triggering unit)))] offset by 100.00 towards (Angle from boomerangcastpt[(Player number of (Owner of (Triggering unit)))] to boomerangtargpt[(Player number of (Owner of (Triggering unit)))]) degrees) facing (Angle from boomerangcastpt[(Player number of (Owner of (Triggering unit)))] to boomerangtargpt[(Player number of (Owner of (Triggering unit)))]) degrees
      • Unit - Set level of Giant Glaive [Immolation Dummy] for (Last created unit) to (Level of Giant Glaive [Group 1] for (Triggering unit))
      • Special Effect - Create a special effect at (Position of (Last created unit)) using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
      • Set boomerangblink[(Player number of (Owner of (Triggering unit)))] = (Last created special effect)
      • Unit - Turn collision for (Last created unit) Off
      • Set boomerangunit[(Player number of (Owner of (Triggering unit)))] = (Last created unit)
      • Unit - Order (Last created unit) to Move To boomerangtargpt[(Player number of (Owner of (Triggering unit)))]
      • Unit Group - Add (Last created unit) to boomerangtempgroup
      • Unit - Remove Giant Glaive [Group 1] from (Triggering unit)
      • Unit - Add Giant Glaive [Recharge Dummy] to (Triggering unit)
      • Unit - Set level of Giant Glaive [Recharge Dummy] for (Triggering unit) to Class1Lvl[(Player number of (Owner of (Triggering unit)))]
      • Trigger - Turn on Giant Boomerang 2 <gen>
      • Wait 1.00 seconds
      • Special Effect - Destroy boomerangblink[(Player number of (Owner of (Triggering unit)))]
  • Giant Boomerang 2
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in boomerangtempgroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between (Position of (Picked unit)) and boomerangtargpt[(Player number of (Owner of (Picked unit)))]) Less than or equal to 20.00
            • Then - Actions
              • Unit - Move (Picked unit) instantly to (boomerangtargpt[(Player number of (Owner of (Picked unit)))] offset by 25.00 towards (Angle from boomerangtargpt[(Player number of (Owner of (Picked unit)))] to boomerangcastpt[(Player number of (Owner of (Picked unit)))]) degrees), facing Default building facing degrees
              • Unit - Order (Picked unit) to Move To boomerangcastpt[(Player number of (Owner of (Picked unit)))]
            • Else - Actions
      • Unit Group - Pick every unit in boomerangtempgroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between (Position of (Picked unit)) and boomerangcastpt[(Player number of (Owner of (Picked unit)))]) Less than or equal to 50.00
            • Then - Actions
              • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
              • Set boomerangblink[(Player number of (Owner of (Triggering unit)))] = (Last created special effect)
              • Unit - Kill (Picked unit)
              • Unit Group - Remove (Picked unit) from boomerangtempgroup
              • Custom script: call RemoveLocation(udg_boomerangcastpt[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
              • Custom script: call RemoveLocation(udg_boomerangtargpt[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
              • Unit - Remove Giant Glaive [Recharge Dummy] from TowerVar[(Player number of (Owner of (Picked unit)))]
              • Unit - Add Giant Glaive [Group 1] to TowerVar[(Player number of (Owner of (Picked unit)))]
              • Unit - Set level of Giant Glaive [Group 1] for TowerVar[(Player number of (Owner of (Picked unit)))] to Class1Lvl[(Player number of (Owner of (Picked unit)))]
              • Trigger - Turn off (This trigger)
              • Wait 1.00 seconds
              • Special Effect - Destroy boomerangblink[(Player number of (Owner of (Triggering unit)))]
            • Else - Actions
When more than one players casts it at the same time, the boomerang unit stops moving.
Can anyone tell me a better way to write this trigger? Thank you.

I hope you can understand that.
 
Status
Not open for further replies.
Top