- Joined
- Feb 11, 2011
- Messages
- 1,860
Hi guys,
I am working on a map and I am having a problem. I have a region (made with the Region Palette), and when a unit enters the region I want to move the region to a random point within another region (Arena). It works when the unit enters the region the first time, but when it enters the newly moved region it doesn't trigger. Any ideas? What am I doing wrong? Here is my script:
To Simplify: I move the region 'belonging' to the owner of the entering unit (each player has their own region that triggers for their hero only).
If something isn't clear, ask me. Thanks!
I am working on a map and I am having a problem. I have a region (made with the Region Palette), and when a unit enters the region I want to move the region to a random point within another region (Arena). It works when the unit enters the region the first time, but when it enters the newly moved region it doesn't trigger. Any ideas? What am I doing wrong? Here is my script:
-
Variable Setup
-
Events
- Map initialization
- Conditions
-
Actions
- Set AI_Search[1] = AI 1 Move <gen>
- Set AI_Search[2] = AI 2 Move <gen>
- Set AI_Search[3] = AI 3 Move <gen>
- Set AI_Search[4] = AI 4 Move <gen>
-
Events
-
AI Search New
-
Events
- Unit - A unit enters AI 1 Move <gen>
- Unit - A unit enters AI 2 Move <gen>
- Unit - A unit enters AI 3 Move <gen>
- Unit - A unit enters AI 4 Move <gen>
- Conditions
-
Actions
- Custom script: call AI_Search_New(GetTriggerUnit())
-
Events
JASS:
function AI_Search_New takes unit u returns nothing
local real x
local real y
set x = GetRandomReal(GetRectMinX(gg_rct_Arena), GetRectMaxX(gg_rct_Arena))
set y = GetRandomReal(GetRectMinY(gg_rct_Arena), GetRectMaxY(gg_rct_Arena))
call MoveRectTo(udg_AI_Search[GetConvertedPlayerId(GetOwningPlayer(u))], x, y) //Moving the owning player's region.
set u = null
endfunction
If something isn't clear, ask me. Thanks!