• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[JASS] Need help on types rect and region and a releated function

Status
Not open for further replies.
Level 5
Joined
May 2, 2005
Messages
40
I was scouting around API Browser and faund a function

native IsLocationInRegion()
which takes region, location and returns boolean.

I wonder what is region type stands for?
What is the differnce between rect and region?

I found it when im trying to find a condition.
I have a unit which moves to random location around itself and it has loctus ability which makes it, can move outside from playable map area.

I dont want to use Neutral-Wander ability for some reason

And i was trying to make such a code:
Code:
    loop
       exitwhen(IsLocationInRegion (CheckPoint,GoToPoint))
       set GoToPoint = GetRandomLocInRect(CenteredRect)
    endloop

CheckPoint must be a region type variable
I also found that function releated to region:
RegionAddRect()
which takes region, rect and returns nothing

I have tried to create a region variable and add the playable map area to region and tried the condition above again with this codes but does not worked either:

Code:
local region = CreateRegion()
local rect Map = GetPlayableMapRect()
call RegionAddRect(CheckPoint,Map)
    loop
       exitwhen(IsLocationInRegion (CheckPoint,GoToPoint))
       set GoToPoint = GetRandomLocInRect(CenteredRect)
    endloop

Does anyone have something about this problem?
Ty
 
Level 12
Joined
Mar 11, 2004
Messages
600
rect (what world editor calls region for no reason) It is a rectangle

region : Can have any shape and is also used for enter/leave events .


A region is a group of points you can even add a rect to a region or remove a rect from a region, regions are cool because they can have any shape.

On normal WE you can't use region global variables because blizzard is retarded. But with some modifications you can make WE do so.
 
Level 5
Joined
May 2, 2005
Messages
40
so theorically
if i create a rect and aasign it forex playable map area and add that rect to a region

then region becomes playable map area?
if yes why that function newer returns true?

exitwhen(IsLocationInRegion (CheckPoint,GoToPoint))

i have tried it and it loops forever and disables the trigger.
 
Status
Not open for further replies.
Top