yeah, so i am working on this random dungeons thingy, and whenever i try to save it, my JNGP crashes. it does this while jasshelper is processing the scripts.
show teh code!
JASS:
//randomdungeons v1.0, by hijax.//to use this, you need a wall building. its unitid must be h100//usage: call walls(mapw, maph, wallz, dnsz)//dnsz is the length of the corridors.//wallz is the colsize of your wall unit. it is advised to be high.//mapw is the amount of walls that can fit horizontally on your map//maph is the vertical version of mapw//call spawnboss(boss1, boss2, boss3, boss4) to spawn bosses. read the comments on the//function for instructions on how to expand it//this is a work in progress.//the supposed start location is stored in the global variable startloc.//========================================structpositionintegeriintegerjendstructglobalspositionarraybospla[7]=position.createlocationarraybosplaloc[7]
integerbosnum=0locationstartloclocationarrayroomloc[500]
endglobalslibrarypathsfunctionwallstakesintegermapw, integermaph, integerwallz, integerdnszreturnsnothing//localslocalintegeri=0// aka xlocalintegern=0//the next directionlocalintegerl=0//stores what direction we last moved inlocalintegerj=0//aka ylocalintegerw=0localintegerz=0//used to determine if we're done 'dungeoning'localintegerarrayudg_map[mapw][maph]
//first, we fill the array with 1'sloopexitwheni>mapwsetj=0loopexitwhenj>maphsetudg_map[i][j]=1setj=j+1endloopseti=i+1endloop//then, we clear a 'path' of 0's through itseti=GetRandomInt(0,83)
//i denotes where we startsetudg_startloc=Location((i*144)-(GetRectMinY(GetPlayableMapRect())), 0)
setudg_map[i][j] = 0setn=GetRandomInt(0, 2)
//lets get moving. n now shows which direction to go in.// 0 is to the left of what we moved previously, 1 and 2 is straight forward, 3 is to the right//since we are in the top of the map, there is only three ways to go.ifn==0thenseti=i-1setudg_map[i][j]=0setl=0elseifn==1setj=j+1setudg_map[i][j]=0setl=3elseifn==2seti=i+1setudg_map[i][j]=0setl=2endifloopexitwhenz>dnszsetn=GetRandomInt(0,3)
if (l==0ANDn==1) OR (l==0ANDn==2) OR (l==1ANDn==0) OR (l==3ANDn==3)
//check if we should for some reason move leftseti=i-1setudg_map[i][j]=0setl=0elseif (l==1ANDn==1) OR (l==1ANDn==2) OR (l==2ANDn==0) OR (l==0ANDn==3)
//...or upsetj=j-1setudg_map[i][j]=0setl=1elseif (l==2ANDn==1) OR (l==2ANDn==2) OR (l==3ANDn==0) OR (l==1ANDn==3)
//...or rightseti=i+1setudg_map[i][j]=0setl=2elseif (l==3ANDn==1) OR (l==3ANDn==2) OR (l==0ANDn==0) OR (l==2ANDn==3)
//or maybe down?setj=j+1setudg_map[i][j]=0setl=3endifsetz=z+1endloopseti=0setj=0setl=0setn=0//resetting again. were going to use l for some chance. because now, were going to do BOSSES(well, their rooms)//n is a counterloopexitwheni>mapwsetj=0loopexitwhenj>maphsetl=GetRandomInt(0,50)
ifudg_map[i][j]==0ANDl<1thensetbospla[n].i=isetbospla[n].j=jn=n+1endifsetj=j+1endloopseti=i+1endloopsetl=0//l is a counter, to check if we've created enough rooms.setj=0seti=0//as usual, these are the y and x of this scriptsetn=0//for chance if the room should be a bossroom or just a room.setw=0//for chance where we should create the roomloopexitwhenl>nsetj=udg_bospla[l].jseti=udg_bospla[l].isetw=GetRandomInt(0,10)
ifw==0thensetudg_map[i+1][j]=0setudg_map[i+2][j]=0setudg_map[i+2][j-1]=0setudg_map[i+2][j+1]=0setudg_map[i+3][j-1]=0setudg_map[i+3][j+1]=0setudg_map[i+3][j]=0setudg_map[i+4][j-1]=0setudg_map[i+4][j+1]=0setudg_map[i+4][j]=0setudg_roomloc[l]=Location(((i+3)*wallsize)-(GetRectMinX(GetPlayableMaprect())), (j*wallsize)-(GetRectMinY(GetPlayableMapRect())))
elseifw==1setudg_map[i-1][j]=0setudg_map[i-2][j]=0setudg_map[i-2][j+1]=0setudg_map[i-2][j-1]=0setudg_map[i-3][j]=0setudg_map[i-3][j+1]=0setudg_map[i-3][j-1]=0setudg_map[i-4][j]=0setudg_map[i-4][j+1]=0setudg_map[i-4][j-1]=0setudg_roomloc[l]=Location(((i-3)*wallsize)-(GetRectMinX(GetPlayableMaprect())), (j*wallsize)-(GetRectMinY(GetPlayableMapRect())))
elseifw==2setudg_map[i][j-1]=0setudg_map[i][j-2]=0setudg_map[i+1][j-2]=0setudg_map[i-1][j-2]=0setudg_map[i][j-3]=0setudg_map[i+1][j-3]=0setudg_map[i-1][j-3]=0setudg_map[i][j-4]=0setudg_map[i+1][j-4]=0setudg_map[i-1][j-4]=0setudg_roomloc[l]=Location(((i)*wallsize)-(GetRectMinX(GetPlayableMaprect())), (j-3*wallsize)-(GetRectMinY(GetPlayableMapRect())))
elsesetudg_map[i][j+1]=0setudg_map[i][j+2]=0setudg_map[i-1][j+2]=0setudg_map[i+1][j+2]=0setudg_map[i][j+3]=0setudg_map[i-1][j+3]=0setudg_map[i+1][j+3]=0setudg_map[i][j+4]=0setudg_map[i-1][j+4]=0setudg_map[i+1][j+4]=0setudg_roomloc[l]=Location(((i)*wallsize)-(GetRectMinX(GetPlayableMaprect())), (j+3*wallsize)-(GetRectMinY(GetPlayableMapRect())))
//clear the room, and store the location in a variablesetn=GetRandomInt(0,124)
ifn=0thensetudg_bosplaloc[l]=Location((udg_bospla.i*144)-(GetRectMinX(GetPlayableMapRect)), (udg_bospla.j*144)-(GetRectMinY(GetPlayableMapRect())))
//store the location so we can spawn bosses there, if the chance rolls low enough.endifsetl=l+1endlooploopexitwheni>mapwsetj=0loopexitwhenj>maph//those two loops will go through every slot in the arrayifudg_map[i][j]==1AND (udg_map[i-1][j]==0ORudg_map[i+1][j]==0ORudg_map[i][j-1]==0ORudg_map[i][j+1]==0udg_map[i-1][j-1]==0ORudg_map[i+1][j+1]==0ORudg_map[i+1][j-1]==0udg_map[i-1][j+1]==0) then//if the selected slot holds an 1, and any of the adjacent slots holds an 0callCreateUnit(player(PLAYER_NEUTRAL_AGGRESSIVE), 'h000', (i*144)-(GetRectMinX(GetPlayableMapRect())), (j*144)-(GetRectMinY(GetPlayableMapRect())), 0)
//create a wall at the right locationendifendloopseti=i+1endloopendfunctionfunctionspawnbosstakesintegerboss1integerboss2integerboss3integerboss4returnsnothing//add more unitids if you like, the script chooses them randomlylocalintegerj=0localintegerw=0loopexitwhenj>udg_bosnumsetw=GetRandomInt(0,3)
//modify that 3 to the number of bosses you specified minus 1ifw=0thencallCreateUnitAtLoc(PLAYER_NEUTRAL_AGGRESSIVE, 'boss1', udg_bosplaloc[j], 0)
elseifw=1thencallCreateUnitAtLoc(PLAYER_NEUTRAL_AGGRESSIVE, 'boss2', udg_bosplaloc[j], 0)
elseifw=2thencallCreateUnitAtLoc(PLAYER_NEUTRAL_AGGRESSIVE, 'boss3', udg_bosplaloc[j], 0)
elseifw=3thencallCreateUnitAtLoc(PLAYER_NEUTRAL_AGGRESSIVE, 'boss4', udg_bosplaloc[j], 0)
endif//add more elseifs and unit spawns if you addded more bossids to the functionsetj=j+1endloopendlibrary
yeah, so, can help me locate the bug, if there is one? or is this just my jasshelper bugging? thanks in advance.
WTH? was this thread just taking time to show up or something? i could swear it wasnt there when i pm'ed you... wierdness.
wc3c has a spam protection.
Posts of people who are here for the first time are hidden for normal users until a moderator (they can see the posts) "unlocks" the new user.
I blame it on this vB version not being coded in a way that they will tell people their posts were made correctly yet might take some time to appear in the site...
I should probably fix/hack it after my exams are over...