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

[Trigger] Creating a region through triggers?

Status
Not open for further replies.
Level 6
Joined
Jul 25, 2005
Messages
221
Evenin' all, I'm here with yet another question.

Is it possible to create regions through triggers? 'Cause there aren't any actions in GUI, I'll assume that it is in the JASS corner... Either that or it isn't possible. Either way, some insight on the subject would be nice. :wink:

The reason I am asking this is because I am trying to make a unit that checks the surrounding area for allied units and then protects them, and when they leave the area, the protection is lost.

Example. A unit comes within 3000 of Protector - give protection
A unit with protection walks to 3001 from protector - remove protection

As always, solutions or tips are appreciated and if it really helps i'll give you some +rep :)
 
Level 22
Joined
Feb 26, 2008
Messages
892
Well, you can do it in GUI if you have a region variable.
You can specify a region using coordinates.
When you go to Set Variable with the region variable, check out the option Conversion - Convert Coordinates to Region.
 
Level 6
Joined
Jul 25, 2005
Messages
221
Cool, I knew that... But I had totally forgotten about it.
Is Conversion - Convert point with size to region a circular region?
 
Level 6
Joined
Jul 25, 2005
Messages
221
So... there's no way of making a circular region?
Although a square region will suffice, I'd rather use a circular one because it's more accurate imo.
 
Level 6
Joined
Jul 25, 2005
Messages
221
Hm, I thought about that, but didn't really know how the trigger would look like. I want it to be as efficient as possible, so the less variables the better.

Edit: How about a trigger that checks if the unit doesn't have the aura effect and has the Protection (its an ability), or rather, if the unit has protection and then check if it is outside range, more efficient for the trigger to read I would think.
 
Level 9
Joined
May 27, 2006
Messages
498
The one with aura?

  • Aura Invurnerability
    • Events:
      • Time - Every 0.1 seconds of game time
    • Conditions:
    • Actions:
      • Custom script: set bj_WantDestroyGroup = true
      • Unit Group - Pick every unit in (entire map) and do (Actions)
        • If Then Else - Multiple Functions
          • If - Conditions:
            • (Picked unit) has buff Your_Buff Equal to True
          • Then - Actions:
            • Unit - Make (Picked unit) Invurnerable
          • Else - Actions:
            • Unit - Make (Picked unit) Vurnerable
EDIT:
@Up
Edit your posts, dont double post.
You want to check if unit doesn't have an aura effect and have an ability? This should look like this:
  • Conditions:
    • [unit] has buff [buff] Equal to False
    • (Level of [ability] for [unit] greather than or equal to 1)
 
Level 6
Joined
Jul 25, 2005
Messages
221
That would not be very smart. Picking all units in the entire map every 0.1 (or 0.5 or whatever) would eventually cause a major lagg. Can it be simplified, or improved? I can't seem to find the condition for if "unit has ability", maybe I imagined it...

Edit: Sorry for double posting, I just love making posts .. :p
  • Conditions:
    • [unit] has buff [buff] Equal to False
    • (Level of [ability] for [unit] greather than or equal to 1)
There it is! That's the condition I was looking for. Thanks :D +rep to you for teh trigger and stuff

I'll post you my version of the trigger in a moment...
 
Level 6
Joined
Jul 25, 2005
Messages
221
Actually, you wanna use the Pick every unit in (Playable map area) matching condition as it is more appropriate imo :p

By the by, if the level of an ability is equal to 0 does that mean that the unit doesnt have the ability?
 
Level 6
Joined
Jul 25, 2005
Messages
221
Yes Yes, I was just giving you a better action, wasn't referring to the point itself rather than the action with a condition modifier :D

Great then my trigger is complete. Yay *Cheers*
 
Level 6
Joined
Jul 25, 2005
Messages
221
Ok, so the trigger doesn't work... Can anyone tell me what's wrong with this trigger?

  • Shield Buildings and Units
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Entire map) matching (((Level of No Damage Book for (Matching unit)) Equal to 1) and (((Matching unit) has buff Town Shield ) Equal to False))) and do (Actions)
        • Loop - Actions
          • Unit - Remove No Damage Book from (Picked unit)
      • Unit Group - Pick every unit in (Units within 3000.00 of (Position of uniShieldActivater) matching ((((Matching unit) is A structure) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of uniShieldActivater)) Equal to False))) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • (Level of No Damage Book for (Picked unit)) Equal to 0
                  • ((Picked unit) has buff Town Shield ) Equal to True
            • Then - Actions
              • Unit - Add No Damage Book to (Picked unit)
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • boolShieldBuilding Equal to True
        • Then - Actions
          • Set boolShieldBuilding = False
          • Unit Group - Pick every unit in (Units within 3000.00 of (Position of uniShieldActivater) matching (((Matching unit) is A structure) Equal to True)) and do (Actions)
            • Loop - Actions
              • Unit - Add No Damage Book to (Picked unit)
        • Else - Actions
Explanations: No Damage Book is the ability that make units invincible, Town Shield is the aura buff, boolShieldBuilding is a boolean that only activates once, and uniShieldActivater is the unit triggering.
 
Status
Not open for further replies.
Top