| 09-27-2008, 06:07 AM | #1 |
I want to create these on map initialization. Is this the correct way to do it in JASS? The intent of this is to create one region for each player, all having the same dimensions for later use. As in later, I mean about 45+ minutes into the game. JASS:scope RegionInitializer globals public rect array FOUNT_RECT_PLAYER public region array FOUNT_REGION_PLAYER private constant real RECT_MAX_X = -1248 private constant real RECT_MIN_X = -896 private constant real RECT_MAX_Y = 2048 private constant real RECT_MIN_Y = 1696 endglobals private function Act takes nothing returns nothing local integer i = 0 loop set FOUNT_REGION_PLAYER[i] = CreateRegion() set i = i+1 exitwhen i == 11 endloop set i = 0 loop call SetRect(FOUNT_RECT_PLAYER[i], RECT_MIN_X, RECT_MIN_Y, RECT_MAX_X, RECT_MAX_Y) call RegionAddRect(FOUNT_REGION_PLAYER[i], FOUNT_RECT_PLAYER[i]) set i = i+1 exitwhen i == 11 endloop endfunction private function InitTrig takes nothing returns nothing local trigger trg = CreateTrigger() call TriggerAddAction(trg, function Act) call DestroyTrigger(trg) endfunction endscope edit: forgot the endscope, xD |
| 09-27-2008, 06:49 AM | #2 |
Yes, you are. But you probably don't wanna destroy your trigger at map init. |
| 09-27-2008, 08:26 PM | #3 |
scope RegionInitializer initializer InitTrig
@ Vestras:do the characters on your avatar mean Shio? |
| 09-29-2008, 06:06 AM | #4 |
Yeah... what? Destroying trg right after you add actions doesn't seem to really do anything. That and you didn't register an event in the first place. |
| 09-30-2008, 04:36 PM | #5 | |
OK, thanks for the help guys; I'll be testing it soon. Quote:
Yea, when I converted a gui map initialization event into JASS, there was no event. |
| 10-01-2008, 04:46 AM | #6 |
Oh, okay. It's because one of the trigger 'options' checkboxes is now "Run at Map initialization". However, since you didn't say that you did that it made no sense to me. Destroying the trigger immediately after adding actions still does nothing, though, no matter when the trigger is 'run'. |
