• 🏆 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] Prohibit attacking on area from another area

Status
Not open for further replies.
Level 5
Joined
May 15, 2008
Messages
105
I have a 'Dungeon' area on my map. How can I prohibit to catapults (and all other range units) to attack on the area 'Dungeons'?

I don't ask just about disable ordering it to units but also don't let them do it as default attack on enemies.
 
Level 5
Joined
May 15, 2008
Messages
105
I think you haven't understood, probably my question wasn't precise. I want to prohibit to units which are not in 'dungeon' to attack units which are in 'dungeon' (also by attack on ground in dungeon). Nothing more, nothing less.
 
Level 9
Joined
May 30, 2008
Messages
430
make the regions at the palces where you don't wanna the untis to attack then for normal attack check if the attacked unit is insdie the area and if the attacker is also in the same area if true then do nothing else order the attacker to stop, hex it or whatever you like. for attack ground ability when a unit is ordered to target a point and the order is attack ground (check what the string order is) just store the point and check if the attacker is inside or outside of the dungeon. Or even better like every other RPG make your dungeons far away from the game field to avoid such a bugs and abuses
 
Level 5
Joined
May 15, 2008
Messages
105
Or even better like every other RPG make your dungeons far away from the game field to avoid such a bugs and abuses
I would have to resize map, it's impossible for now.

make the regions at the palces where you don't wanna the untis to attack then for normal attack check if the attacked unit is insdie the area and if the attacker is also in the same area if true then do nothing else order the attacker to stop, hex it or whatever you like. for attack ground ability when a unit is ordered to target a point and the order is attack ground (check what the string order is) just store the point and check if the attacker is inside or outside of the dungeon.
That is sure but I still don't know which:
1) event/condition should I use to check if a unit wants to attack (without order from player)
2) stop attack of unit without disabling it's attack at all
 
Level 5
Joined
Jan 4, 2007
Messages
103
Either that or whenever a unit enter that region change the alliance of the player:

  • Player - Make (Owner of (Entering unit)) treat (Your Enemy Player) as an Neutral
Then when the unit leave the region, change it to Enemy. If you have multiple unit of the same player use a variable that shows how many of the units entered that region, and then, when they exit if the variable is 0 make them an enemy ect. If the catapults target random points, make a condition that If the Random Point equals to the Dungeon then choose another point and fire, if it's again that point he will choose another one ect. Hope it helps:)
 
Level 11
Joined
Sep 12, 2008
Messages
657
you forgot 1 thing sherloc..
attack ground works on allies aswell.

so this is pretty much it:

  • YourTrigger
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (((YourRegion) contains (Attacked unit)) Equal to True) and (((YourRegion) contains (Attacking unit)) Equal to False)
        • Then - Actions
          • Unit - Order (Attacking unit) to Stop
        • Else - Actions
unit is attacked is trigerred around the 30 miliseconds before the real actions, so basicly this will seriusly stop the unit from doing so.
allthought, attack target is NOT an ability, and i have no clue if the trigger i gave you works. test it.
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
you could disable units to attack units with a specific classification and change them using
  • Unit - Add classification of Mechanical to (Triggering unit)
as they enter the region
they would become unable to attack each other this way but this can be fixed by replacing them with another unit type
probably you could even change their attack index and handle things that way (first attack is able to attack some units with classification x, second is not etc.)
 
Status
Not open for further replies.
Top