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

Best way to simulate ports/doors

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,337
Hi,

What is the best way to simulate ports/doors, such as those in Pokemon or really any RPG, but I guess you can count things like Skyrim too. What I mean is when you enter a building you are actually in a separate map/room.

My first thought is waygate ability - the building literally has a waygate to its actual room. But is this prone to errors / leaks / bugs? And also you can make 2-way waygates dynamically too?

Most of my ports will actually be "dynamic," as in the ground (the location you enter) and the target (the location you arrive it) will not be set in stone, because these doors/ports can appear in any random spot of the map. Some ports will be set in stone (e.g. at coordinates X,Y you will always find the same port to coordinates Z,W).
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
to make it as simple as possible.

I would use a hastable and then check when unit enter region. Then move the unit.

Right but I would have to have the region ahead of time wouldn't I?

It's possible to dynamically generate regions at arbitrary coordinates in the map?
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
Rect() CreateRegion() RegionAddRect() RemoveRect()

You're looking for these I think

I don't suppose you have a pointer to a tutorial that explains how regions and rects work--my understanding is that regions are 2-D quadrilaterals. What are rects?

Also, when making regions that are always in the same spot, is it better to make them through the native call or just use the GUI and actually make the region in the editor?
 

Cokemonkey11

Spell Reviewer
Level 30
Joined
May 9, 2006
Messages
3,544
If you have JNGP their signatures should be pretty self explanatory. I'll fill in the rest -

rect is a 2d quadrilateral parallel to the game space. region is a union of rects.

Rect() creates a rect, RemoveRect() destroys one. CreateRegion() creates a rect. RegionAddRect() adds a rect to its space. If a rect is destroyed after its added to a region, the region's union will persist.

search the function list for "region" for a list of natives that operate on a region.

Also, when making regions that are always in the same spot, is it better to make them through the native call or just use the GUI and actually make the region in the editor?

I always make them in jass personally.
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
If you have JNGP their signatures should be pretty self explanatory. I'll fill in the rest -

rect is a 2d quadrilateral parallel to the game space. region is a union of rects.

Rect() creates a rect, RemoveRect() destroys one. CreateRegion() creates a rect. RegionAddRect() adds a rect to its space. If a rect is destroyed after its added to a region, the region's union will persist.

search the function list for "region" for a list of natives that operate on a region.



I always make them in jass personally.


If you make them in Jass then how do you know where they end up? Or do you have the coordinate system internalized :p ?

So if I understand correctly, it's just a thing of the GUI that you can't make regions with disjoint parts.

But using JASS I could define 4 rects each in the corner of the map, and then make that into a single region called Corners?
 

Cokemonkey11

Spell Reviewer
Level 30
Joined
May 9, 2006
Messages
3,544
So if I understand correctly, it's just a thing of the GUI that you can't make regions with disjoint parts.

It's just a difference in naming really (GUI also spells destructable/destructible differently than jass).

I think there was an editor, worldedit unlimited, that renamed it to rects for some reason. If you convert a GUI trigger to custom script you'll see that BJ functions simply don't ever return rect objects (i think)

But using JASS I could define 4 rects each in the corner of the map, and then make that into a single region called Corners?

Yes, as I understand that's how it works.
 
Status
Not open for further replies.
Top