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

[JASS] Trouble converting a set force GUI trigger into JASS

Status
Not open for further replies.
Level 18
Joined
Nov 1, 2006
Messages
1,612
Hopefully PurplePoot can help me with this one,

  • Real
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
    • Actions
      • Custom script: local unit TempUnit
      • Custom script: local location TrapPoint = GetUnitLoc(GetSummonedUnit()
      • Custom script: local force TempGroup
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Set TempGroup = (Units within 600.00 of (Position of (Summoned unit)) matching ((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True) and ((((Matching unit) has buff Trapped ) Equal to False) and (((Matching unit) is A structure) Equal to Fals
          • Custom script: set TempUnit = GroupPickRandomUnit(TempGroup)
          • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at TrapGlobalPoint facing Default building facing (270.0) degrees
          • Custom script: call CreateNUnitsAtLoc( 1, 'h00G', GetOwningPlayer(GetTriggerUnit()), TrapPoint, bj_UNIT_FACING )
          • Unit - Turn collision for (Last created unit) Off
          • Unit - Add Trap Rope to (Last created unit)
          • Custom script: call IssueTargetOrderBJ( GetLastCreatedUnit(), "drain", TempUnit )
          • Unit Group - Remove all units from TempGroup
          • Custom script: call GroupClear( TempGroup )
          • Custom script: set TempUnit = null
          • Custom script: call DestroyForce(TempGroup)*
          • Custom script: set TempGroup = null
      • Custom script: call RemoveLocation(TrapPoint)
      • Custom script: set TrapPoint = null

Everything (I haven't doubled checked though) is how I want it. I am pretty sure that I made up DestroyForce() so it would help if someone could give me the correct way to destroy a force too.

My problem is though that I need to convert the line where TempGroup is set (not as a global but as a local) to be able to fit into this trigger. Is it doable?

If anyone can spot a way to make this a more efficient trigger (PurplePoot :p) let me know. Also I would like this ward to also trap any units that come within range of it once it is summoned, but I don't know how to do this (except I've heard you can create triggers within triggers, and then I think it could be done. Can I have help with that too?)

Finally, I also want this ability to pull the trapped units closer to the ward until they're 100 distance away, but I am virtually clueless as how pull units. Thank you.
 
Last edited:
Level 40
Joined
Dec 14, 2005
Messages
10,532
There are tons of errors; you didn't set the types of the first 2 variables, and the third should be a group; force is a 'Player Group'. (So also you need DestroyGroup)

the TempGroup line doesn't translate well (need an extra function for the boolexpr, which is nasty in GUI), but you could always do this:

<temp group thing>
Custom script: set TempGroup = udg_TempGroup

--------------------

In this case globals are better than locals anyways.
 
Level 18
Joined
Nov 1, 2006
Messages
1,612
I fixed those errors, sorry I should have double checked the trigger first. Here it is now --

  • Real
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
    • Actions
      • Custom script: local unit TempUnit
      • Custom script: local force TempGroup
      • Custom script: local location TrapPoint = GetUnitLoc(GetSummonedUnit())
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Set TempGroup = (Units within 600.00 of (Position of (Summoned unit)) matching ((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True) and ((((Matching unit) has buff Trapped ) Equal to False) and (((Matching unit) is A structure) Equal to Fals
          • Custom script: set TempGroup = udg_TempGroup
          • Custom script: set TempUnit = GroupPickRandomUnit(TempGroup)
          • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at TrapGlobalPoint facing Default building facing (270.0) degrees
          • Custom script: call CreateNUnitsAtLoc( 1, 'h00G', GetOwningPlayer(GetTriggerUnit()), TrapPoint, bj_UNIT_FACING )
          • Unit - Turn collision for (Last created unit) Off
          • Unit - Add Trap Rope to (Last created unit)
          • Custom script: call IssueTargetOrderBJ( GetLastCreatedUnit(), "drain", TempUnit )
          • Unit Group - Remove all units from TempGroup
          • Custom script: call DestroyGroup(TempGroup)
          • Custom script: set udg_TempGroup = null
      • Custom script: call RemoveLocation(TrapPoint)
      • Custom script: set TrapPoint = null

But now, how would I make it to where they would be pulled closer to the ward? I have a feeling this entire ability is going to get anywhere, it seems extremely complicated.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
But now, how would I make it to where they would be pulled closer to the ward? I have a feeling this entire ability is going to get anywhere, it seems extremely complicated.
You really shouldn't be using GUI for this...

However, it involves a rapid timer and lots of SetUnitX()/SetUnitY() calls. It takes a long time to explain, so I'd prefer if you just went and looked at a few knockback triggers ;) (They're also applied there, which can be handy for understanding)
 
Level 18
Joined
Nov 1, 2006
Messages
1,612
Okay, I can do that.

EDIT - here is the result, but nothing happens at all in the game (?)

  • Real
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoned unit)) Equal to Trap Lure (Hunter)
    • Actions
      • Custom script: local unit TempUnit1
      • Custom script: local unit TempUnit2
      • Custom script: local unit TempUnit3
      • Custom script: local unit TempUnit4
      • Custom script: local unit TempUnit5
      • Custom script: local group TempGroup
      • Custom script: local location WardPoint1
      • Custom script: local location WardPoint2
      • Custom script: local location WardPoint3
      • Custom script: local location WardPoint4
      • Custom script: local location WardPoint5
      • Custom script: local unit TrapWard = GetSummonedUnit()
      • Custom script: local location TrapPoint = GetUnitLoc(GetSummonedUnit())
      • Set TempGroup = (Units within 800.00 of (Position of (Summoned unit)) matching (((Owner of (Matching unit)) is an enemy of (Owner of (Triggering unit))) Equal to True))
      • Custom script: set TempGroup = udg_TempGroup
      • Unit Group - Remove all units from TempGroup
      • -------- Unit 1 --------
      • Custom script: set TempUnit1 = GroupPickRandomUnit(TempGroup)
      • Custom script: call GroupRemoveUnitSimple( TempUnit1, TempGroup )
      • Custom script: call CreateNUnitsAtLoc( 1, 'h00G', GetOwningPlayer(GetTriggerUnit()), TrapPoint, bj_UNIT_FACING )
      • Unit - Turn collision for (Last created unit) Off
      • Unit - Add a 25.00 second Generic expiration timer to (Last created unit)
      • Unit - Add Rope Capture (Neutral Hostile) to (Last created unit)
      • Custom script: call IssueTargetOrderBJ( GetLastCreatedUnit(), "drain", TempUnit1 )
      • -------- Unit 2 --------
      • Custom script: set TempUnit2 = GroupPickRandomUnit(TempGroup)
      • Custom script: call GroupRemoveUnitSimple( TempUnit2, TempGroup )
      • Custom script: call CreateNUnitsAtLoc( 1, 'h00G', GetOwningPlayer(GetTriggerUnit()), TrapPoint, bj_UNIT_FACING )
      • Unit - Turn collision for (Last created unit) Off
      • Unit - Add a 25.00 second Generic expiration timer to (Last created unit)
      • Unit - Add Rope Capture (Neutral Hostile) to (Last created unit)
      • Custom script: call IssueTargetOrderBJ( GetLastCreatedUnit(), "drain", TempUnit2 )
      • -------- Unit 3 --------
      • Custom script: set TempUnit3 = GroupPickRandomUnit(TempGroup)
      • Custom script: call GroupRemoveUnitSimple( TempUnit3, TempGroup )
      • Custom script: call CreateNUnitsAtLoc( 1, 'h00G', GetOwningPlayer(GetTriggerUnit()), TrapPoint, bj_UNIT_FACING )
      • Unit - Turn collision for (Last created unit) Off
      • Unit - Add Rope Capture (Neutral Hostile) to (Last created unit)
      • Custom script: call IssueTargetOrderBJ( GetLastCreatedUnit(), "drain", TempUnit3 )
      • -------- Unit 4 --------
      • Custom script: set TempUnit4 = GroupPickRandomUnit(TempGroup)
      • Custom script: call GroupRemoveUnitSimple( TempUnit4, TempGroup )
      • Custom script: call CreateNUnitsAtLoc( 1, 'h00G', GetOwningPlayer(GetTriggerUnit()), TrapPoint, bj_UNIT_FACING )
      • Unit - Turn collision for (Last created unit) Off
      • Unit - Add a 25.00 second Generic expiration timer to (Last created unit)
      • Unit - Add Rope Capture (Neutral Hostile) to (Last created unit)
      • Custom script: call IssueTargetOrderBJ( GetLastCreatedUnit(), "drain", TempUnit4 )
      • -------- Unit 5 --------
      • Custom script: set TempUnit5 = GroupPickRandomUnit(TempGroup)
      • Custom script: call GroupRemoveUnitSimple( TempUnit5, TempGroup )
      • Custom script: call CreateNUnitsAtLoc( 1, 'h00G', GetOwningPlayer(GetTriggerUnit()), TrapPoint, bj_UNIT_FACING )
      • Unit - Turn collision for (Last created unit) Off
      • Unit - Add a 25.00 second Generic expiration timer to (Last created unit)
      • Unit - Add Rope Capture (Neutral Hostile) to (Last created unit)
      • Custom script: call IssueTargetOrderBJ( GetLastCreatedUnit(), "drain", TempUnit5 )
      • Custom script: call DestroyGroup(TempGroup)
      • Custom script: set TempGroup = null
      • Custom script: call RemoveLocation(TrapPoint)
      • Custom script: set TrapPoint = null
      • -------- Pull Action --------
      • For each (Integer A) from 1 to 20, do (Actions)
        • Loop - Actions
          • Custom script: set WardPoint1 = PolarProjectionBJ(GetUnitLoc(TempUnit1), 30.00, AngleBetweenPoints(GetUnitLoc(TempUnit1), GetUnitLoc(TrapWard)))
          • Custom script: call SetUnitPositionLoc( TempUnit1, WardPoint1 )
          • Custom script: call RemoveLocation(WardPoint1)
          • Custom script: set WardPoint1 = null
          • Custom script: set WardPoint2 = PolarProjectionBJ(GetUnitLoc(TempUnit2), 30.00, AngleBetweenPoints(GetUnitLoc(TempUnit2), GetUnitLoc(TrapWard)))
          • Custom script: call SetUnitPositionLoc( TempUnit2, WardPoint2 )
          • Custom script: call RemoveLocation(WardPoint2)
          • Custom script: set WardPoint2 = null
          • Custom script: set WardPoint3 = PolarProjectionBJ(GetUnitLoc(TempUnit3), 30.00, AngleBetweenPoints(GetUnitLoc(TempUnit3), GetUnitLoc(TrapWard)))
          • Custom script: call SetUnitPositionLoc( TempUnit3, WardPoint3 )
          • Custom script: call RemoveLocation(WardPoint3)
          • Custom script: set WardPoint3 = null
          • Custom script: set WardPoint4 = PolarProjectionBJ(GetUnitLoc(TempUnit4), 30.00, AngleBetweenPoints(GetUnitLoc(TempUnit4), GetUnitLoc(TrapWard)))
          • Custom script: call SetUnitPositionLoc( TempUnit4, WardPoint4 )
          • Custom script: call RemoveLocation(WardPoint4)
          • Custom script: set WardPoint4 = null
          • Custom script: set WardPoint5 = PolarProjectionBJ(GetUnitLoc(TempUnit5), 30.00, AngleBetweenPoints(GetUnitLoc(TempUnit5), GetUnitLoc(TrapWard)))
          • Custom script: call SetUnitPositionLoc( TempUnit5, WardPoint5 )
          • Custom script: call RemoveLocation(WardPoint5)
          • Custom script: set WardPoint5 = null
          • Wait 0.05 seconds
      • Custom script: set TrapWard = null
      • Custom script: set TempUnit1 = null
      • Custom script: set TempUnit2 = null
      • Custom script: set TempUnit3 = null
      • Custom script: set TempUnit4 = null
      • Custom script: set TempUnit5 = null
The trigger is not complete yet, as I am going to change the movement speed of the units to 0 so they cannot move, but only attack and cast spells.
 
Last edited:
Level 18
Joined
Nov 1, 2006
Messages
1,612
I did reuse the TempUnit variables. I don't know how to use a timer in that trigger. Which parts are leaking? I wish I knew why it wont work :(. I tried it with just ONE unit and it worked fine, so that might mean something.

Also, I will need to learn how to create an effect from point to point rather than using a unit to cast an ability for the effect, for one the unit is automatically moved the effect stops :(
 
Level 18
Joined
Nov 1, 2006
Messages
1,612
Actually I figured all of this out on my own, but I'll credit you for inspiring me to haha. I figured that I should just create another trigger that whenever "magicleash" is cast by the dummy unit, a trigger initiates that drags the targeted unit towards the dummy unit (which is right at the ward). It looks great and works fine! And now just to fix those leaks o_O
 
Status
Not open for further replies.
Top