• 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] Movable Regions Issue...

Status
Not open for further replies.
Level 5
Joined
Jun 5, 2007
Messages
99
Hey everyone. I'm having some issues getting these triggers to work right. I did a little searching, and did not find anything. (Sorry if I skimmed over this if it has been solved.)

Anyway, the idea is that the player can type "portal a" and spawn a portal, and type "player b" and spawn another portal. These portals can be switched out at any time by typing the command.

EDIT: My bad... I wrote the problem then erased it by mistake. The issue I "think" is that the region is not moving to where the unit is where he types the command.

I have the following variables:

Variable Name . . . Variable Type . Initial Value
VariablePortal_A . . . . . Region . . . . . - None -
VariablePortal_B . . . . . Region . . . . . - None -
PortModelA . . . . . . Destructible . . - None -
PortModelB . . . . . . Destructible . . - None -

And the following trigggers

  • SpawnPortalA
    • Events
      • Player - Player 1 (Red) types a chat message containing SPAWN A as An exact match
    • Conditions
    • Actions
      • Region - Center PortalA <gen> on (Position of Blood Mage 0000 <gen>)
      • Destructible - Kill PortModelA
      • Wait 0.01 seconds
      • Destructible - Create a Shimmering Portal at (Position of Blood Mage 0000 <gen>) facing (Facing of Blood Mage 0000 <gen>) with scale 1.00 and variation 0
      • Set PortModelA = (Last created destructible)
  • SpawnPortalB
    • Events
      • Player - Player 1 (Red) types a chat message containing SPAWN B as An exact match
    • Conditions
    • Actions
      • Region - Center PortalB <gen> on (Position of Blood Mage 0000 <gen>)
      • Destructible - Kill PortModelB
      • Wait 0.01 seconds
      • Destructible - Create a Shimmering Portal at (Position of Blood Mage 0000 <gen>) facing (Facing of Blood Mage 0000 <gen>) with scale 1.00 and variation 0
      • Set PortModelB = (Last created destructible)
  • FromAtoB
    • Events
      • Unit - A unit enters PortalA <gen>
    • Conditions
    • Actions
      • Unit - Move (Entering unit) instantly to (Center of PortalB <gen>)
      • Wait 0.01 seconds
      • Trigger - Turn off (This trigger)
      • Trigger - Turn off FromBtoA <gen>
      • Wait 0.01 seconds
      • Trigger - Turn on (This trigger)
      • Trigger - Turn on FromBtoA <gen>
  • FromBtoA
    • Events
      • Unit - A unit enters PortalB <gen>
    • Conditions
    • Actions
      • Unit - Move (Entering unit) instantly to (Center of PortalA <gen>)
      • Wait 0.01 seconds
      • Trigger - Turn off (This trigger)
      • Trigger - Turn off FromAtoB <gen>
      • Wait 0.01 seconds
      • Trigger - Turn on (This trigger)
      • Trigger - Turn on FromAtoB <gen>
The portals spawn and die correctly, in the exact position, with the exact facement. The Wait I have with the movement triggers is to prevent the game crashing when going back and forth between the same region. (I learned the hard way what happens if you port to a region that ports back to the region that sent you there...)

Thanks for the help in advance. :)
 

Attachments

  • test.w3x
    44.3 KB · Views: 41
Last edited:
Level 12
Joined
Apr 27, 2008
Messages
1,228
You did not state your problem very clearly( For some one to figure it, he must examine all the code).
One thing that comes to my mind:
Why regions? Why not rects?
 
Level 5
Joined
Jun 5, 2007
Messages
99
1. My bad, I wrote the problem earlier but must have erased it by mistake. Sorry about that. I think the problem is that the region is not moving to the unit when the command is entered.

2. I am still a noob to triggering, so I have no idea how to do it. Im going to assume a Rect is a rectangle, but I don't know what to do to set one.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
Go trigger editor. Pres Ctrl + B.
Find the variables Portal_A and Portal_B.
Edit them - change their type, from region to rect.
 
Level 5
Joined
Jun 5, 2007
Messages
99
I can't seem to find anything close to that in the Variable types. The closest I can get is "Region" or "Point".
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
Spiwn you have missed some various facts on Gui vs Jass...

Gui -> Jass
unit group -> group
player group -> force
region -> rect

Which means, his regions are rects, but in gui it is stated wrong.
And rect as an option doesn't exist anyways, in gui...

The reason why it isn't moving could be because you haven't defined it's size...
Sure, you center the region, but the size is undefined.

As it seems for your FromAtoB trigger you have an event which asks when you enter portal_B and then moves the unit to Portal_B
I assume the event should be "Enter portal_A"
 
Level 5
Joined
Jun 5, 2007
Messages
99
Eccho, thanks for spottng that. Fixed now.

As for the actual trigger, Im going back to using the <gen> regions that I have. Going to test it now, Ill let you know in a sec if it works.

EDIT: Alright, it must be a size issue then, partly. I went to the actual locations of the regions preset on the map, after spawning the portals. Region A does indeed take me to PORTAL B, while Region B takes me to Portal A. If I step off the portal, and try to re-enter, nothing happens.

Any thoughts?

EDIT2: I renamed the variables & commands, to avoid confusion. (Everything called PortalA or very close gets annoying.) The new triggers / variables are now updated above.
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
Hm well, the problem is actually, that this is a messup thingy in Gui.

When you create a "unit events region" it actually creates a "region" which we cant see (not a gui region, but an actual "region" when looking at it in jass). And well, it is registring this "jass region" when a unit enters it, not the actual Portal_A <gen> rect. So even though you center the region on another place, it needs to create a new unit enters region event. This will end up by double leaking event since the old (jass) region is never destroyed.
I know this is very confusing...

And well, I have no solution to this at the moment. But I promise I am looking for a solution now, as soon as possible.
 
Level 5
Joined
Jun 5, 2007
Messages
99
I somewhat understand the problem, but I have no idea what JASS is, how it works, or even if I have to download anything or not for it in WC3... Nor do I know enough to try to find somework-around for it in the GUI.

I am toying with a few different triggers, hoping to find a decent solution, but nothing. I did run into some kind of trigger where it can create points at an offset to a point. If I understood it right, I could basically create a region by using the unit as the point to offset the other 4 points by, which I could then turn that region into a variable, and move the variable to the unit. Then again, I could be totally wrong.

Hopefully your search is turning out with some good results... Im really hoping to get this working. If not, then it will be yet another idea of mine that has to be scrapped. >.<
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
The reason I picked up rects and regions is this:
"Region - Center PortalA <gen> on (Position of Blood Mage 0000 <gen>)"
Does it move regions or does it move rects :D
(honestly, didn't spend much time playing with gui before moving to jass, so there are these function I am not very familiar with)
I think that using:
Unit - A unit enters PortalB <gen>
Will not cause any leaks if you move the rect.
So not to have any problems, create 2 rects in the WE(main window) and store both of them in Portal_A and Portal_B(in the initialization trigger).
 
Level 5
Joined
Jun 5, 2007
Messages
99
They already are set to the variable through the Initialization trigger. No matter if the events are set to the variable, the actual region, or both, I cannot go through the portal. However if I go to the regions (which now have weather to help locate them in the test), I appear at the correct portal. I just cannot move those "sending" regions.
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
Spiwn dont you understand? A Gui Region is A Rect!
PortalA <gen> is a rect.... PortalB <gen> is a rect...
The event however, is a region. It doesn't matter if you move the rect. No it will not leak I know that. The rect is simply a part of a region if you want to, in this case the rect has the same size as the region.

The problem: Moving a rect allowing it to have new coordinates will not affect the region.
Also, if you registers the unit enters region again, with the new rect coordinates, this will create a second region... But the first will remain and bug the game

I think I found a way to help you Saryeit... But I need just alittle more time :>
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
Then you need the help of Jass.
Since you say you do not even know what that is I will explain:
Jass is a programming language made by blizzard. It tells wc3 what to do.
The GUI(the way you have been triggering so far(Graphical User Interface) is a sort of a mask, that allows users with little to no programming knowledge to trigger).
To have access to Jass you simply select a trigger click the edit button and then convert trigger to custom text. Be careful not to convert something you do not want to text(you'd have to click a lot of undo-s!!!
Make a global variable of type region(the real region) use them in the event registering and move them around in the triggers.
Ah, probably you will not get what I said(last part), but here is like 3:20 AM.
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
Spiwn, the problem remains, that I think he isn't using Jass Newgen Pack... without it he can't create custom globals since it will lead to a syntax error in world editor stating that "globals" already exists
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
It does not require a globals block, but it still requires JNGP(you can create the variables the standard way).
I will quote emp3ror_d3st (sorry about spelling :p ):
Learn Jass ;)
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
Hence, he wants it in Gui...

Anywho, then normal way? "real" Region is not an option in the variables window.

Saryeit: I might have the solution... I just need to ask. Is the rect square sized? I mean the PortalA and PortalB <gen>
 
Level 5
Joined
Jun 5, 2007
Messages
99
I copied the Initialization trigger to be able to convert one to JASS to see what I may be up against in the future... I have a lot to learn.

Also, no luck on fixing the issue myself. I am downloading the JNGP right now... Hoping my old maps dont get screwed up...

EDIT: Downloaded and extracted it... Then my virus protection came up. Apparenetly "NewGen WE.exe" has infection: Win32/VMalum.CDSG and google comes up with nothing... Whats this about?
 
Level 5
Joined
Jun 5, 2007
Messages
99
BLAH! I JUST installed it too! rofl.

In that case, any solution that can use the GUI or non-JNGP or w/e its called JASS?
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
JNGP is not having any virus. It shouldn't have anyways. It could be that your virus program is too sensitive.

Anyway I asked you before, is the PortalA gen and the PortalB gen square-shaped?
 
Level 5
Joined
Jun 5, 2007
Messages
99
Perfectly square, they look it. "Rectangles" yes, I don't know how to make regions any other shape.
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
okay... hey, I think I found a way. The question I just asked was irrelevant :>

It is involving some jass, but it is easy to do due to the fact that there is a Triggeraction called "custom script".

  • SpawnPortalA
    • Events
      • Player - Player 1 (Red) types a chat message containing SPAWN A as An exact match
    • Conditions
    • Actions
      • Region - Center PortalA <gen> on (Position of Blood Mage 0000 <gen>)
      • Trigger - Add to (FromAtoB <gen>) the event (Unit - A unit enters PortalA <gen>)
      • Destructible - Kill PortModelA
      • Wait 0.01 seconds
      • Destructible - Create a Shimmering Portal at (Position of Blood Mage 0000 <gen>) facing (Facing of Blood Mage 0000 <gen>) with scale 1.00 and variation 0
      • Set PortModelA = (Last created destructible)
  • SpawnPortalB
    • Events
      • Player - Player 1 (Red) types a chat message containing SPAWN B as An exact match
    • Conditions
    • Actions
      • Region - Center PortalB <gen> on (Position of Blood Mage 0000 <gen>)
      • Trigger - Add to (FromBtoA <gen>) the event (Unit - A unit enters PortalB <gen>)
      • Destructible - Kill PortModelB
      • Wait 0.01 seconds
      • Destructible - Create a Shimmering Portal at (Position of Blood Mage 0000 <gen>) facing (Facing of Blood Mage 0000 <gen>) with scale 1.00 and variation 0
      • Set PortModelB = (Last created destructible)
  • FromAtoB
    • Events
      • ---This event list should be empty---
    • Conditions
    • Actions
      • Custom script - call RemoveRegion(GetTriggeringRegion)
      • Trigger - Add to (This trigger) the event (Unit - A unit enters PortalA <gen>)
      • Unit - Move (Entering unit) instantly to (Center of PortalB <gen>)
      • Wait 0.01 seconds
      • Trigger - Turn off (This trigger)
      • Trigger - Turn off FromBtoA <gen>
      • Wait 0.01 seconds
      • Trigger - Turn on (This trigger)
      • Trigger - Turn on FromBtoA <gen>
  • FromBtoA
    • Events
      • ---This event list should be empty---
    • Conditions
    • Actions
      • Custom script - call RemoveRegion(GetTriggeringRegion)
      • Trigger - Add to (This trigger) the event (Unit - A unit enters PortalB <gen>)
      • Unit - Move (Entering unit) instantly to (Center of PortalA <gen>)
      • Wait 0.01 seconds
      • Trigger - Turn off (This trigger)
      • Trigger - Turn off FromAtoB <gen>
      • Wait 0.01 seconds
      • Trigger - Turn on (This trigger)
      • Trigger - Turn on FromAtoB <gen>
This would eventually leave a major amount of events just taking up space in the memory, since they will never happend again. But well, it is the closest way you can solve this in gui.

Well, it should work, though I have not tested it yet. But lets hope it does
 
Last edited:
Level 5
Joined
Jun 5, 2007
Messages
99
Thank you, Ill let you know the results shortly.

EDIT: AHH! That didnt work at all...
I can spawn portals, but now if I re-enter the region, another portal spawned... I didnt get a chance to test the pre-generated regions before I had so much lag due to tons of portals...

Before I even got in the test, FromAtoB and FromBtoA got disabled automatically due to errors. Looking at the error, its

call RemoveRegion(GetTriggeringRegion)

is highlighted. At the top it says...

Line 29 Expected '('


I cannot re-enable because of that error.

  • FromAtoB
    • Events
    • Conditions
    • Actions
      • Custom script: call RemoveRegion(GetTriggeringRegion)
      • Trigger - Add to (This trigger) the event (Unit - A unit enters PortalA <gen>)
      • Unit - Move (Entering unit) instantly to (Center of VariablePortal_B)
      • Wait 0.01 seconds
      • Trigger - Turn off (This trigger)
      • Trigger - Turn off FromBtoA <gen>
      • Wait 0.01 seconds
      • Trigger - Turn on (This trigger)
      • Trigger - Turn on FromBtoA <gen>
  • FromBtoA
    • Events
    • Conditions
    • Actions
      • Custom script: call RemoveRegion(GetTriggeringRegion)
      • Trigger - Add to (This trigger) the event (Unit - A unit enters PortalB <gen>)
      • Unit - Move (Entering unit) instantly to (Center of VariablePortal_A)
      • Wait 0.01 seconds
      • Trigger - Turn off (This trigger)
      • Trigger - Turn off FromAtoB <gen>
      • Wait 0.01 seconds
      • Trigger - Turn on (This trigger)
      • Trigger - Turn on FromAtoB <gen>
Also, should the "Add Event" trigger be used in the Spawning triggers? I think thats what caused the massive spawning.

EDIT: Modified the code to your updated code... Now it makes more sense to me, but the custom script kills the triggers.

EDIT AGAIN lol: Also, it looks to me the custom script is trying to delete the portal alltogether once used, which is not the case. Im probably wrong, but Im trying to keep two portals open permanently until another one is spawned, which changes its place.
 
Last edited:
Level 23
Joined
Nov 29, 2006
Messages
2,482
Your Edit Again said:
Also, it looks to me the custom script is trying to delete the portal alltogether once used, which is not the case. Im probably wrong, but Im trying to keep two portals open permanently until another one is spawned, which changes its place.

Nope you got it all wrong:p The thing is, that it will only destroy the current region, so that an "updated" rect with new coodinates will be added if you type the message again.
Since this cant be solved properly in gui (you cant store the real region) you have to destroy it everytime it is used, and then register it again.


Well yeah, I did see you ahd replied. Also I know about the syntax... It was my bad :S

It should be GetTriggeringRegion()
I mean: Custom script: call RemoveRegion(GetTriggeringRegion())

My bad... Try that
 
Status
Not open for further replies.
Top