• 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.

[Trigger] Still got a little problem in MUI spell

Status
Not open for further replies.
Level 19
Joined
Apr 21, 2013
Messages
1,194
Still got a little problem in MUI spell[solved]

Hey guys, I was working on a projectile system and trying to makeit MUI i think i was successful but just a little problem is still present.

When two or more casters throw the arrow at the same spot only the first one damages the units the others just pass without damaging them.



  • Spell2 Execution
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Spell2
    • Actions
      • Set Sp_Index = (Sp_Index + 1)
      • Custom script: set udg_Sp_TreeDestroyer = CreateUnit (Player(15), 'hpea', 0,0,0)
      • Custom script: call UnitAddAbility(udg_Sp_TreeDestroyer, 'Aloc')
      • Unit - Hide Sp_TreeDestroyer
      • Set Sp_Caster[Sp_Index] = (Triggering unit)
      • Set Sp_Counter[Sp_Index] = 0.00
      • Set tempLoc1 = (Position of Sp_Caster[Sp_Index])
      • Set tempLoc2 = (Target point of ability being cast)
      • Set Sp_Angle[Sp_Index] = (Angle from tempLoc1 to tempLoc2)
      • Unit - Create 1 Dummy for (Owner of Sp_Caster[Sp_Index]) at tempLoc1 facing Sp_Angle[Sp_Index] degrees
      • Set Sp_Dummy[Sp_Index] = (Last created unit)
      • Custom script: set udg_Sp_DamageGroup[udg_Sp_Index] = CreateGroup()
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Sp_Index Equal to 1
        • Then - Actions
          • Trigger - Turn on Spell2 Loop <gen>
        • Else - Actions


  • Spell2 Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Sp_LoopInteger) from 1 to Sp_Index, do (Actions)
        • Loop - Actions
          • Set tempLoc2 = (Position of Sp_Dummy[Sp_LoopInteger])
          • Set tempLoc1 = (tempLoc2 offset by (1500.00 x 0.03) towards Sp_Angle[Sp_LoopInteger] degrees)
          • Custom script: call SetUnitX( udg_Sp_Dummy[udg_Sp_LoopInteger], GetLocationX(udg_tempLoc1) )
          • Custom script: call SetUnitY( udg_Sp_Dummy[udg_Sp_LoopInteger], GetLocationY(udg_tempLoc1) )
          • Set Sp_Counter[Sp_LoopInteger] = (Sp_Counter[Sp_LoopInteger] + (1500.00 x 0.03))
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 100.00 of tempLoc1) and do (Actions)
            • Loop - Actions
              • Set tempUnit = (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (tempUnit is dead) Equal to False
                  • (tempUnit is A structure) Equal to False
                  • (tempUnit is in Sp_DamageGroup[Sp_LoopInteger]) Equal to False
                  • (tempUnit belongs to an ally of (Owner of Sp_Caster[Sp_LoopInteger])) Equal to False
                • Then - Actions
                  • Unit - Cause Sp_Dummy[Sp_LoopInteger] to damage tempUnit, dealing 150.00 damage of attack type Pierce and damage type Acid
                  • Special Effect - Create a special effect attached to the overhead of tempUnit using Objects\Spawnmodels\Human\HumanBlood\BloodElfSpellThiefBlood.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Sound - Play MetalHeavyChopFlesh1 <gen> at 100.00% volume, located at (Position of tempUnit) with Z offset 0.00
                  • Unit Group - Add tempUnit to Sp_DamageGroup[Sp_LoopInteger]
                • Else - Actions
          • Destructible - Pick every destructible within 100.00 of tempLoc1 and do (Actions)
            • Loop - Actions
              • -------- Save Destruc to a variable --------
              • Set tempDestructible = (Picked destructible)
              • -------- Order the harvester we made in the SetUp trigger to attempt to harvest this destructible --------
              • Unit - Order Sp_TreeDestroyer to Harvest tempDestructible
              • -------- Kill that destructible --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Current order of Sp_TreeDestroyer) Equal to (Order(harvest))
                • Then - Actions
                  • -------- If the unit can actually harvest this destructible (aka its a tree) --------
                  • Destructible - Kill tempDestructible
                • Else - Actions
              • -------- Order the unit to stop because it doesn't need to keep harvesting --------
              • Unit - Order Sp_TreeDestroyer to Stop
          • Special Effect - Create a special effect at tempLoc1 using Abilities\Spells\Other\BlackArrow\BlackArrowMissile.mdl
          • Set spc = (Last created special effect)
          • Trigger - Run SPX Destruction <gen> (ignoring conditions)
          • Custom script: call RemoveLocation(udg_tempLoc1)
          • Custom script: call RemoveLocation(udg_tempLoc2)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Sp_Counter[Sp_LoopInteger] Greater than or equal to 1000.00
            • Then - Actions
              • Unit - Kill Sp_Dummy[Sp_LoopInteger]
              • Special Effect - Destroy spc
              • Set Sp_Caster[Sp_LoopInteger] = Sp_Caster[Sp_Index]
              • Set Sp_Counter[Sp_LoopInteger] = Sp_Counter[Sp_Index]
              • Set Sp_Angle[Sp_LoopInteger] = Sp_Angle[Sp_Index]
              • Set Sp_Dummy[Sp_LoopInteger] = Sp_Dummy[Sp_Index]
              • Set Sp_Index = (Sp_Index - 1)
              • Set Sp_LoopInteger = (Sp_LoopInteger - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Sp_Index Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions


  • SPX Destruction
    • Events
    • Conditions
    • Actions
      • -------- You can use this to show the effect a little longer --------
      • Custom script: local effect tempEffect
      • Custom script: set tempEffect = udg_spc
      • Wait 1.50 game-time seconds
      • Custom script: set udg_spc = tempEffect
      • Special Effect - Destroy spc


These are all the triggers. The spell's working fine except that issue. I guess it's a part i did wrong in the damagegroup unit picking loop but I couldn't find any solution :S

Any help is needed and appreciated :)
 
Last edited:
Status
Not open for further replies.
Top