wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Warcraft III Modding > Developer's Corner > Triggers & Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 03-02-2015, 08:21 AM   #1
NotAnotherGlitch
User
 
Join Date: Mar 2015
Posts: 3

NotAnotherGlitch has little to show at this moment (0)

Default Move Region Trigger Broken?

Whenever i try and center a region on a point through triggers, the region simply does not move.
All specified regions are variables and points are valid so i don't know what is wrong.
I feel like i'm missing something really simple.
NotAnotherGlitch is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 03-02-2015, 03:56 PM   #2
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,190

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

How do you know that it does not move?
__________________
Anitarf is offline   Reply With Quote
Old 03-03-2015, 01:04 AM   #3
NotAnotherGlitch
User
 
Join Date: Mar 2015
Posts: 3

NotAnotherGlitch has little to show at this moment (0)

Default

The trigger i'm using is supposed to center the region on a casting unit.
i added another trigger which kills any unit entering the specified region to test this.

however, when i cast the spell (which works because all other triggered actions fire) no units entering where i want the region to be will die.

furthermore, after the trigger is fired, when i move any unit to where the region was originally located the kill trigger fires.

so the region is not moving.
NotAnotherGlitch is offline   Reply With Quote
Old 03-03-2015, 01:45 AM   #4
NotAnotherGlitch
User
 
Join Date: Mar 2015
Posts: 3

NotAnotherGlitch has little to show at this moment (0)

Default

Here are the test triggers



And here are the triggers for one my abilities which is dependant on moving regions.
It is just Stasis Trap but using a custom stun buff so it looks like enemies are ensnared.

NotAnotherGlitch is offline   Reply With Quote
Old 03-03-2015, 05:10 AM   #5
Fledermaus
default string
 
Fledermaus's Avatar
 
Join Date: May 2006
Posts: 705

Submissions (1)

Fledermaus is a jewel in the rough (194)Fledermaus is a jewel in the rough (194)Fledermaus is a jewel in the rough (194)

Send a message via MSN to Fledermaus
Default

The problem is that the GUI event
Trigger:
Unit - A unit enters Region 000 <gen>
isn't actually registering a region. Instead it's registering a rect (which is what all "Regions" created on the map actually are).

When converted into jass it becomes this function:
Collapse JASS:
function TriggerRegisterEnterRectSimple takes trigger trig, rect r returns event
    local region rectRegion = CreateRegion()
    call RegionAddRect(rectRegion, r)
    return TriggerRegisterEnterRegion(trig, rectRegion, null)
endfunction

It creates a local region, adds the rect to it and then registers the enter event for the local region.

The
Trigger:
Region - Center Region 000 <gen> on (Center of (Playable map area))
action only moves the rec.
There is no way to actually move a region. If you had a reference to it you could clear it, move the rect and then re-add the rect but that's overly complicated and not do-able with GUI (since TriggerRegisterEnterRectSimple doesn't return the region).

A better solution would be to use the
Trigger:
Unit Group - Pick every unit in (Units within 666.00 of (Position of (Triggering unit)) matching (((Owner of (Matching unit)) is an enemy of (Owner of (Triggering unit))) Equal to True)) and do (Actions)
Loop - Actions
action.
This has the added benefit that it will select in a circular area around the unit, rather than a square/rectangle.
This action does leak a UnitGroup (and in this example a Point - Position of (Triggering unit)) but this can be fixed easily. Here's a tutorial on memory leaks.

Expand Region creation trigger from a map:
Fledermaus is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 06:08 AM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services