• 💀 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!

I'm having problems Moving Regions

Not open for further replies.
Level 3
Jul 3, 2011
My goal is to create a set of triggers where after the player orders the Hero to move from point A to point B, the Hero will automatically stop using "Hold Position".

After much troubleshooting, I narrowed the problem down to action itself....Moving the Region. I can't seem to move the damn region at all. I tried creating a variable and tying it to the region. I tried creating the region with triggers, but when I attempted to create a "When Unit Enters This Region" trigger, the Variable doesn't exist on the list.

I have a feeling there's something fundamentally wrong with regions when it comes to moving them. Is there an easier way?

Please help!:ogre_frown:

Dr Super Good

Spell Reviewer
Level 63
Jan 18, 2005
Yes there is something wrong, its called GUI is retarded and lies to you.

So called "Regions" in GUI are actually "rect"s. The event however uses a "region" type. Thus the event secretly converts a rect into a region for you. I am not sure if moving a rect will actually change the region it is bound to, and it not doing so would explain the problems you have.

The only real solution is to learn JASS to understand how the JASS interpreter actually works in WC3 and then design code to support the functionality you want.

Deleted member 177737


Deleted member 177737

Maby there is a way to set the newly created region as a variable and then use that variable as the reference?

(I've honestly never tried doing what your doing, but this is how I would do it...if it is possible)


Code Moderator
Level 49
Sep 26, 2009
This is solvable but annoying. It requires a healthy amount of custom script, in fact using JassHelper to compile would be preferred because then you can use "region" global variables instead of "rect" globals.

If you have a region named "MyInGameRegion", you can do this:

scope bullocks initializer Init

    private region myRegion

private function OnEnter takes nothing returns boolean
    // A unit has entered "MyInGameRegion"
    return false

private function Init takes nothing returns nothing
    set myRegion = CreateRegion()
    call RegionAddRect(myRegion, gg_rct_MyInGameRegion)
    call TriggerRegisterEnterRegion(CreateTrigger(), myRegion, Filter(function OnEnter))

//This next function works the magic.
function MoveMyInGameRegion takes real x, real y returns nothing
    call RegionClearRect(myRegion, gg_rct_MyInGameRegion)
    call MoveRectTo(gg_rct_MyInGameRegion, x, y)
    call RegionAddRect(myRegion, gg_rct_MyInGameRegion)


Edit: Honestly it is probably better to just use a periodic trigger and check when the unit is in range.
Last edited:
Not open for further replies.