MoveRectTo
MoveRectTo
local region r = CreateRegion()
local rect r1 = Rect(xmin,ymin,xmax,ymax)
local rect r2 = Rect(xmin,ymin,xmax,ymax)
call RegionAddRect(r,r1)
call RegionAddRect(r,r2)
This doesn't even make sense. You can't move a region >.<.
- Region - MoveRegion
You can move a rect though
MoveRectTo
; )
You can combine rects by adding them to the same region.
JASS:local region r = CreateRegion() local rect r1 = Rect(xmin,ymin,xmax,ymax) local rect r2 = Rect(xmin,ymin,xmax,ymax) call RegionAddRect(r,r1) call RegionAddRect(r,r2)
In GUI, rects placed on the map are automatically added to a single region so that each rect on the map can also act as a region. This makes many GUI users think that their rects are in fact regions when this is not the case.
Rect variable names are gg_rct_RECT_NAME where all spaces in your name are replaced with underscores. You can access the rects on your map directly doing this and add them to a single region. From here, you can access your GUI trigger and register it with that region : ). This requires a bit of JASS knowledge to pull off : P.
Will i need to do all the triggers in JASS to reference the region? it seems (and you mightve said this, lol) that there are no regions in GUI, only rects
That's correct
native IsLocationInRegion takes region whichRegion, location whichLocation returns boolean
native IsPointInRegion takes region whichRegion, real x, real y returns boolean
native IsUnitInRegion takes region whichRegion, unit whichUnit returns boolean
native RegionAddCell takes region whichRegion, real x, real y returns nothing
native RegionAddCellAtLoc takes region whichRegion, location whichLocation returns nothing
native RegionAddRect takes region whichRegion, rect r returns nothing
native RegionClearCell takes region whichRegion, real x, real y returns nothing
native RegionClearCellAtLoc takes region whichRegion, location whichLocation returns nothing
native RegionClearRect takes region whichRegion, rect r returns nothing
native TriggerRegisterEnterRegion takes trigger whichTrigger, region whichRegion, boolexpr filter returns event
native TriggerRegisterLeaveRegion takes trigger whichTrigger, region whichRegion, boolexpr filter returns event
JASS:native IsLocationInRegion takes region whichRegion, location whichLocation returns boolean native IsPointInRegion takes region whichRegion, real x, real y returns boolean native IsUnitInRegion takes region whichRegion, unit whichUnit returns boolean native RegionAddCell takes region whichRegion, real x, real y returns nothing native RegionAddCellAtLoc takes region whichRegion, location whichLocation returns nothing native RegionAddRect takes region whichRegion, rect r returns nothing native RegionClearCell takes region whichRegion, real x, real y returns nothing native RegionClearCellAtLoc takes region whichRegion, location whichLocation returns nothing native RegionClearRect takes region whichRegion, rect r returns nothing native TriggerRegisterEnterRegion takes trigger whichTrigger, region whichRegion, boolexpr filter returns event native TriggerRegisterLeaveRegion takes trigger whichTrigger, region whichRegion, boolexpr filter returns event
function GetRandomInteger takes integer a returns boolean
return ( GetRandomInt(1, a) == 1 )
endfunction
function RandomSpawnInRegion takes integer unitid, integer chance, rect randomloc, region r returns nothing
set udg_Temp_Integer = 1
loop
exitwhen udg_Temp_Integer > 1
set udg_Temp_Point = GetRandomLocInRect(randomloc)
if (IsLocationInRegion(r, udg_Temp_Point)) then
if (GetRandomInteger(chance)) then
call CreateNUnitsAtLoc( 1, unitid, Player(PLAYER_NEUTRAL_AGGRESSIVE), udg_Temp_Point, bj_UNIT_FACING )
call RemoveLocation(udg_Temp_Point)
else
call RemoveLocation(udg_Temp_Point)
endif
set udg_Temp_Integer = 2
else
call RemoveLocation(udg_Temp_Point)
endif
endloop
endfunction
^The first two fixes I would do are to use CreateUnit instead of CreateNUnits...and only use the last RemoveLocation.
library RandomSpawnInRegion
function GetRandomInteger takes integer a returns boolean
return ( GetRandomInt(1, a) == 1 )
endfunction
function RandomSpawnInRegion takes integer unitid, integer chance, rect randomloc, region r returns nothing
set udg_Temp_Integer = 1
call DisplayTextToForce(GetPlayersAll(), "triggered3")
loop
exitwhen udg_Temp_Integer > 1
set udg_Temp_Point = GetRandomLocInRect(randomloc)
if (IsLocationInRegion(r, udg_Temp_Point)) then
call DisplayTextToForce(GetPlayersAll(), "triggered1")
if (GetRandomInteger(chance)) then
call DisplayTextToForce(GetPlayersAll(), "triggered2")
call CreateNUnitsAtLoc( 1, unitid, Player(PLAYER_NEUTRAL_AGGRESSIVE), udg_Temp_Point, bj_UNIT_FACING )
call RemoveLocation(udg_Temp_Point)
call DisplayTextToForce(GetPlayersAll(), "triggered")
set udg_Temp_Integer = 2
else
call RemoveLocation(udg_Temp_Point)
endif
else
call RemoveLocation(udg_Temp_Point)
endif
endloop
endfunction
endlibrary
JASS:library RandomSpawnInRegion function GetRandomInteger takes integer a returns boolean return ( GetRandomInt(1, a) == 1 ) endfunction function RandomSpawnInRegion takes integer unitid, integer chance, rect randomloc, region r returns nothing set udg_Temp_Integer = 1 call DisplayTextToForce(GetPlayersAll(), "triggered3") loop exitwhen udg_Temp_Integer > 1 set udg_Temp_Point = GetRandomLocInRect(randomloc) if (IsLocationInRegion(r, udg_Temp_Point)) then call DisplayTextToForce(GetPlayersAll(), "triggered1") if (GetRandomInteger(chance)) then call DisplayTextToForce(GetPlayersAll(), "triggered2") call CreateNUnitsAtLoc( 1, unitid, Player(PLAYER_NEUTRAL_AGGRESSIVE), udg_Temp_Point, bj_UNIT_FACING ) call RemoveLocation(udg_Temp_Point) call DisplayTextToForce(GetPlayersAll(), "triggered") set udg_Temp_Integer = 2 else call RemoveLocation(udg_Temp_Point) endif else call RemoveLocation(udg_Temp_Point) endif endloop endfunction endlibrary
This only returns "triggered3"....
call RandomSpawnInRegion('H00J', 1, gg_rct_Kobold_Overlap, KoboldSpawn) is what i used to call it. Whatd i do wrong? :s
bump
native MoveLocation takes location whichLocation, real newX, real newY returns nothing