• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 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!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

[General] Region moving help.

Status
Not open for further replies.
Level 2
Joined
Apr 18, 2010
Messages
7
It doesn't work, that's the problem.

  • Events
    • Time - Every 0.10 seconds of game time
  • Conditions
  • Actions
    • Region - Center ControlRegion on (position of Caravan)
The ControlRegion is a region variable.
The Caravan is a unit variable.

Using patch 1.26. I tried with non variables as well but it doesn't work. I just want the region to move with the specified unit so i can check the units near the Caravan variable. I think this would be more optimized instead of checking the range between the units.

EDIT: I messed up the forum, can this get deleted please?
 
Level 13
Joined
Jun 1, 2008
Messages
360
How do you know the region doesn't move?
Maybe the problem lies somewhere else.

What happens when you create a minimap ping or special effect (bloodlust e.g.) both at the position of caravan and the center of the control region after this line of code?

I guess the only possible explanation is that Caravan hasn't been defined.
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
Have you declared Caravan & ControlRegion variables? Region especialy, it should be set to region thats already on map. If it doesn't work (but I think it should anyways) you can use native:
  • Custom script: call MoveRectTo(udg_ControlRegion, GetUnitX(udg_Caravan), GetUnitY(udg_Caravan))
However, I think that might be usefull too:
  • Events
    • Time - Every 0.10 seconds of game time
  • Conditions
  • Actions
    • Set p = (Position of Caravan)
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units within 500 of p matching (<conditions here>)) and do Actions
      • Loop - Actions
        • // stuff here
    • Custom script: call RemoveLocation(udg_p)
Moving region to pick units later is a bit inaccurate, in case it's square, not circle.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
There is a function for checking units in range, you don't have to pick all units in region and checking distances.

  • Unit Group - pick every units in range
  • Unit Group - pick every units in range matching condition
etc
 
Level 2
Joined
Apr 18, 2010
Messages
7
I want the region to move because i want to create triggers that has "when unit enters region" events. I can post my whole system if you want to try and find a solution. I'm trying to recreate the 4th mission of the blood elf campaign and i couldn't recreate the original trigger so i just came up with a solution but i need the region to move. I tested it with my friend probably 4-5 times and it didn't work.

I'm pretty sure the variables are declared because i have them in the initialization trigger.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
The rect is moved, however it does not affect this event.

This event actually creates a jass region and adds the cells of your GUI rect when being registered, meaning if you have it in the events block in GUI, it will be done on map loading process. Changing the rect afterwards does not touch the region the event was registered for anymore. Regions of jass are not directly supported in GUI, so you would have to use some jass to actually change the event.
 
Level 2
Joined
Apr 18, 2010
Messages
7
How can i make it so that the units gets out of that range? Because i've specified "unit leaves region" as well.

EDIT: I just thought of something. If i add an aura to the Caravan unit, will i be able to check if some unit gets the buff or if some unit gets outside of the range of the aura (has no buff)?

EDIT: I have found a solution to my problem. Thanks to all the posters.
 
Last edited:
Status
Not open for further replies.
Top