HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Jass + Gui + Question

01-26-2007, 10:45 PM#1
Mythic Fr0st
Ok, im writting a script for a friend, that changes the terrain pathing in a rect, to anphibious, although I am testing with buildability

however, it doesn't work

GUI part
rct[0] is a region over playable map area, which doesnt work either
(I originally just thought playble map area didnt work, but its the trigger)
Trigger:
Load Rects
Collapse Events
Map initialization
Conditions
Collapse Actions
Set rct[0] = Region 101 <gen> // (suppost to be playable map area)
-------- DO NOT set Low_Index to 0 --------
Set Low_Index = 1
-------- Low_Index --------
-------- to be set to the lowest number in the brackets [] (IGNORE rct[0] --------
Set rct[1] = Region 000 <gen>
Set rct[2] = Region 001 <gen>
Set rct[3] = Region 002 <gen>
Set rct[4] = Region 003 <gen>
Set rct[5] = Region 004 <gen>
Set High_Index = 5
-------- High_Index --------
-------- to be set to the last number in the [] brackets (being the highest number of them all) --------


Jass part
Collapse JASS:
function Trig_Multi_Actions takes nothing returns nothing
local real x_start = 0
local real y_start = 0
local real x = x_start
local real y = y_start
local real x_end = 0
local real y_end = 0
loop
    exitwhen udg_Low_Index >= udg_High_Index
    set x_end = GetRectMaxX(udg_rct[udg_Low_Index])
    set y_end = GetRectMaxY(udg_rct[udg_Low_Index])
    set y_start = GetRectMinY(udg_rct[udg_Low_Index])
    set x_start = GetRectMinX(udg_rct[udg_Low_Index])
    set x = x_start
    set y = y_start
    call DisplayTextToForce( GetPlayersAll(), "X_END "+R2S(x_end)+", Y_END "+R2S(y_end)+", x "+R2S(x)+", y "+R2S(y))
    loop
        exitwhen x >= x_end+32
        call SetTerrainPathableBJ(Location(x, y), PATHING_TYPE_BUILDABILITY, false )
        //call SetTerrainPathableBJ( Location(1.00, 0), PATHING_TYPE_AMPHIBIOUSPATHING, false )
        set y = y + 32
        if y >= y_end then
            set x = x + 32
            set y = y_start
        endif
    endloop
    set udg_Low_Index = udg_Low_Index + 1
endloop
endfunction

//===========================================================================
function InitTrig_Multi takes nothing returns nothing
    set gg_trg_Multi = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Multi, function Trig_Multi_Actions )
endfunction

nothing happens, no text message, is it perhaps, because I am looping twice?
01-26-2007, 11:25 PM#2
Alevice
I don't see any events that would fire the second trigger. Or any action the the other trigger that would.
01-26-2007, 11:45 PM#3
Mythic Fr0st
aah, sorry, it runs on map initilization

I tried a trigger

- run "Multi" from the GUI part aswell, didnt work
01-27-2007, 01:41 AM#4
Vexorian
Try putting
Trigger:
stuff
Custom Script : call ExecuteFunc("Trig_Multi_Actions")
at the end of the first trigger.

I don't trust to much that >= in the loop, I think you wanted a > there
01-27-2007, 01:44 AM#5
Mythic Fr0st
Thanks, that did it, the custom script, and I changed the loop aswell

Btw, why didnt this trigger execute? it was set to run on map init?
01-27-2007, 10:22 AM#6
The)TideHunter(
Quote:
Originally Posted by Mythic Fr0st
Thanks, that did it, the custom script, and I changed the loop aswell

Btw, why didnt this trigger execute? it was set to run on map init?

Dont know. But map init isent always the best solution, it can have problems. To be safe use Elapsed Time at 0.00.
01-27-2007, 01:37 PM#7
iNfraNe
The trigger probably ran, but before the other "setting" trigger did, so it would instantly exit the loop since low==high.