• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] or [JASS] - Magnet Tower [Advanced Triggering]

Status
Not open for further replies.
Level 8
Joined
Aug 19, 2006
Messages
185
Hi, I tried so hard to make a MUI-GUI spell that pulls nearby enemy units to a tower. Pulled units gains a buff called "Notr" lasts 10 seconds. So same units will not be pulled again. I write 4 different triggers.

First one stores the summoned towers.
Second one orders them to cast a dummy spell every 1 second that triggers third trigger.
Third one picks all units around tower that matches conditions when dummy spell casted.
And Fourd one is supposed to pull the units.

But I can't get them work. I will show my triggers maybe you can figure out what is wrong. If you can you get +Rep, If you create it in JASS, you get +Rep and +Credits in my map.

  • Electrostatic
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoned unit)) Equal to Electrostatic Trap
    • Actions
      • Set ES_MUI = (ES_MUI + 1)
      • Set ES_Dummy[ES_MUI] = (Summoned unit)
  • Electrostatic Casts
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to ES_MUI, do (Actions)
        • Loop - Actions
          • Unit - Order ES_Dummy[(Integer A)] to Night Elf Mountain Giant - Taunt
  • Electrostatic Pull
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Electrostatic Cast
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 800.00 of (Position of (Casting unit)) matching ((ESE_Pulling[(Custom value of (Matching unit))] Equal to False) and (((((Matching unit) is alive) Equal to True) and (((Matching unit) has buff Notr ) Equal to False)) and (((Matching unit) belong and do (Actions)
        • Loop - Actions
          • Set ESE_MUI = (ESE_MUI + 1)
          • Set ESE_PullUnit[ESE_MUI] = (Picked unit)
          • Set ESE_Pulling[ESE_MUI] = True
          • Set ESE_EnemyPoint[ESE_MUI] = (Position of ESE_PullUnit[ESE_MUI])
          • Set ESE_Trap[ESE_MUI] = (Casting unit)
          • Set ESE_Point[ESE_MUI] = (Position of ESE_Trap[ESE_MUI])
          • Unit - Create 1 Dummy for (Owner of (Casting unit)) at ESE_EnemyPoint[ESE_MUI] facing Default building facing degrees
          • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
          • Unit - Order (Last created unit) to Night Elf Druid Of The Talon - Faerie Fire (Picked unit)
          • Unit - Create 1 Dummy for (Owner of (Casting unit)) at ESE_EnemyPoint[ESE_MUI] facing Default building facing degrees
          • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
          • Unit - Order (Last created unit) to Neutral Pandaren Brewmaster - Drunken Haze (Picked unit)
          • Unit - Turn collision for ESE_PullUnit[(Integer A)] Off
  • Electrostatic Pull Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to ESE_MUI, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (ESE_PullUnit[(Integer A)] has buff Pull ) Equal to True
            • Then - Actions
              • Game - Display to (All players) the text: part1
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Integer((Distance between ESE_EnemyPoint[(Integer A)] and ESE_Point[(Integer A)]))) Greater than 150
                • Then - Actions
                  • Game - Display to (All players) the text: part2
                  • Set ESE_EnemyPoint[(Integer A)] = (Position of ESE_PullUnit[(Integer A)])
                  • Set ESE_Real[(Integer A)] = (ESE_Real[(Integer A)] + 0.20)
                  • Unit - Move ESE_PullUnit[(Integer A)] instantly to (ESE_EnemyPoint[(Integer A)] offset by (Power(ESE_Real[(Integer A)], 2.00)) towards ((Angle from ESE_Point[(Integer A)] to ESE_EnemyPoint[(Integer A)]) + 180.00) degrees)
                • Else - Actions
                  • Game - Display to (All players) the text: else2
                  • Unit - Cause ESE_Trap[(Integer A)] to damage ESE_PullUnit[(Integer A)], dealing 10.00 damage of attack type Spells and damage type Normal
                  • Special Effect - Create a special effect attached to the origin of ESE_PullUnit[(Integer A)] using Abilities\Weapons\Bolt\BoltImpact.mdl
                  • Unit - Turn collision for ESE_PullUnit[(Integer A)] On
                  • Unit - Remove Pull buff from ESE_PullUnit[(Integer A)]
                  • Set ESE_Trap[(Integer A)] = No unit
                  • Set ESE_Real[(Integer A)] = 0.00
                  • Set ESE_PullUnit[(Integer A)] = No unit
                  • Custom script: call RemoveLocation (udg_ESE_EnemyPoint[GetForLoopIndexA()])
                  • Custom script: call RemoveLocation (udg_ESE_Point[GetForLoopIndexA()])
            • Else - Actions
              • Unit - Turn collision for ESE_PullUnit[(Integer A)] On
              • Set ESE_Trap[(Integer A)] = No unit
              • Set ESE_Real[(Integer A)] = 0.00
              • Set ESE_PullUnit[(Integer A)] = No unit
              • Custom script: call RemoveLocation (udg_ESE_EnemyPoint[GetForLoopIndexA()])
              • Custom script: call RemoveLocation (udg_ESE_Point[GetForLoopIndexA()])
 
Level 8
Joined
Oct 28, 2007
Messages
435
You should update your stack when your done, by swapping the current unit with the last unit in your ESE_MUI stack and then reducing ESE_MUI by 1 for starters. Your also leaking a point when you refer to offset of point....and you should destroy your special effects after creation so it doesn't leak. I will create it if you can wait till the weekend.
 
Level 8
Joined
Aug 19, 2006
Messages
185
It would be very good, I can wait. Because i spend hours on these triggers and they just don't work.

I almost forgot. I heard there is a different move system in JASS that does not interrupt the orders of unit. So you can cast spells or move while siliding. If you can do it, it will be perfect! Thanks.
 
Level 19
Joined
Sep 4, 2007
Messages
2,826
It would be very good, I can wait. Because i spend hours on these triggers and they just don't work.

I almost forgot. I heard there is a different move system in JASS that does not interrupt the orders of unit. So you can cast spells or move while siliding. If you can do it, it will be perfect! Thanks.

Here is an example you could look at but sadly it does interrupt commands. Anyway I made this for a space map I made a couple of months ago but I can't seem to figure out how to make it leakless again...

Edit: Original map.
 

Attachments

  • Gravity.w3x
    13.6 KB · Views: 62
Level 8
Joined
Aug 19, 2006
Messages
185
  • Custom script: call SetUnitX(GetEnumUnit(), GetUnitX(GetEnumUnit()) + udg_Int_Currentspeed[GetPlayerId(GetOwningPlayer(GetEnumUnit()))+1] * Cos(GetUnitFacing(GetEnumUnit()) * bj_DEGTORAD))
  • Custom script: call SetUnitY(GetEnumUnit(), GetUnitY(GetEnumUnit()) + udg_Int_Currentspeed[GetPlayerId(GetOwningPlayer(GetEnumUnit()))+1] * Sin(GetUnitFacing(GetEnumUnit()) * bj_DEGTORAD))
I searched for move unit without interrupting orders and found this. But I don't know JASS. Is there anyone can optimize this to my triggers?
 
Level 8
Joined
Oct 28, 2007
Messages
435
  • Custom script: call SetUnitX(GetEnumUnit(), GetUnitX(GetEnumUnit()) + udg_Int_Currentspeed[GetPlayerId(GetOwningPlayer(GetEnumUnit()))+1] * Cos(GetUnitFacing(GetEnumUnit()) * bj_DEGTORAD))
  • Custom script: call SetUnitY(GetEnumUnit(), GetUnitY(GetEnumUnit()) + udg_Int_Currentspeed[GetPlayerId(GetOwningPlayer(GetEnumUnit()))+1] * Sin(GetUnitFacing(GetEnumUnit()) * bj_DEGTORAD))
I searched for move unit without interrupting orders and found this. But I don't know JASS. Is there anyone can optimize this to my triggers?

You can but that will be indirectly....btw it will be faster to store the X and Y positions along with the X and Y velocity instead of calculating the X and Y velocity constantly. Note that this code is NOT mui...it is PUI....
 
Level 8
Joined
Oct 28, 2007
Messages
435
lawl....that explains :D

EDIT:
Do I have to use your taunt or can I do it somewhat different?

EDIT 2:
Okay I done a system halfway then realized I'm having way to much stored data....and all my structs are really unneeded if you make the speed constant? may I?
 
Last edited:
Status
Not open for further replies.
Top