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

Status
Not open for further replies.

The Panda

Icon Reviewer
Level 57
Joined
Jun 2, 2008
Messages
8,925
Hello! Can anyone help or make me a trigger? I will give rep back!

So I'm making a somewhat of a dota type map, and when the units are heading down the lane too attack and enemies units. I used my hero to come out of the 'jungle' area and got the units attention before attacking the other enemy units and they followed me through out the jungle. I want to prevent those units from entering the jungle at all.. I made a simple trigger for it but it didn't work..i attached it too this message.. I know this must be a simple trigger, but I'm not sure why mine isn't working correctly.

To sum this all up, all I wanna prevent is for any type of units too, not enter the jungle and follow heros around.
 

Attachments

  • IMG_4839.JPG
    IMG_4839.JPG
    3.6 MB · Views: 103
Level 39
Joined
Feb 27, 2007
Messages
5,036
You can post triggers by right clicking them > "copy as text" > paste on the forum between [trigger][/trigger] tags.

You've done almost the right thing, but the problem is that you ordered the unit to attack-move to the proper location, so it will keep chasing the unit it sees right in front of it. If you manage to break line of sight from the units to you while they're following you in the jungle they should go back to where you want them. Fixing this can be tedious because to get the units to ignore you in the jungle you have to tell them to move back onto the path (can't use attack-move as you see), so how do we know when they're back on the path to change the order to attack-move (otherwise they'll ignore enemies!).

The solution I see is:
  • When a unit enters one of those regions (where it shouldn't be), order it to move to a point D distance behind it (presumably this is back towards the lane) and add it to a unit group called ShouldLeave
  • D = ~200 maybe, give or take. It will take some testing.
  • When a unit leaves the region and is in the ShouldLeave group, remove it from ShouldLeave and order it to attack move properly.
Because the unit can't both be in the region and not in the region simultaneously (Schrödinger's Unit, anyone?) those event can never occur simultaneously. The units can get stuck right at the edge of the lane if there's something to draw their aggro back outside of it (say you are the only nearby enemy unit and you're standing at the edge of the jungle), resulting in them going to the jungle then turning around to walk back, then acquiring you as a target again, etc.

You're also leaking locations, which is what the Custom script lines I included fix:

  • Events
    • Unit - A unit enters witchdocspawntop <gen>
    • Unit - A unit enters gruntspawntop2 <gen>
  • Conditions
    • (Owner of (Triggering Unit) equal to Player 11 (Dark Green))
  • Actions
    • Set TempPoint1 = Position of (Triggering Unit)
    • Set TempPoint2 = TempPoint1 offset by <DISTANCE> toward ((Facing of (Triggering Unit)) + 180.00) degrees
    • Unit - Order (Triggering Unit) to move to TempPoint2
    • Unit Group - Add (Triggering Unit) to ShouldLeave
    • Custom script: call RemoveLocation(udg_TempPoint1)
    • Custom script: call RemoveLocation(udg_TempPoint2)
  • Events
    • Unit - A unit leaves witchdocspawntop <gen>
    • Unit - A unit leaves gruntspawntop2 <gen>
  • Conditions
    • (ShouldLeave contains (Triggering Unit)) equal to true
  • Actions
    • Set TempPoint1 = Center of Atk move orc <gen>
    • Unit - Order (Triggering Unit) to Attack-Move to TempPoint1
    • Unit Group - Remove (Triggering Unit) from ShouldLeave
    • Custom script: call RemoveLocation(udg_TempPoint1)
 

The Panda

Icon Reviewer
Level 57
Joined
Jun 2, 2008
Messages
8,925
Ok, thanks a lot! I knew there had to be a science around this.. I'm not so good with triggers but everything else lol.. so should I use the top trigger you edited or the bottom one? or both? And, what variables did you use so I can add those.

Also, one more question..
do you know how to change the zoom/view of in game? out more? everytime I test its very zoomed in and its very annoying.
 
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
5,036
Both triggers. As I said above they work in tandem; you should probably read the words I typed, ya know. The necessary variables should be evident to you when you try to make the trigger (hint: "Set <...>" indicates a variable). They are TempPoint1, TempPoint2, and ShouldLeave. <DISTANCE> is just whatever you choose the distance to order them backwards to be; I suggested maybe 200 but perhaps 50 is sufficient.

Zooming can be accomplished with the Camera actions in triggers. There should be one specifically for zoom level.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,207
One way that might work would be to have AI control the units as a form of attack wave (captain group?). This group is set to strictly follow the lane rotes. When units deviate too far from it, the AI should order them to regroup before pushing forward. It should also keep the units grouped together. Not too shore how viable this is though or even if it will work properly.
 

The Panda

Icon Reviewer
Level 57
Joined
Jun 2, 2008
Messages
8,925
One way that might work would be to have AI control the units as a form of attack wave (captain group?). This group is set to strictly follow the lane rotes. When units deviate too far from it, the AI should order them to regroup before pushing forward. It should also keep the units grouped together. Not too shore how viable this is though or even if it will work properly.
Thanks man I appreciate that!
 
Status
Not open for further replies.
Top