| 10-22-2006, 09:39 PM | #1 |
Ok I have no idea why this trigger has started to crash WE. It definetly has end functions + endloops. It is basically a spawn trigger that spawns 2x 8 units and gives them a random orderlane to follow. The terrain I have has alot of paths splitting up and reforming and for that purpose units pick random paths to follow the call UnitIssueLaneOrder = a custom thing someone made for me with a custom script. It was working b4, since ive added more content is suddenly crashes. thx for any help JASS:function Trig_Spawn_Actions takes nothing returns nothing local unit c local integer i local integer r set i = 8 loop exitwhen i == 0 set c = CreateUnit(Player(13), udg_UnitTeam_Sc[i], 200, -4500, bj_UNIT_FACING ) set i = i - 1 set r = GetRandomInt(1,2) if r == 1 then set r = GetRandomInt(1,2) if r == 1 then call UnitIssueLaneOrder(c, Player(13), -3100,-2700, -4900,-1700, -6000,2500, -5400,5300, -7200,7200) elseif r == 2 then set r = GetRandomInt(1,2) if r == 1 then call UnitIssueLaneOrder(c, Player(13), -3100,-2700, -2900,300, -6000,2500, -5400,5300, -7200,7200) elseif r == 2 then set r = GetRandomInt(1,2) if r == 1 then call UnitIssueLaneOrder(c, Player(13), -3100,-2700, -2900,300, -2800,4800, -5400,5300, -7200,7200) elseif r == 2 then call UnitIssueLaneOrder(c, Player(13), -3100,-2700, -2900,300, -2800,4800, -5200,7400, -7200,7200) endif endif endif elseif r == 2 then set r = GetRandomInt(1,3) if r == 1 then set r = GetRandomInt(1,2) if r == 1 then call UnitIssueLaneOrder(c, Player(13), 200,-1100, -2900,300, -6000,2500, -5400,5300, -7200,7200) elseif r == 2 then set r = GetRandomInt(1,2) if r == 1 then call UnitIssueLaneOrder(c, Player(13), 200,-1100, -2900,300, -2800,4800, -5400,5300, -7200,7200) elseif r == 2 then call UnitIssueLaneOrder(c, Player(13), 200,-1100, -2900,300, -2800,4800, -5400,5300, -7200,7200) endif endif elseif r == 2 then set r = GetRandomInt(1,2) if r == 1 then set r = GetRandomInt(1,2) if r == 1 then call UnitIssueLaneOrder(c, Player(13), 200,-1100, 100,0, -1000,3100, -2800,4800, -5800,6400) elseif r == 2 then call UnitIssueLaneOrder(c, Player(13), 200,-1100, 100,0, -1000,3100, -2800,4800, -5800,8000) endif elseif r == 2 then set r = GetRandomInt(1,2) if r == 1 then call UnitIssueLaneOrder(c, Player(13), 200,-1100, 100,0, 1300.3100, 3100,4800, 6100,6400) elseif r == 2 then call UnitIssueLaneOrder(c, Player(13), 200,-1100, 100,0, 1300.3100, 3100,4800, 6100,8000) endif endif elseif r == 3 then set r = GetRandomInt(1,2) if r == 1 then call UnitIssueLaneOrder(c, Player(13), 200,-1100, 3200,300, 6300,2500, 5700,5300, 7200,7200) elseif r == 2 then set r = GetRandomInt(1,2) if r == 1 then call UnitIssueLaneOrder(c, Player(13), 200,-1100, 3200,300, 3100,4800, 5700,5300, -7200,7200) elseif r == 2 then call UnitIssueLaneOrder(c, Player(13), 200,-1100, 3200,300, 3100,4800, 5500,7400, -7200,7200) endif endif endif endif endloop set i = 8 loop exitwhen i == 0 set c = CreateUnit(Player(13), udg_UnitTeam_Sc[i], 500, -4500, bj_UNIT_FACING ) set i = i - 1 set r = GetRandomInt(1,2) if r == 1 then set r = GetRandomInt(1,2) if r == 1 then call UnitIssueLaneOrder(c, Player(13), 3300,-2700, 5200,-1700, 6200,2500, 5700,5300, 7200,7200) elseif r == 2 then set r = GetRandomInt(1,2) if r == 1 then call UnitIssueLaneOrder(c, Player(13), 3300,-2700, 3100,300, 6200,2500, 5700,5300, 7200,7200) elseif r == 2 then set r = GetRandomInt(1,2) if r == 1 then call UnitIssueLaneOrder(c, Player(13), 3300,-2700, 3100,300, 3100,4800, 5700,5300, 7200,7200) elseif r == 2 then call UnitIssueLaneOrder(c, Player(13), 3300,-2700, 3100,300, 3100,4800, 5500,7400, 7200,7200) endif endif endif elseif r == 2 then set r = GetRandomInt(1,3) if r == 1 then set r = GetRandomInt(1,2) if r == 1 then call UnitIssueLaneOrder(c, Player(13), 200,-1100, -2900,300, -6000,2500, -5400,5300, -7200,7200) elseif r == 2 then set r = GetRandomInt(1,2) if r == 1 then call UnitIssueLaneOrder(c, Player(13), 200,-1100, -2900,300, -2800,4800, -5400,5300, -7200,7200) elseif r == 2 then call UnitIssueLaneOrder(c, Player(13), 200,-1100, -2900,300, -2800,4800, -5400,5300, -7200,7200) endif endif elseif r == 2 then set r = GetRandomInt(1,2) if r == 1 then set r = GetRandomInt(1,2) if r == 1 then call UnitIssueLaneOrder(c, Player(13), 200,-1100, 100,0, -1000,3100, -2800,4800, -5800,6400) elseif r == 2 then call UnitIssueLaneOrder(c, Player(13), 200,-1100, 100,0, -1000,3100, -2800,4800, -5800,8000) endif elseif r == 2 then set r = GetRandomInt(1,2) if r == 1 then call UnitIssueLaneOrder(c, Player(13), 200,-1100, 100,0, 1300.3100, 3100,4800, 6100,6400) elseif r == 2 then call UnitIssueLaneOrder(c, Player(13), 200,-1100, 100,0, 1300.3100, 3100,4800, 6100,8000) endif endif elseif r == 3 then set r = GetRandomInt(1,2) if r == 1 then call UnitIssueLaneOrder(c, Player(13), 200,-1100, 3200,300, 6300,2500, 5700,5300, 7200,7200) elseif r == 2 then set r = GetRandomInt(1,2) if r == 1 then call UnitIssueLaneOrder(c, Player(13), 200,-1100, 3200,300, 3100,4800, 5700,5300, -7200,7200) elseif r == 2 then call UnitIssueLaneOrder(c, Player(13), 200,-1100, 3200,300, 3100,4800, 5500,7400, -7200,7200) endif endif endif endif endloop endfunction //=========================================================================== function InitTrig_Spawn takes nothing returns nothing set gg_trg_Spawn = CreateTrigger( ) call TriggerRegisterTimerEventPeriodic( gg_trg_Spawn, 30.00 ) call TriggerAddAction( gg_trg_Spawn, function Trig_Spawn_Actions ) endfunction |
| 10-22-2006, 10:33 PM | #2 |
Well, if I just try out what you posted in a trigger, the WE gives an error message while saving because it can't know this "UnitIssueLaneOrder". So probably it's nevertheless a problem with this function and to let us correct it, you have to post it, too! Other than that, this trigger really seems to be correct... |
| 10-22-2006, 11:15 PM | #3 |
ok sure, made by chuck JASS:function KillUnitCurrentLaneOrder takes unit u returns nothing local string s = "[LaneOrders]" + GetAttachmentTable(u) call DestroyTable(s) endfunction function UnitIssueLaneOrder_Child takes nothing returns nothing local real array XY local unit u = GetTableUnit("[GlobalInfo]","u") local player p = Player(GetTableInt("[GlobalInfo]","p")) local integer i = 0 local rect array r local string s = "[LaneOrders]" + GetAttachmentTable(u) local integer t = 0 call SetTableInt(s,"LaneOrders",1) loop exitwhen i > 4 set XY[i] = GetTableReal(s,"RealX"+I2S(i)) set XY[i+5] = GetTableReal(s,"RealY"+I2S(i)) //call BJDebugMsg("X - "+R2S(XY[i])+" Y - "+R2S(XY[i+5])) if HaveStoredInteger(CSCache(),"[LaneOrders]",R2S(XY[i])+R2S(XY[i+5])) then set r[i] = GetTableRect("[LaneOrders]",R2S(XY[i])+R2S(XY[i+5])) else set r[i] = GetRectFromCircle(XY[i],XY[i+5],250) call SetTableObject("[LaneOrders]",R2S(XY[i])+R2S(XY[i+5]),r[i]) endif set i = i + 1 endloop set i = 0 loop call SetTableInt(s,"LaneZone",i) exitwhen i > 4 or not HaveStoredInteger(CSCache(),s,"LaneOrders") loop exitwhen GetOwningPlayer(u) == p or not HaveStoredInteger(CSCache(),s,"LaneOrders") call PolledWait2(1) endloop call IssuePointOrder(u,"attack",XY[i],XY[i+5]) loop call PolledWait2(1) set t = t + 1 if t > 5 then set t = 0 call IssuePointOrder(u,"attack",XY[i],XY[i+5]) endif exitwhen RectContainsCoords(r[i],GetUnitX(u),GetUnitY(u)) or not HaveStoredInteger(CSCache(),s,"LaneOrders") endloop set r[i] = null set i = i + 1 endloop call DestroyTable(s) set u = null endfunction function UnitIssueLaneOrder takes unit u, player p, real x1, real y1, real x2, real y2, real x3, real y3, real x4, real y4, real x5, real y5 returns nothing local real array XY local integer i = 0 local string s = "[LaneOrders]" + GetAttachmentTable(u) set XY[0]=x1 set XY[1]=x2 set XY[2]=x3 set XY[3]=x4 set XY[4]=x5 set XY[5]=y1 set XY[6]=y2 set XY[7]=y3 set XY[8]=y4 set XY[9]=y5 call KillUnitCurrentLaneOrder(u) loop exitwhen i > 9 if i<=4 then call SetTableReal(s,"RealX"+I2S(i),XY[i]) call BJDebugMsg("X["+I2S(i)+"] = "+R2S(XY[i])+" Y["+I2S(i+5)+"] = "+R2S(XY[i+5])) elseif i>=5 and i<=9 then call SetTableReal(s,"RealY"+I2S(i-5),XY[i]) endif set i = i + 1 endloop call SetTableObject("[GlobalInfo]","u",u) call SetTableInt("[GlobalInfo]","p",GetPlayerId(p)) //Hand off control to the child process call ExecuteFunc("UnitIssueLaneOrder_Child") //Clean out stuff call FlushStoredInteger(CSCache(),"[GlobalInfo]","u") call FlushStoredInteger(CSCache(),"[GlobalInfo]","p") endfunction function UnitIssueMatchingLaneOrder takes unit source, unit targ returns nothing local string s1 = "[LaneOrders]" + GetAttachmentTable(targ) local string s2 = "[LaneOrders]" + GetAttachmentTable(source) local integer i = GetTableInt(s2,"LaneZone") local integer c = 0 local real array XY loop exitwhen c > 4 if c <= i then set XY[c]=GetTableReal(s2,"RealX"+I2S(i)) set XY[c+5]=GetTableReal(s2,"RealY"+I2S(i)) else set XY[c]=GetTableReal(s2,"RealX"+I2S(c)) set XY[c+5]=GetTableReal(s2,"RealY"+I2S(c)) endif set c = c + 1 endloop call UnitIssueLaneOrder(targ,GetOwningPlayer(targ),XY[0],XY[5],XY[1],XY[6],XY[2],XY[7],XY[3],XY[8],XY[4],XY[9]) endfunction //=========================================================================== function InitTrig_UnitIssueOrderPointToPoint takes nothing returns nothing endfunction |
| 10-23-2006, 12:00 AM | #4 |
Hmm, gonna look more. I suggest only issuing a single lane order to the unit, and see if thats the issue. Edit: Your code indentation sucks. The standard is a tab, or since tab doesn't work in the WE, 4 spaces for all code inside IF statements and in loops(just to make it easier to read) |
| 10-23-2006, 12:02 AM | #5 |
huh?? JASS:set i = i - 1 EDIT: I did that so that I would always remember to put an endif and not miss one out. |
| 10-23-2006, 12:39 AM | #6 | |
Quote:
Use ctrl tab |
| 10-23-2006, 02:54 PM | #7 |
Well, I don't have this table system chuck's code is based on, but other than that, it still works for me (error output, but no crash of WE). |
| 10-23-2006, 05:22 PM | #8 |
JASS:call UnitIssueLaneOrder(c, Player(13), 200,-1100, 100,0, 1300.3100, 3100,4800, 6100,6400) and JASS:call UnitIssueLaneOrder(c, Player(13), 200,-1100, 100,0, 1300.3100, 3100,4800, 6100,8000) They both have a decimal instead of a comma. |
