Fly Trap Spell; need help

bananaHUNT

You can change this now in User CP
Reaction score
55
I've got this idea for a spell: An AoE targetable spell that sets up a 'fly trap'. Enemy units that enter the AoE, cannot go out for the duration of the spell (but they can walk around in it normally). Allied units can walk through it like it is not even there.

But.. I have no idea how to do this; can anyone help? I know a bit of GUI, but dont understand JASS.
 

Charapanga

New Member
Reaction score
46
What you do is, pick every enemy(boolean comparisson) unit within X(all units within range matching condition) of Targeted Point then create a dummy that casts a modified entangling roots on them(picked unit)...
 

Beetlebomb

New Member
Reaction score
43
Do you want it to lay the trap and then go off later of lay the trap and go off immediately?(or both)


Having it go off immediately can be easy, but having it go off later is challenging. I can't think of a way to do it in GUI that would make it MUI...wait...yes i can(BRAINSTORM!).

Make invisible dummies and run a timer expiration event that checks every so often on if there's a flying unit present and then do whatever you will to happen.

If you need help with doing that, let me know.

Give it a try first ^^

Beetlebomb
 

bananaHUNT

You can change this now in User CP
Reaction score
55
Thanks for your replies but entangling roots wont work, because the units can move freely within the trap, just not outside the aoe. Here is a picture:
flytrapeo9.png

How could i make like pathing blockers only for enemy units?
 

Genkora

Frog blast the vent core!
Reaction score
92
I have no idea how you could do it the way you want. You could make a dummy unit cast a bunch of invisible invulnerable wards around a point using polar offsets, but that would restrict allied units as well. Using the same polar offset idea, you could maybe move any enemy unit that goes so far from the middle point backwards a little bit. Like, it tries to leave, and then a trigger moves it instantly back inside. hang on, let me try and make something that might work.
 

Romek

Super Moderator
Reaction score
964
You could try making 360 rects around the circle, then adding them all to a region.
If an ally enters the region, disable pathing.
If an ally leaves it, enable pathing.
If an enemy enters, do nothing.

You'd need to make the pathing blockers this way too. :)
 

Genkora

Frog blast the vent core!
Reaction score
92
Sorry, it seems a bit out of my league on this one. I couldn't fit the right pieces together.
 

Azlier

Old World Ghost
Reaction score
461
I suggest a script that, with a timer, sets the affected units to units within range of the ward. And then it checks if the affected group is further away from the ward than they should be. If so, pull them back a distance of about ten towards the ward. It certainly seems plausible... I've done the very opposite, the pushing away of units from a point. Mine has some extra functions to check if the unit is undead or not, and the enemy only thing is done within Targets Allowed. Here's a demo map. No terrain or anything, only a paladin, a random race's starting units, and some testing undead. Sanctuary Aura is cloned from Devotion Aura :p. Say nothing about the name, its a work in progress. Note: requires NewGen.

View attachment 27373
 

bananaHUNT

You can change this now in User CP
Reaction score
55
I have now set up the trap, but it's fully closed atm. Now I need something to let allies enter and leave without problems, and let enemies enter, but not leave for the duration of the trap.
 

bananaHUNT

You can change this now in User CP
Reaction score
55
Ok, I changed the whole thing. First I set up doodads in a circle and tried to make it pathable - but that didn't work too well. Now I have something more easier, like azlier suggested. I still have a problem though, here are my triggers:

the first one is where the trap is set up (enlarged Ensnare model)
Code:
FT1
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Fly Trap 
    Actions
        Set ItCaster[CV] = (Casting unit)
        Set ItTargetPt[CV] = (Target point of ability being cast)
        Unit - Create 1 FlyTrap (2) for (Owner of ItCaster[CV]) at ItTargetPt[CV] facing ItTargetPt[CV]
        Set ItTrap[CV] = (Last created unit)
        Unit - Add a (5.00 x (Real((Level of Fly Trap  for ItCaster[CV])))) second Generic expiration timer to ItTrap[CV]

here it checks if a unit is at the border of the trap and then sends it back in.
Code:
FT2
    Events
        Time - Every 0.01 seconds of game time
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Playable map area) contains ItTrap[CV]) Equal to True
            Then - Actions
                Unit Group - Pick every unit in (Units within 300.00 of (Position of ItTrap[CV])) and do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Picked unit) is in (Units within 250.00 of (Position of ItTrap[CV]))) Equal to False
                            Then - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        ((Picked unit) belongs to an enemy of (Owner of ItCaster[CV])) Equal to True
                                        ((Picked unit) has buff Fly Trap (Trapped)) Equal to True
                                    Then - Actions
                                        Unit - Order (Picked unit) to Move To (Position of ItTrap[CV])
                                    Else - Actions
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                ((Picked unit) belongs to an enemy of (Owner of ItCaster[CV])) Equal to True
                                                ((Picked unit) has buff Fly Trap (Trapped)) Equal to False
                                            Then - Actions
                                                Unit - Order (Picked unit) to Move To (Position of ItTrap[CV])
                                                Unit - Create 1 Dummy for (Owner of ItCaster[CV]) at (Position of (Picked unit)) facing Default building facing degrees
                                                Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
                                                Unit - Set level of Fly Trapped  for (Last created unit) to (Level of Fly Trap  for ItCaster[CV])
                                                Unit - Order (Last created unit) to Orc Shaman - Purge (Picked unit)
                                            Else - Actions
                            Else - Actions
            Else - Actions
to remove the buff given by the trap; when the time is over:
Code:
FT3
    Events
        Unit - A unit Dies
    Conditions
        (Unit-type of (Dying unit)) Equal to FlyTrap (2)
    Actions
        Unit - Remove (Dying unit) from the game
        Unit Group - Pick every unit in (Units within 300.00 of (Position of (Dying unit))) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) has buff Fly Trap (Trapped)) Equal to True
                    Then - Actions
                        Unit - Remove Fly Trap (Trapped) buff from (Picked unit)
                    Else - Actions

Now my problem is that when i cast another trap, the units respond normally to the second trap, but can walk through the first one as if it isn't even there.

My second problem is that I do not know if simply ordering the units between 300-250 AoE of the trap's center to move inwards. It works in my test map on neutral creeps, but will this stop player-controlled hero's from going out when they like.. click alot?
thanks for your help!
 

Pharaoh_

The epic journey will soon begin... Prepare!
Reaction score
136
Then - Actions
Unit Group - Pick every unit in (Units within 300.00 of (Position of ItTrap[CV]))
Leakie. Set UnitGroup1 = (Units in (Units within 300.00 of ItTargetPt[CV]). You have already set the position of the trap (through the ability being cast), so Unit Group - Pick up every unit in UnitGroup1 and do Actions. Remove it when your triggers ends, using Custom Script: call DestroyGroup (udg_UnitGroup1)

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in (Units within 250.00 of (Position of ItTrap[CV]))) Equal to False
Then - Actions

You pick up every unit in units 300.00 range away and you add this condition? Why? Remove it. Go on with the other conditions you added (((Picked unit) belongs to an enemy of (Owner of ItCaster[CV])) Equal to True
((Picked unit) has buff Fly Trap (Trapped)) Equal to False)

Unit - Order (Picked unit) to Move To (Position of ItTrap[CV])
Leakie! Damn, since your trap is created at the ability being cast point, just use it, since you added it in a variable: Unit - Order (Picked unit) to Move To (ItTargetPt[CV])

Unit - Create 1 Dummy for (Owner of ItCaster[CV]) at (Position of (Picked unit))
Leakie... When you pick up every unit from the UnitGroup1, set Point1 = (Position of (Picked unit))
AND now do your above action: Unit - Create 1 Dummy for (Owner of ItCaster[CV]) at (Point1); remove it: Custom script: call RemoveLocation (udg_Point1)

You aldo did not remove the point "ItTargetPt[CV]", do it: Custom script: call RemoveLocation (udg_ItTargetPt[CV])

Unit Group - Pick every unit in (Units within 300.00 of (Position of (Dying unit)))
2 leaks already. Set Point2 = (Position of (Dying unit)) (remove it: Custom script: call RemoveLocation (udg_Point2)) and Set UnitGroup2 = Units within 300.00 of Point2 (remove it: cal DestroyGroup (udg_UnitGroup2))

Done for leaks. The fact that it doesn't proc normally on your second try is maybe because it requires a Countdown timer instead of an expiration timer. Since your actual effect is based on the Trap Dummy, just start a countdown timer, setting it in a variable and remove it: Custom script: call DestroyTimer (udg_<yourtimername>). Then in the trigger "a unit dies", add "<yourtimername> expires" instead and make all those actions, plus "Unit - Kill (ItTrap[CV])"
 

bananaHUNT

You can change this now in User CP
Reaction score
55
Wow huge thanks man; I'm not so good with leaks hehe :p The reason I pick every unit within 250 = false, is because i want them to be moved to the inside when they try to escape, not all the time :)
edit; have to spread some rep first before i can +rep you :(
edit2; it gives 1 error now tough: "expected a name" on call RemoveLocation (udg_ItTargetPt[CV]) ?
 

bananaHUNT

You can change this now in User CP
Reaction score
55
Uhhhm ok I don't know what happened but now it starts lagging like no tomorrow when i cast it a second time.. here's my triggers again:

Code:
FT1
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Fly Trap 
    Actions
        Set ItCaster[CV] = (Casting unit)
        Set ItTargetPt[CV] = (Target point of ability being cast)
        Unit - Create 1 FlyTrap (2) for (Owner of ItCaster[CV]) at ItTargetPt[CV] facing ItTargetPt[CV]
        Set ItTrap[CV] = (Last created unit)
        Unit - Add a (5.00 x (Real((Level of Fly Trap  for ItCaster[CV])))) second Generic expiration timer to ItTrap[CV]
        Countdown Timer - Start Timer1 as a One-shot timer that will expire in (5.00 x (Real((Level of Fly Trap  for ItCaster[CV])))) seconds

Code:
FT2
    Events
        Time - Every 0.01 seconds of game time
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Playable map area) contains ItTrap[CV]) Equal to True
            Then - Actions
                Set UnitGroup1 = (Units within 300.00 of ItTargetPt[CV])
                Unit Group - Pick every unit in UnitGroup1 and do (Actions)
                    Loop - Actions
                        Set Point1 = (Position of (Picked unit))
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Picked unit) is in (Units within 250.00 of (Position of ItTrap[CV]))) Equal to False
                            Then - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        ((Picked unit) belongs to an enemy of (Owner of ItCaster[CV])) Equal to True
                                        ((Picked unit) has buff Fly Trap (Trapped)) Equal to True
                                    Then - Actions
                                        Unit - Order (Picked unit) to Move To ItTargetPt[CV]
                                    Else - Actions
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                ((Picked unit) belongs to an enemy of (Owner of ItCaster[CV])) Equal to True
                                                ((Picked unit) has buff Fly Trap (Trapped)) Equal to False
                                            Then - Actions
                                                Unit - Order (Picked unit) to Move To (Position of ItTrap[CV])
                                                Unit - Create 1 Dummy for (Owner of ItCaster[CV]) at Point1 facing Default building facing degrees
                                                Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
                                                Unit - Set level of Fly Trapped  for (Last created unit) to (Level of Fly Trap  for ItCaster[CV])
                                                Unit - Order (Last created unit) to Orc Shaman - Purge (Picked unit)
                                                Custom script:   call RemoveLocation (udg_Point1)
                                            Else - Actions
                            Else - Actions
                Custom script:   call RemoveLocation (udg_ItTargetPt[CV])
                Custom script:   call DestroyGroup (udg_UnitGroup1)
            Else - Actions

Code:
FT3
    Events
        Time - Timer1 expires
    Conditions
    Actions
        Custom script:   call DestroyTimer (udg_Timer1)
        Set Point2 = (Position of ItTrap[CV])
        Set UnitGroup2 = (Units within 300.00 of Point2)
        Unit Group - Pick every unit in UnitGroup2 and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) has buff Fly Trap (Trapped)) Equal to True
                    Then - Actions
                        Unit - Remove Fly Trap (Trapped) buff from (Picked unit)
                    Else - Actions
        Custom script:   call RemoveLocation (udg_Point2)
        Custom script:   call DestroyGroup (udg_UnitGroup2)
        Unit - Remove ItTrap[CV] from the game
 

Pharaoh_

The epic journey will soon begin... Prepare!
Reaction score
136
Make your second trigger not initially enabled and turn on the second trigger through your first trigger.
 

bananaHUNT

You can change this now in User CP
Reaction score
55
Yeah i did that already, and it reduced the lag, but it still doesn't work when you have 2 traps set up.. I'll attach my map if you wanna take a look at it
 

Attachments

  • Fly Trap.w3x
    18.2 KB · Views: 93

mordocai

New Member
Reaction score
17
how come they get netted down? i thought the point was for them to actualy be able to move around inside it
 

bananaHUNT

You can change this now in User CP
Reaction score
55
how come they get netted down? i thought the point was for them to actualy be able to move around inside it

Well.. yeah :p Thanks for the effort and time you put in this Pharaoh but that's not really what i mean. Once enemies are in the trap, the cannot get out, but they can walk freely within the trap. Enemies should be able to walk through it as if it isn't there.
 

darkbeer

Beer is Good!
Reaction score
84
mby this is what you mean, strongly think so^^

Trigger:
  • Nahkampf-Initialisierung
    • Ereignisse
      • Einheit - A unit Startet den Effekt einer Fähigkeit
    • Bedingungen
      • (Ability being cast) Gleich Blizzard
    • Aktionen
      • Custom script: local unit u
      • Set FlyTrapCount = (FlyTrapCount + 1)
      • Set TempLoc = (Target point of ability being cast)
      • For each (Integer A) from 1 to 10, do (Actions)
        • Schleifen - Aktionen
          • Set TempLoc_2 = (TempLoc offset by 500.00 towards ((Real((Integer A))) x (360.00 / 10.00)) degrees)
          • Einheit - Create 1 Indikator for (Owner of (Triggering unit)) at TempLoc_2 facing Vorgabe für Gebäude-Ausrichtung degrees
          • Einheit - Add a 15.00 second Standard expiration timer to (Last created unit)
          • Custom script: call RemoveLocation(udg_TempLoc_2)
      • Einheit - Create 1 Tra Dummy for (Owner of (Triggering unit)) at TempLoc facing Vorgabe für Gebäude-Ausrichtung degrees
      • Custom script: set u = bj_lastCreatedUnit
      • Einheit - Add a 15.00 second Standard expiration timer to (Last created unit)
      • Einheit - Make (Last created unit) Unverwundbar
      • Set FlyTrapDummy[FlyTrapCount] = (Last created unit)
      • Set FlyTrapGroup[FlyTrapCount] = (Units within 512.00 of TempLoc matching (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Gleich True))
      • Custom script: call RemoveLocation(udg_TempLoc)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • &#039;IF&#039;-Bedingungen
          • FlyTrapCount Gleich 1
        • &#039;THEN&#039;-Aktionen
          • Auslöser - Turn on Timer &lt;gen&gt;
        • &#039;ELSE&#039;-Aktionen
      • Wait 0.50 seconds
      • Custom script: set bj_lastCreatedUnit = u
      • Animation - Change (Last created unit)&#039;s animation speed to 0.00% of its original speed
      • Custom script: set u = null

Trigger:
  • Timer
    • Ereignisse
      • Zeit - Every 0.03 seconds of game time
    • Bedingungen
    • Aktionen
      • For each (Integer A) from 1 to FlyTrapCount, do (Actions)
        • Schleifen - Aktionen
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • &#039;IF&#039;-Bedingungen
              • (FlyTrapDummy[(Integer A)] is alive) Gleich True
            • &#039;THEN&#039;-Aktionen
              • Set TempLoc = (Position of FlyTrapDummy[(Integer A)])
              • Einheitengruppe - Pick every unit in FlyTrapGroup[(Integer A)] and do (Actions)
                • Schleifen - Aktionen
                  • Set TempLoc_2 = (Position of (Picked unit))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • &#039;IF&#039;-Bedingungen
                      • (Distance between TempLoc and TempLoc_2) Größer als 500.00
                    • &#039;THEN&#039;-Aktionen
                      • Set TempLoc_3 = (TempLoc offset by 490.00 towards (Angle from TempLoc to TempLoc_2) degrees)
                      • Einheit - Move (Picked unit) instantly to TempLoc_3
                      • Einheit - Order (Picked unit) to Stoppen
                      • Custom script: call RemoveLocation(udg_TempLoc_3)
                    • &#039;ELSE&#039;-Aktionen
                  • Custom script: call RemoveLocation(udg_TempLoc_2)
              • Einheitengruppe - Pick every unit in (Units within 500.00 of TempLoc matching (((Matching unit) belongs to an enemy of (Owner of FlyTrapDummy[(Integer A)])) Gleich True)) and do (Actions)
                • Schleifen - Aktionen
                  • Einheitengruppe - Add (Picked unit) to FlyTrapGroup[(Integer A)]
              • Custom script: call RemoveLocation(udg_TempLoc)
              • Custom script: call DestroyGroup(udg_TempGroup)
            • &#039;ELSE&#039;-Aktionen
              • Set FlyTrapDummy[(Integer A)] = FlyTrapDummy[FlyTrapCount]
              • Einheitengruppe - Remove all units from FlyTrapGroup[(Integer A)]
              • Set FlyTrapGroup[(Integer A)] = FlyTrapGroup[FlyTrapCount]
              • Set FlyTrapCount = (FlyTrapCount - 1)
              • For each (Integer A) from 0 to ((Integer A) - 1), do (Actions)
                • Schleifen - Aktionen
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • &#039;IF&#039;-Bedingungen
                  • FlyTrapCount Gleich 0
                • &#039;THEN&#039;-Aktionen
                  • Auslöser - Turn off (This trigger)
                • &#039;ELSE&#039;-Aktionen

sorry for gemran editor version, demo map attached:
EDIT. updated it a little^^ (few leaks i forgot before removed and made some good dummies)
i thikn it looks nice and its MUI
 

Attachments

  • lol.w3x
    19.6 KB · Views: 116
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top