Narutimmy Posted October 8, 2015 Share Posted October 8, 2015 Hola bueno estoy haciendo un resource que lo que aga es basicamente seleccionar una de las areas creadas al azar y ponerla a parpadear y que si ya esta parpdeando seleccione otra, pero me da error, me dice que es nil ... local Area1 = createRadarArea ( 325,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area1Col = createColRectangle ( 325,-4046, 150, 150 ) --- GREEN local Area2 = createRadarArea ( 325+150,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area2Col = createColRectangle ( 325+150,-4046, 150, 150 ) --- GREEN localArea3 = createRadarArea ( 325+300,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area3Col = createColRectangle ( 325+300,-4046, 150, 150 ) --- GREEN localArea4 = createRadarArea ( 325+450,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area4Col = createColRectangle ( 325+450,-4046, 150, 150 ) --- GREEN local Area5 = createRadarArea ( 325+600,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area5Col = createColRectangle ( 325+600,-4046, 150, 150 ) --- GREEN local Area6 = createRadarArea ( 325,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area6Col = createColRectangle ( 325,-4046+150, 150, 150 ) --- GREEN local Area18 = createRadarArea ( 325+150,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area18Col = createColRectangle ( 325+150,-4046+150, 150, 150 ) --- RED local Area20 = createRadarArea ( 325+300,-4046+150, 150, 150, 0, 0, 0, 255 ) --- CENTRO Area20Col = createColRectangle ( 325+300,-4046+150, 150, 150 ) --- CENTRO local Area19 = createRadarArea ( 325+450,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area19Col = createColRectangle ( 325+450,-4046+150, 150, 150 ) --- RED local Area7 = createRadarArea ( 325+600,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area7Col = createColRectangle ( 325+600,-4046+150, 150, 150 ) --- GREEN local Area8 = createRadarArea ( 325,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area8Col = createColRectangle ( 325,-4046+300, 150, 150 ) --- GREEN local Area15 = createRadarArea ( 325+150,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area15Col = createColRectangle ( 325+150,-4046+300, 150, 150 ) -- Yellow local Area16 = createRadarArea ( 325+300,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area16Col = createColRectangle ( 325+300,-4046+300, 150, 150 ) -- Yellow local Area17 = createRadarArea ( 325+450,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area17Col = createColRectangle ( 325+450,-4046+300, 150, 150 ) -- Yellow local Area9 = createRadarArea ( 325+600,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area9Col = createColRectangle ( 325+600,-4046+300, 150, 150 ) --- GREEN local Area10 = createRadarArea ( 325,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area10Col = createColRectangle ( 325,-4046+450, 150, 150 ) --- GREEN local Area11 = createRadarArea ( 325+150,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area11Col = createColRectangle ( 325+150,-4046+450, 150, 150 ) --- GREEN local Area12 = createRadarArea ( 325+300,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area12Col = createColRectangle ( 325+300,-4046+450, 150, 150 ) --- GREEN local Area13 = createRadarArea ( 325+450,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area13Col = createColRectangle ( 325+450,-4046+450, 150, 150 ) --- GREEN local Area14 = createRadarArea ( 325+600,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area14Col = createColRectangle ( 325+600,-4046+450, 150, 150 ) --- GREEN local randomSpawnTable = { {"Area1"}, { "Area2" }, { "Area3" }, { "Area4" }, } function ComenzarAreasGreen () local RandomArea = randomSpawnTable [ random ] if not( isRadarAreaFlashing ( RandomArea ) ) then setRadarAreaFlashing ( RandomArea, true ) else ComenzarAreasGreen () end end setTimer(ComenzarAreasGreen,15000,0) Link to comment
Kilfwan Posted October 8, 2015 Share Posted October 8, 2015 local rand= unpack(randomSpawnTable [math.random(#randomSpawnTable )] ) Yo lo hago siempre asi. Link to comment
aka Blue Posted October 8, 2015 Share Posted October 8, 2015 ¿LOL? randomSpawnTable [ random ] Link to comment
TheCrazy17 Posted October 8, 2015 Share Posted October 8, 2015 No lo probé pero así debería funcionar y te sería mas fácil (También puedes hacer mas fácil la creación de los colshapes) RadarAreas = { {325, -4046, 150, 150, 0, 255, 0, 100}, {325+150,-4046, 150, 150, 0, 255, 0, 100} } Areas = {} for k, v in ipairs(RadarAreas) do Areas[k] = createRadarArea(v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8]) end Area1Col = createColRectangle ( 325,-4046, 150, 150 ) --- GREEN Area2Col = createColRectangle ( 325+150,-4046, 150, 150 ) --- GREEN localArea3 = createRadarArea ( 325+300,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area3Col = createColRectangle ( 325+300,-4046, 150, 150 ) --- GREEN localArea4 = createRadarArea ( 325+450,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area4Col = createColRectangle ( 325+450,-4046, 150, 150 ) --- GREEN local Area5 = createRadarArea ( 325+600,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area5Col = createColRectangle ( 325+600,-4046, 150, 150 ) --- GREEN local Area6 = createRadarArea ( 325,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area6Col = createColRectangle ( 325,-4046+150, 150, 150 ) --- GREEN local Area18 = createRadarArea ( 325+150,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area18Col = createColRectangle ( 325+150,-4046+150, 150, 150 ) --- RED local Area20 = createRadarArea ( 325+300,-4046+150, 150, 150, 0, 0, 0, 255 ) --- CENTRO Area20Col = createColRectangle ( 325+300,-4046+150, 150, 150 ) --- CENTRO local Area19 = createRadarArea ( 325+450,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area19Col = createColRectangle ( 325+450,-4046+150, 150, 150 ) --- RED local Area7 = createRadarArea ( 325+600,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area7Col = createColRectangle ( 325+600,-4046+150, 150, 150 ) --- GREEN local Area8 = createRadarArea ( 325,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area8Col = createColRectangle ( 325,-4046+300, 150, 150 ) --- GREEN local Area15 = createRadarArea ( 325+150,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area15Col = createColRectangle ( 325+150,-4046+300, 150, 150 ) -- Yellow local Area16 = createRadarArea ( 325+300,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area16Col = createColRectangle ( 325+300,-4046+300, 150, 150 ) -- Yellow local Area17 = createRadarArea ( 325+450,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area17Col = createColRectangle ( 325+450,-4046+300, 150, 150 ) -- Yellow local Area9 = createRadarArea ( 325+600,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area9Col = createColRectangle ( 325+600,-4046+300, 150, 150 ) --- GREEN local Area10 = createRadarArea ( 325,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area10Col = createColRectangle ( 325,-4046+450, 150, 150 ) --- GREEN local Area11 = createRadarArea ( 325+150,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area11Col = createColRectangle ( 325+150,-4046+450, 150, 150 ) --- GREEN local Area12 = createRadarArea ( 325+300,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area12Col = createColRectangle ( 325+300,-4046+450, 150, 150 ) --- GREEN local Area13 = createRadarArea ( 325+450,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area13Col = createColRectangle ( 325+450,-4046+450, 150, 150 ) --- GREEN local Area14 = createRadarArea ( 325+600,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area14Col = createColRectangle ( 325+600,-4046+450, 150, 150 ) --- GREEN function ComenzarAreasGreen () local Random = math.random(1, #Areas) --Se obtiene un random if not( isRadarAreaFlashing (Areas[Random) ) then setRadarAreaFlashing (Areas[Random], true ) else ComenzarAreasGreen () end end setTimer(ComenzarAreasGreen,15000,0) Link to comment
Narutimmy Posted October 9, 2015 Author Share Posted October 9, 2015 No lo probé pero así debería funcionar y te sería mas fácil (También puedes hacer mas fácil la creación de los colshapes) RadarAreas = { {325, -4046, 150, 150, 0, 255, 0, 100}, {325+150,-4046, 150, 150, 0, 255, 0, 100} } Areas = {} for k, v in ipairs(RadarAreas) do Areas[k] = createRadarArea(v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8]) end Area1Col = createColRectangle ( 325,-4046, 150, 150 ) --- GREEN Area2Col = createColRectangle ( 325+150,-4046, 150, 150 ) --- GREEN localArea3 = createRadarArea ( 325+300,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area3Col = createColRectangle ( 325+300,-4046, 150, 150 ) --- GREEN localArea4 = createRadarArea ( 325+450,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area4Col = createColRectangle ( 325+450,-4046, 150, 150 ) --- GREEN local Area5 = createRadarArea ( 325+600,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area5Col = createColRectangle ( 325+600,-4046, 150, 150 ) --- GREEN local Area6 = createRadarArea ( 325,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area6Col = createColRectangle ( 325,-4046+150, 150, 150 ) --- GREEN local Area18 = createRadarArea ( 325+150,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area18Col = createColRectangle ( 325+150,-4046+150, 150, 150 ) --- RED local Area20 = createRadarArea ( 325+300,-4046+150, 150, 150, 0, 0, 0, 255 ) --- CENTRO Area20Col = createColRectangle ( 325+300,-4046+150, 150, 150 ) --- CENTRO local Area19 = createRadarArea ( 325+450,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area19Col = createColRectangle ( 325+450,-4046+150, 150, 150 ) --- RED local Area7 = createRadarArea ( 325+600,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area7Col = createColRectangle ( 325+600,-4046+150, 150, 150 ) --- GREEN local Area8 = createRadarArea ( 325,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area8Col = createColRectangle ( 325,-4046+300, 150, 150 ) --- GREEN local Area15 = createRadarArea ( 325+150,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area15Col = createColRectangle ( 325+150,-4046+300, 150, 150 ) -- Yellow local Area16 = createRadarArea ( 325+300,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area16Col = createColRectangle ( 325+300,-4046+300, 150, 150 ) -- Yellow local Area17 = createRadarArea ( 325+450,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area17Col = createColRectangle ( 325+450,-4046+300, 150, 150 ) -- Yellow local Area9 = createRadarArea ( 325+600,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area9Col = createColRectangle ( 325+600,-4046+300, 150, 150 ) --- GREEN local Area10 = createRadarArea ( 325,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area10Col = createColRectangle ( 325,-4046+450, 150, 150 ) --- GREEN local Area11 = createRadarArea ( 325+150,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area11Col = createColRectangle ( 325+150,-4046+450, 150, 150 ) --- GREEN local Area12 = createRadarArea ( 325+300,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area12Col = createColRectangle ( 325+300,-4046+450, 150, 150 ) --- GREEN local Area13 = createRadarArea ( 325+450,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area13Col = createColRectangle ( 325+450,-4046+450, 150, 150 ) --- GREEN local Area14 = createRadarArea ( 325+600,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area14Col = createColRectangle ( 325+600,-4046+450, 150, 150 ) --- GREEN function ComenzarAreasGreen () local Random = math.random(1, #Areas) --Se obtiene un random if not( isRadarAreaFlashing (Areas[Random) ) then setRadarAreaFlashing (Areas[Random], true ) else ComenzarAreasGreen () end end setTimer(ComenzarAreasGreen,15000,0) Eso funciona, el problema es que asi no puedo identificar cada una de las zonas, porque quiero hacer una funcion que por ejemplo mate a al usuario que entre a alguna de las Areas Parpadeando. Otra cosa, la idea es que ponga a flashear las zonas 1 por 1, el problema es que si toca una que ya esta flasheando lanza la otra funcion aonque aun falten algunas. Link to comment
TheCrazy17 Posted October 9, 2015 Share Posted October 9, 2015 A que te refieres con "identificar" ? Puedes asignarles una función a cada colision al momento de su creación Lo segundo no entendí Link to comment
Narutimmy Posted October 9, 2015 Author Share Posted October 9, 2015 A que te refieres con "identificar" ? Puedes asignarles una función a cada colision al momento de su creación Lo segundo no entendí Si antes las tenia como Area 1, Area 2,Area3, ahora todas son Area1 por ejemplo. Link to comment
TheCrazy17 Posted October 9, 2015 Share Posted October 9, 2015 A que te refieres con "identificar" ? Puedes asignarles una función a cada colision al momento de su creación Lo segundo no entendí Si antes las tenia como Area 1, Area 2,Area3, ahora todas son Area1 por ejemplo. Claro que no. Se forma una tabla con las áreas, se definen como Areas[1], Areas[2], etc. (Depende del orden que se creen) Link to comment
Narutimmy Posted October 9, 2015 Author Share Posted October 9, 2015 A que te refieres con "identificar" ? Puedes asignarles una función a cada colision al momento de su creación Lo segundo no entendí Si antes las tenia como Area 1, Area 2,Area3, ahora todas son Area1 por ejemplo. Claro que no. Se forma una tabla con las áreas, se definen como Areas[1], Areas[2], etc. (Depende del orden que se creen) aaa ok ok ya entendi, la segunda era, imagina que tienes 3 areas, das el random y sale el Area 1 y se le pone a parpadear no? pasan 15 seg se da otro random y sale la Area 3, en teoria solo falta la 2, pero da ramrom y sale la 3 otra vez, y da random y sale la 1 otras vez (teniendo mala suerte), la idea es que las que ya estan parpadeando ya no salgan en el random, y que cuando ya no falte ninguna ejecutar una funcion nueva. Link to comment
UserToDelete Posted October 9, 2015 Share Posted October 9, 2015 Esque antes que nada hay que entender como funcionan las tablas Link to comment
Narutimmy Posted October 11, 2015 Author Share Posted October 11, 2015 Trabaja más limpio. local posXA = { [1]= 0, [2]= 400, [3]= 800 } local posYA = { [1]= 0, [2]= 400, [3]= 800 } local Area local colArea function ComenzarAreasGreen () if Area then if isRadarAreaFlashing ( Area ) then setRadarAreaFlashing ( Area, false ) end destroyElement ( Area ) end if colArea then destroyElement ( colArea ) end local e = math.random(1, 3) Area = createRadarArea ( posXA[e], posYA[e], 150, 150, 0, 255, 0, 255) colArea = createColRectangle ( posXA[e], posYA[e], 150, 150) setRadarAreaFlashing ( Area, true ) end setTimer(ComenzarAreasGreen, 15000, 0) No le entiendo nada a tu codigo xDD EDIT: Ya le entendi, pero no me sirve, el tuyo creo 1, y cuandova a crear otra elimina la anterior si no me equivico, eso no me sirve. Lo que quiero es crear por ejemplo 1 mapa y dividirlo en 4 zonas, al inicio puedes estar en las 4, pero luego ejemplo al azar la 3 se hace de peligro si estas ahi mueres, luego se hace de peligro la 2, entonces ya son de peligro la 2 y la 3, y asi hasta que solo quede 1 como zona segura, nose si me explico. Link to comment
Arsilex Posted October 11, 2015 Share Posted October 11, 2015 local Area1 = createRadarArea ( 325,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area1Col = createColRectangle ( 325,-4046, 150, 150 ) --- GREEN local Area2 = createRadarArea ( 325+150,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area2Col = createColRectangle ( 325+150,-4046, 150, 150 ) --- GREEN localArea3 = createRadarArea ( 325+300,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area3Col = createColRectangle ( 325+300,-4046, 150, 150 ) --- GREEN localArea4 = createRadarArea ( 325+450,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area4Col = createColRectangle ( 325+450,-4046, 150, 150 ) --- GREEN local Area5 = createRadarArea ( 325+600,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area5Col = createColRectangle ( 325+600,-4046, 150, 150 ) --- GREEN local Area6 = createRadarArea ( 325,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area6Col = createColRectangle ( 325,-4046+150, 150, 150 ) --- GREEN local Area18 = createRadarArea ( 325+150,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area18Col = createColRectangle ( 325+150,-4046+150, 150, 150 ) --- RED local Area20 = createRadarArea ( 325+300,-4046+150, 150, 150, 0, 0, 0, 255 ) --- CENTRO Area20Col = createColRectangle ( 325+300,-4046+150, 150, 150 ) --- CENTRO local Area19 = createRadarArea ( 325+450,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area19Col = createColRectangle ( 325+450,-4046+150, 150, 150 ) --- RED local Area7 = createRadarArea ( 325+600,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area7Col = createColRectangle ( 325+600,-4046+150, 150, 150 ) --- GREEN local Area8 = createRadarArea ( 325,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area8Col = createColRectangle ( 325,-4046+300, 150, 150 ) --- GREEN local Area15 = createRadarArea ( 325+150,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area15Col = createColRectangle ( 325+150,-4046+300, 150, 150 ) -- Yellow local Area16 = createRadarArea ( 325+300,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area16Col = createColRectangle ( 325+300,-4046+300, 150, 150 ) -- Yellow local Area17 = createRadarArea ( 325+450,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area17Col = createColRectangle ( 325+450,-4046+300, 150, 150 ) -- Yellow local Area9 = createRadarArea ( 325+600,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area9Col = createColRectangle ( 325+600,-4046+300, 150, 150 ) --- GREEN local Area10 = createRadarArea ( 325,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area10Col = createColRectangle ( 325,-4046+450, 150, 150 ) --- GREEN local Area11 = createRadarArea ( 325+150,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area11Col = createColRectangle ( 325+150,-4046+450, 150, 150 ) --- GREEN local Area12 = createRadarArea ( 325+300,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area12Col = createColRectangle ( 325+300,-4046+450, 150, 150 ) --- GREEN local Area13 = createRadarArea ( 325+450,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area13Col = createColRectangle ( 325+450,-4046+450, 150, 150 ) --- GREEN local Area14 = createRadarArea ( 325+600,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area14Col = createColRectangle ( 325+600,-4046+450, 150, 150 ) --- GREEN local randomSpawnTable = { {Area1}, {Area2}, {Area3}, {Area4}, } function ComenzarAreasGreen () while true do local RandomArea = randomSpawnTable [ random ] if not( isRadarAreaFlashing ( RandomArea ) ) then setRadarAreaFlashing ( RandomArea, true ) break end end end setTimer(ComenzarAreasGreen,15000,0) Prueba esto. Link to comment
UserToDelete Posted October 11, 2015 Share Posted October 11, 2015 local Area1 = createRadarArea ( 325,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area1Col = createColRectangle ( 325,-4046, 150, 150 ) --- GREEN local Area2 = createRadarArea ( 325+150,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area2Col = createColRectangle ( 325+150,-4046, 150, 150 ) --- GREEN localArea3 = createRadarArea ( 325+300,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area3Col = createColRectangle ( 325+300,-4046, 150, 150 ) --- GREEN localArea4 = createRadarArea ( 325+450,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area4Col = createColRectangle ( 325+450,-4046, 150, 150 ) --- GREEN local Area5 = createRadarArea ( 325+600,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area5Col = createColRectangle ( 325+600,-4046, 150, 150 ) --- GREEN local Area6 = createRadarArea ( 325,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area6Col = createColRectangle ( 325,-4046+150, 150, 150 ) --- GREEN local Area18 = createRadarArea ( 325+150,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area18Col = createColRectangle ( 325+150,-4046+150, 150, 150 ) --- RED local Area20 = createRadarArea ( 325+300,-4046+150, 150, 150, 0, 0, 0, 255 ) --- CENTRO Area20Col = createColRectangle ( 325+300,-4046+150, 150, 150 ) --- CENTRO local Area19 = createRadarArea ( 325+450,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area19Col = createColRectangle ( 325+450,-4046+150, 150, 150 ) --- RED local Area7 = createRadarArea ( 325+600,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area7Col = createColRectangle ( 325+600,-4046+150, 150, 150 ) --- GREEN local Area8 = createRadarArea ( 325,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area8Col = createColRectangle ( 325,-4046+300, 150, 150 ) --- GREEN local Area15 = createRadarArea ( 325+150,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area15Col = createColRectangle ( 325+150,-4046+300, 150, 150 ) -- Yellow local Area16 = createRadarArea ( 325+300,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area16Col = createColRectangle ( 325+300,-4046+300, 150, 150 ) -- Yellow local Area17 = createRadarArea ( 325+450,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area17Col = createColRectangle ( 325+450,-4046+300, 150, 150 ) -- Yellow local Area9 = createRadarArea ( 325+600,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area9Col = createColRectangle ( 325+600,-4046+300, 150, 150 ) --- GREEN local Area10 = createRadarArea ( 325,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area10Col = createColRectangle ( 325,-4046+450, 150, 150 ) --- GREEN local Area11 = createRadarArea ( 325+150,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area11Col = createColRectangle ( 325+150,-4046+450, 150, 150 ) --- GREEN local Area12 = createRadarArea ( 325+300,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area12Col = createColRectangle ( 325+300,-4046+450, 150, 150 ) --- GREEN local Area13 = createRadarArea ( 325+450,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area13Col = createColRectangle ( 325+450,-4046+450, 150, 150 ) --- GREEN local Area14 = createRadarArea ( 325+600,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area14Col = createColRectangle ( 325+600,-4046+450, 150, 150 ) --- GREEN local randomSpawnTable = { {Area1}, {Area2}, {Area3}, {Area4}, } function ComenzarAreasGreen () while true do local RandomArea = randomSpawnTable [ random ] if not( isRadarAreaFlashing ( RandomArea ) ) then setRadarAreaFlashing ( RandomArea, true ) break end end end setTimer(ComenzarAreasGreen,15000,0) Prueba esto. Por que haces un while? Link to comment
Arsilex Posted October 11, 2015 Share Posted October 11, 2015 local Area1 = createRadarArea ( 325,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area1Col = createColRectangle ( 325,-4046, 150, 150 ) --- GREEN local Area2 = createRadarArea ( 325+150,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area2Col = createColRectangle ( 325+150,-4046, 150, 150 ) --- GREEN localArea3 = createRadarArea ( 325+300,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area3Col = createColRectangle ( 325+300,-4046, 150, 150 ) --- GREEN localArea4 = createRadarArea ( 325+450,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area4Col = createColRectangle ( 325+450,-4046, 150, 150 ) --- GREEN local Area5 = createRadarArea ( 325+600,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area5Col = createColRectangle ( 325+600,-4046, 150, 150 ) --- GREEN local Area6 = createRadarArea ( 325,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area6Col = createColRectangle ( 325,-4046+150, 150, 150 ) --- GREEN local Area18 = createRadarArea ( 325+150,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area18Col = createColRectangle ( 325+150,-4046+150, 150, 150 ) --- RED local Area20 = createRadarArea ( 325+300,-4046+150, 150, 150, 0, 0, 0, 255 ) --- CENTRO Area20Col = createColRectangle ( 325+300,-4046+150, 150, 150 ) --- CENTRO local Area19 = createRadarArea ( 325+450,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area19Col = createColRectangle ( 325+450,-4046+150, 150, 150 ) --- RED local Area7 = createRadarArea ( 325+600,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area7Col = createColRectangle ( 325+600,-4046+150, 150, 150 ) --- GREEN local Area8 = createRadarArea ( 325,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area8Col = createColRectangle ( 325,-4046+300, 150, 150 ) --- GREEN local Area15 = createRadarArea ( 325+150,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area15Col = createColRectangle ( 325+150,-4046+300, 150, 150 ) -- Yellow local Area16 = createRadarArea ( 325+300,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area16Col = createColRectangle ( 325+300,-4046+300, 150, 150 ) -- Yellow local Area17 = createRadarArea ( 325+450,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area17Col = createColRectangle ( 325+450,-4046+300, 150, 150 ) -- Yellow local Area9 = createRadarArea ( 325+600,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area9Col = createColRectangle ( 325+600,-4046+300, 150, 150 ) --- GREEN local Area10 = createRadarArea ( 325,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area10Col = createColRectangle ( 325,-4046+450, 150, 150 ) --- GREEN local Area11 = createRadarArea ( 325+150,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area11Col = createColRectangle ( 325+150,-4046+450, 150, 150 ) --- GREEN local Area12 = createRadarArea ( 325+300,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area12Col = createColRectangle ( 325+300,-4046+450, 150, 150 ) --- GREEN local Area13 = createRadarArea ( 325+450,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area13Col = createColRectangle ( 325+450,-4046+450, 150, 150 ) --- GREEN local Area14 = createRadarArea ( 325+600,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area14Col = createColRectangle ( 325+600,-4046+450, 150, 150 ) --- GREEN local randomSpawnTable = { {Area1}, {Area2}, {Area3}, {Area4}, } function ComenzarAreasGreen () while true do local RandomArea = randomSpawnTable [ random ] if not( isRadarAreaFlashing ( RandomArea ) ) then setRadarAreaFlashing ( RandomArea, true ) break end end end setTimer(ComenzarAreasGreen,15000,0) Prueba esto. Por que haces un while? Para que la función se repita automáticamente sin necesidad de re-ejecutarla de nuevo mediante esa linea así hasta que no encuentre un área libre la función seguirá ejecutándose Link to comment
Narutimmy Posted October 11, 2015 Author Share Posted October 11, 2015 local Area1 = createRadarArea ( 325,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area1Col = createColRectangle ( 325,-4046, 150, 150 ) --- GREEN local Area2 = createRadarArea ( 325+150,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area2Col = createColRectangle ( 325+150,-4046, 150, 150 ) --- GREEN localArea3 = createRadarArea ( 325+300,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area3Col = createColRectangle ( 325+300,-4046, 150, 150 ) --- GREEN localArea4 = createRadarArea ( 325+450,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area4Col = createColRectangle ( 325+450,-4046, 150, 150 ) --- GREEN local Area5 = createRadarArea ( 325+600,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area5Col = createColRectangle ( 325+600,-4046, 150, 150 ) --- GREEN local Area6 = createRadarArea ( 325,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area6Col = createColRectangle ( 325,-4046+150, 150, 150 ) --- GREEN local Area18 = createRadarArea ( 325+150,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area18Col = createColRectangle ( 325+150,-4046+150, 150, 150 ) --- RED local Area20 = createRadarArea ( 325+300,-4046+150, 150, 150, 0, 0, 0, 255 ) --- CENTRO Area20Col = createColRectangle ( 325+300,-4046+150, 150, 150 ) --- CENTRO local Area19 = createRadarArea ( 325+450,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area19Col = createColRectangle ( 325+450,-4046+150, 150, 150 ) --- RED local Area7 = createRadarArea ( 325+600,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area7Col = createColRectangle ( 325+600,-4046+150, 150, 150 ) --- GREEN local Area8 = createRadarArea ( 325,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area8Col = createColRectangle ( 325,-4046+300, 150, 150 ) --- GREEN local Area15 = createRadarArea ( 325+150,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area15Col = createColRectangle ( 325+150,-4046+300, 150, 150 ) -- Yellow local Area16 = createRadarArea ( 325+300,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area16Col = createColRectangle ( 325+300,-4046+300, 150, 150 ) -- Yellow local Area17 = createRadarArea ( 325+450,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area17Col = createColRectangle ( 325+450,-4046+300, 150, 150 ) -- Yellow local Area9 = createRadarArea ( 325+600,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area9Col = createColRectangle ( 325+600,-4046+300, 150, 150 ) --- GREEN local Area10 = createRadarArea ( 325,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area10Col = createColRectangle ( 325,-4046+450, 150, 150 ) --- GREEN local Area11 = createRadarArea ( 325+150,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area11Col = createColRectangle ( 325+150,-4046+450, 150, 150 ) --- GREEN local Area12 = createRadarArea ( 325+300,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area12Col = createColRectangle ( 325+300,-4046+450, 150, 150 ) --- GREEN local Area13 = createRadarArea ( 325+450,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area13Col = createColRectangle ( 325+450,-4046+450, 150, 150 ) --- GREEN local Area14 = createRadarArea ( 325+600,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area14Col = createColRectangle ( 325+600,-4046+450, 150, 150 ) --- GREEN local randomSpawnTable = { {Area1}, {Area2}, {Area3}, {Area4}, } function ComenzarAreasGreen () while true do local RandomArea = randomSpawnTable [ random ] if not( isRadarAreaFlashing ( RandomArea ) ) then setRadarAreaFlashing ( RandomArea, true ) break end end end setTimer(ComenzarAreasGreen,15000,0) Prueba esto. Dice que RandomArea es Nil Link to comment
Arsilex Posted October 11, 2015 Share Posted October 11, 2015 local Area1 = createRadarArea ( 325,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area1Col = createColRectangle ( 325,-4046, 150, 150 ) --- GREEN local Area2 = createRadarArea ( 325+150,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area2Col = createColRectangle ( 325+150,-4046, 150, 150 ) --- GREEN localArea3 = createRadarArea ( 325+300,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area3Col = createColRectangle ( 325+300,-4046, 150, 150 ) --- GREEN localArea4 = createRadarArea ( 325+450,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area4Col = createColRectangle ( 325+450,-4046, 150, 150 ) --- GREEN local Area5 = createRadarArea ( 325+600,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area5Col = createColRectangle ( 325+600,-4046, 150, 150 ) --- GREEN local Area6 = createRadarArea ( 325,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area6Col = createColRectangle ( 325,-4046+150, 150, 150 ) --- GREEN local Area18 = createRadarArea ( 325+150,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area18Col = createColRectangle ( 325+150,-4046+150, 150, 150 ) --- RED local Area20 = createRadarArea ( 325+300,-4046+150, 150, 150, 0, 0, 0, 255 ) --- CENTRO Area20Col = createColRectangle ( 325+300,-4046+150, 150, 150 ) --- CENTRO local Area19 = createRadarArea ( 325+450,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area19Col = createColRectangle ( 325+450,-4046+150, 150, 150 ) --- RED local Area7 = createRadarArea ( 325+600,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area7Col = createColRectangle ( 325+600,-4046+150, 150, 150 ) --- GREEN local Area8 = createRadarArea ( 325,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area8Col = createColRectangle ( 325,-4046+300, 150, 150 ) --- GREEN local Area15 = createRadarArea ( 325+150,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area15Col = createColRectangle ( 325+150,-4046+300, 150, 150 ) -- Yellow local Area16 = createRadarArea ( 325+300,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area16Col = createColRectangle ( 325+300,-4046+300, 150, 150 ) -- Yellow local Area17 = createRadarArea ( 325+450,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area17Col = createColRectangle ( 325+450,-4046+300, 150, 150 ) -- Yellow local Area9 = createRadarArea ( 325+600,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area9Col = createColRectangle ( 325+600,-4046+300, 150, 150 ) --- GREEN local Area10 = createRadarArea ( 325,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area10Col = createColRectangle ( 325,-4046+450, 150, 150 ) --- GREEN local Area11 = createRadarArea ( 325+150,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area11Col = createColRectangle ( 325+150,-4046+450, 150, 150 ) --- GREEN local Area12 = createRadarArea ( 325+300,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area12Col = createColRectangle ( 325+300,-4046+450, 150, 150 ) --- GREEN local Area13 = createRadarArea ( 325+450,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area13Col = createColRectangle ( 325+450,-4046+450, 150, 150 ) --- GREEN local Area14 = createRadarArea ( 325+600,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area14Col = createColRectangle ( 325+600,-4046+450, 150, 150 ) --- GREEN local randomSpawnTable = { Area1, Area2, Area3, Area4, } function ComenzarAreasGreen () while true do local RandomArea = randomSpawnTable [ random ] if not( isRadarAreaFlashing ( RandomArea ) ) then setRadarAreaFlashing ( RandomArea, true ) break end end end setTimer(ComenzarAreasGreen,15000,0) Link to comment
Narutimmy Posted October 11, 2015 Author Share Posted October 11, 2015 local Area1 = createRadarArea ( 325,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area1Col = createColRectangle ( 325,-4046, 150, 150 ) --- GREEN local Area2 = createRadarArea ( 325+150,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area2Col = createColRectangle ( 325+150,-4046, 150, 150 ) --- GREEN localArea3 = createRadarArea ( 325+300,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area3Col = createColRectangle ( 325+300,-4046, 150, 150 ) --- GREEN localArea4 = createRadarArea ( 325+450,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area4Col = createColRectangle ( 325+450,-4046, 150, 150 ) --- GREEN local Area5 = createRadarArea ( 325+600,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area5Col = createColRectangle ( 325+600,-4046, 150, 150 ) --- GREEN local Area6 = createRadarArea ( 325,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area6Col = createColRectangle ( 325,-4046+150, 150, 150 ) --- GREEN local Area18 = createRadarArea ( 325+150,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area18Col = createColRectangle ( 325+150,-4046+150, 150, 150 ) --- RED local Area20 = createRadarArea ( 325+300,-4046+150, 150, 150, 0, 0, 0, 255 ) --- CENTRO Area20Col = createColRectangle ( 325+300,-4046+150, 150, 150 ) --- CENTRO local Area19 = createRadarArea ( 325+450,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area19Col = createColRectangle ( 325+450,-4046+150, 150, 150 ) --- RED local Area7 = createRadarArea ( 325+600,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area7Col = createColRectangle ( 325+600,-4046+150, 150, 150 ) --- GREEN local Area8 = createRadarArea ( 325,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area8Col = createColRectangle ( 325,-4046+300, 150, 150 ) --- GREEN local Area15 = createRadarArea ( 325+150,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area15Col = createColRectangle ( 325+150,-4046+300, 150, 150 ) -- Yellow local Area16 = createRadarArea ( 325+300,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area16Col = createColRectangle ( 325+300,-4046+300, 150, 150 ) -- Yellow local Area17 = createRadarArea ( 325+450,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area17Col = createColRectangle ( 325+450,-4046+300, 150, 150 ) -- Yellow local Area9 = createRadarArea ( 325+600,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area9Col = createColRectangle ( 325+600,-4046+300, 150, 150 ) --- GREEN local Area10 = createRadarArea ( 325,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area10Col = createColRectangle ( 325,-4046+450, 150, 150 ) --- GREEN local Area11 = createRadarArea ( 325+150,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area11Col = createColRectangle ( 325+150,-4046+450, 150, 150 ) --- GREEN local Area12 = createRadarArea ( 325+300,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area12Col = createColRectangle ( 325+300,-4046+450, 150, 150 ) --- GREEN local Area13 = createRadarArea ( 325+450,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area13Col = createColRectangle ( 325+450,-4046+450, 150, 150 ) --- GREEN local Area14 = createRadarArea ( 325+600,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area14Col = createColRectangle ( 325+600,-4046+450, 150, 150 ) --- GREEN local randomSpawnTable = { Area1, Area2, Area3, Area4, } function ComenzarAreasGreen () while true do local RandomArea = randomSpawnTable [ random ] if not( isRadarAreaFlashing ( RandomArea ) ) then setRadarAreaFlashing ( RandomArea, true ) break end end end setTimer(ComenzarAreasGreen,15000,0) Dice Linea 81 Argumento 1 es nil local Area1 = createRadarArea ( 325,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area1Col = createColRectangle ( 325,-4046, 150, 150 ) --- GREEN local Area2 = createRadarArea ( 325+150,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area2Col = createColRectangle ( 325+150,-4046, 150, 150 ) --- GREEN localArea3 = createRadarArea ( 325+300,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area3Col = createColRectangle ( 325+300,-4046, 150, 150 ) --- GREEN localArea4 = createRadarArea ( 325+450,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area4Col = createColRectangle ( 325+450,-4046, 150, 150 ) --- GREEN local Area5 = createRadarArea ( 325+600,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area5Col = createColRectangle ( 325+600,-4046, 150, 150 ) --- GREEN local Area6 = createRadarArea ( 325,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area6Col = createColRectangle ( 325,-4046+150, 150, 150 ) --- GREEN local Area18 = createRadarArea ( 325+150,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area18Col = createColRectangle ( 325+150,-4046+150, 150, 150 ) --- RED local Area20 = createRadarArea ( 325+300,-4046+150, 150, 150, 0, 0, 0, 255 ) --- CENTRO Area20Col = createColRectangle ( 325+300,-4046+150, 150, 150 ) --- CENTRO local Area19 = createRadarArea ( 325+450,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area19Col = createColRectangle ( 325+450,-4046+150, 150, 150 ) --- RED local Area7 = createRadarArea ( 325+600,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area7Col = createColRectangle ( 325+600,-4046+150, 150, 150 ) --- GREEN local Area8 = createRadarArea ( 325,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area8Col = createColRectangle ( 325,-4046+300, 150, 150 ) --- GREEN local Area15 = createRadarArea ( 325+150,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area15Col = createColRectangle ( 325+150,-4046+300, 150, 150 ) -- Yellow local Area16 = createRadarArea ( 325+300,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area16Col = createColRectangle ( 325+300,-4046+300, 150, 150 ) -- Yellow local Area17 = createRadarArea ( 325+450,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area17Col = createColRectangle ( 325+450,-4046+300, 150, 150 ) -- Yellow local Area9 = createRadarArea ( 325+600,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area9Col = createColRectangle ( 325+600,-4046+300, 150, 150 ) --- GREEN local Area10 = createRadarArea ( 325,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area10Col = createColRectangle ( 325,-4046+450, 150, 150 ) --- GREEN local Area11 = createRadarArea ( 325+150,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area11Col = createColRectangle ( 325+150,-4046+450, 150, 150 ) --- GREEN local Area12 = createRadarArea ( 325+300,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area12Col = createColRectangle ( 325+300,-4046+450, 150, 150 ) --- GREEN local Area13 = createRadarArea ( 325+450,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area13Col = createColRectangle ( 325+450,-4046+450, 150, 150 ) --- GREEN local Area14 = createRadarArea ( 325+600,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area14Col = createColRectangle ( 325+600,-4046+450, 150, 150 ) --- GREEN local randomSpawnTable = { Area1, Area2, Area3, Area4, } function ComenzarAreasGreen () while true do local RandomArea = randomSpawnTable [ random ] if not( isRadarAreaFlashing ( RandomArea ) ) then setRadarAreaFlashing ( RandomArea, true ) --- Linea 81 break end end end setTimer(ComenzarAreasGreen,15000,0) Link to comment
UserToDelete Posted October 11, 2015 Share Posted October 11, 2015 local Area1 = createRadarArea ( 325,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area1Col = createColRectangle ( 325,-4046, 150, 150 ) --- GREEN local Area2 = createRadarArea ( 325+150,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area2Col = createColRectangle ( 325+150,-4046, 150, 150 ) --- GREEN localArea3 = createRadarArea ( 325+300,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area3Col = createColRectangle ( 325+300,-4046, 150, 150 ) --- GREEN localArea4 = createRadarArea ( 325+450,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area4Col = createColRectangle ( 325+450,-4046, 150, 150 ) --- GREEN local Area5 = createRadarArea ( 325+600,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area5Col = createColRectangle ( 325+600,-4046, 150, 150 ) --- GREEN local Area6 = createRadarArea ( 325,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area6Col = createColRectangle ( 325,-4046+150, 150, 150 ) --- GREEN local Area18 = createRadarArea ( 325+150,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area18Col = createColRectangle ( 325+150,-4046+150, 150, 150 ) --- RED local Area20 = createRadarArea ( 325+300,-4046+150, 150, 150, 0, 0, 0, 255 ) --- CENTRO Area20Col = createColRectangle ( 325+300,-4046+150, 150, 150 ) --- CENTRO local Area19 = createRadarArea ( 325+450,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area19Col = createColRectangle ( 325+450,-4046+150, 150, 150 ) --- RED local Area7 = createRadarArea ( 325+600,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area7Col = createColRectangle ( 325+600,-4046+150, 150, 150 ) --- GREEN local Area8 = createRadarArea ( 325,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area8Col = createColRectangle ( 325,-4046+300, 150, 150 ) --- GREEN local Area15 = createRadarArea ( 325+150,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area15Col = createColRectangle ( 325+150,-4046+300, 150, 150 ) -- Yellow local Area16 = createRadarArea ( 325+300,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area16Col = createColRectangle ( 325+300,-4046+300, 150, 150 ) -- Yellow local Area17 = createRadarArea ( 325+450,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area17Col = createColRectangle ( 325+450,-4046+300, 150, 150 ) -- Yellow local Area9 = createRadarArea ( 325+600,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area9Col = createColRectangle ( 325+600,-4046+300, 150, 150 ) --- GREEN local Area10 = createRadarArea ( 325,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area10Col = createColRectangle ( 325,-4046+450, 150, 150 ) --- GREEN local Area11 = createRadarArea ( 325+150,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area11Col = createColRectangle ( 325+150,-4046+450, 150, 150 ) --- GREEN local Area12 = createRadarArea ( 325+300,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area12Col = createColRectangle ( 325+300,-4046+450, 150, 150 ) --- GREEN local Area13 = createRadarArea ( 325+450,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area13Col = createColRectangle ( 325+450,-4046+450, 150, 150 ) --- GREEN local Area14 = createRadarArea ( 325+600,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area14Col = createColRectangle ( 325+600,-4046+450, 150, 150 ) --- GREEN local randomSpawnTable = { {Area1}, {Area2}, {Area3}, {Area4}, } function ComenzarAreasGreen () while true do local RandomArea = randomSpawnTable [ random ] if not( isRadarAreaFlashing ( RandomArea ) ) then setRadarAreaFlashing ( RandomArea, true ) break end end end setTimer(ComenzarAreasGreen,15000,0) Prueba esto. Por que haces un while? Para que la función se repita automáticamente sin necesidad de re-ejecutarla de nuevo mediante esa linea así hasta que no encuentre un área libre la función seguirá ejecutándose repeat until no serviria? Link to comment
Arsilex Posted October 11, 2015 Share Posted October 11, 2015 local Area1 = createRadarArea ( 325,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area1Col = createColRectangle ( 325,-4046, 150, 150 ) --- GREEN local Area2 = createRadarArea ( 325+150,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area2Col = createColRectangle ( 325+150,-4046, 150, 150 ) --- GREEN localArea3 = createRadarArea ( 325+300,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area3Col = createColRectangle ( 325+300,-4046, 150, 150 ) --- GREEN localArea4 = createRadarArea ( 325+450,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area4Col = createColRectangle ( 325+450,-4046, 150, 150 ) --- GREEN local Area5 = createRadarArea ( 325+600,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area5Col = createColRectangle ( 325+600,-4046, 150, 150 ) --- GREEN local Area6 = createRadarArea ( 325,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area6Col = createColRectangle ( 325,-4046+150, 150, 150 ) --- GREEN local Area18 = createRadarArea ( 325+150,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area18Col = createColRectangle ( 325+150,-4046+150, 150, 150 ) --- RED local Area20 = createRadarArea ( 325+300,-4046+150, 150, 150, 0, 0, 0, 255 ) --- CENTRO Area20Col = createColRectangle ( 325+300,-4046+150, 150, 150 ) --- CENTRO local Area19 = createRadarArea ( 325+450,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area19Col = createColRectangle ( 325+450,-4046+150, 150, 150 ) --- RED local Area7 = createRadarArea ( 325+600,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area7Col = createColRectangle ( 325+600,-4046+150, 150, 150 ) --- GREEN local Area8 = createRadarArea ( 325,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area8Col = createColRectangle ( 325,-4046+300, 150, 150 ) --- GREEN local Area15 = createRadarArea ( 325+150,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area15Col = createColRectangle ( 325+150,-4046+300, 150, 150 ) -- Yellow local Area16 = createRadarArea ( 325+300,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area16Col = createColRectangle ( 325+300,-4046+300, 150, 150 ) -- Yellow local Area17 = createRadarArea ( 325+450,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area17Col = createColRectangle ( 325+450,-4046+300, 150, 150 ) -- Yellow local Area9 = createRadarArea ( 325+600,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area9Col = createColRectangle ( 325+600,-4046+300, 150, 150 ) --- GREEN local Area10 = createRadarArea ( 325,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area10Col = createColRectangle ( 325,-4046+450, 150, 150 ) --- GREEN local Area11 = createRadarArea ( 325+150,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area11Col = createColRectangle ( 325+150,-4046+450, 150, 150 ) --- GREEN local Area12 = createRadarArea ( 325+300,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area12Col = createColRectangle ( 325+300,-4046+450, 150, 150 ) --- GREEN local Area13 = createRadarArea ( 325+450,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area13Col = createColRectangle ( 325+450,-4046+450, 150, 150 ) --- GREEN local Area14 = createRadarArea ( 325+600,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area14Col = createColRectangle ( 325+600,-4046+450, 150, 150 ) --- GREEN local randomSpawnTable = { {Area1}, {Area2}, {Area3}, {Area4}, } function ComenzarAreasGreen () while true do local RandomArea = randomSpawnTable [ random ] if not( isRadarAreaFlashing ( RandomArea ) ) then setRadarAreaFlashing ( RandomArea, true ) break end end end setTimer(ComenzarAreasGreen,15000,0) Por que haces un while? Para que la función se repita automáticamente sin necesidad de re-ejecutarla de nuevo mediante esa linea así hasta que no encuentre un área libre la función seguirá ejecutándose repeat until no serviria? Si, seriviria pero yo suelo usar while local Area1 = createRadarArea ( 325,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area1Col = createColRectangle ( 325,-4046, 150, 150 ) --- GREEN local Area2 = createRadarArea ( 325+150,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area2Col = createColRectangle ( 325+150,-4046, 150, 150 ) --- GREEN localArea3 = createRadarArea ( 325+300,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area3Col = createColRectangle ( 325+300,-4046, 150, 150 ) --- GREEN localArea4 = createRadarArea ( 325+450,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area4Col = createColRectangle ( 325+450,-4046, 150, 150 ) --- GREEN local Area5 = createRadarArea ( 325+600,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area5Col = createColRectangle ( 325+600,-4046, 150, 150 ) --- GREEN local Area6 = createRadarArea ( 325,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area6Col = createColRectangle ( 325,-4046+150, 150, 150 ) --- GREEN local Area18 = createRadarArea ( 325+150,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area18Col = createColRectangle ( 325+150,-4046+150, 150, 150 ) --- RED local Area20 = createRadarArea ( 325+300,-4046+150, 150, 150, 0, 0, 0, 255 ) --- CENTRO Area20Col = createColRectangle ( 325+300,-4046+150, 150, 150 ) --- CENTRO local Area19 = createRadarArea ( 325+450,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area19Col = createColRectangle ( 325+450,-4046+150, 150, 150 ) --- RED local Area7 = createRadarArea ( 325+600,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area7Col = createColRectangle ( 325+600,-4046+150, 150, 150 ) --- GREEN local Area8 = createRadarArea ( 325,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area8Col = createColRectangle ( 325,-4046+300, 150, 150 ) --- GREEN local Area15 = createRadarArea ( 325+150,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area15Col = createColRectangle ( 325+150,-4046+300, 150, 150 ) -- Yellow local Area16 = createRadarArea ( 325+300,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area16Col = createColRectangle ( 325+300,-4046+300, 150, 150 ) -- Yellow local Area17 = createRadarArea ( 325+450,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area17Col = createColRectangle ( 325+450,-4046+300, 150, 150 ) -- Yellow local Area9 = createRadarArea ( 325+600,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area9Col = createColRectangle ( 325+600,-4046+300, 150, 150 ) --- GREEN local Area10 = createRadarArea ( 325,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area10Col = createColRectangle ( 325,-4046+450, 150, 150 ) --- GREEN local Area11 = createRadarArea ( 325+150,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area11Col = createColRectangle ( 325+150,-4046+450, 150, 150 ) --- GREEN local Area12 = createRadarArea ( 325+300,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area12Col = createColRectangle ( 325+300,-4046+450, 150, 150 ) --- GREEN local Area13 = createRadarArea ( 325+450,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area13Col = createColRectangle ( 325+450,-4046+450, 150, 150 ) --- GREEN local Area14 = createRadarArea ( 325+600,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area14Col = createColRectangle ( 325+600,-4046+450, 150, 150 ) --- GREEN local randomSpawnTable = { Area1, Area2, Area3, Area4, } function ComenzarAreasGreen () while true do local RandomArea = randomSpawnTable [ math.random(1, #randomSpawnTable) ] if not( isRadarAreaFlashing ( RandomArea ) ) then setRadarAreaFlashing ( RandomArea, true ) break end end end addCommandHandler("lol", function() ComenzarAreasGreen() end) acabo de probarlo y funciona bien. Link to comment
Narutimmy Posted October 11, 2015 Author Share Posted October 11, 2015 Si, seriviria pero yo suelo usar while local Area1 = createRadarArea ( 325,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area1Col = createColRectangle ( 325,-4046, 150, 150 ) --- GREEN local Area2 = createRadarArea ( 325+150,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area2Col = createColRectangle ( 325+150,-4046, 150, 150 ) --- GREEN localArea3 = createRadarArea ( 325+300,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area3Col = createColRectangle ( 325+300,-4046, 150, 150 ) --- GREEN localArea4 = createRadarArea ( 325+450,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area4Col = createColRectangle ( 325+450,-4046, 150, 150 ) --- GREEN local Area5 = createRadarArea ( 325+600,-4046, 150, 150, 0, 255, 0, 100 ) --- GREEN Area5Col = createColRectangle ( 325+600,-4046, 150, 150 ) --- GREEN local Area6 = createRadarArea ( 325,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area6Col = createColRectangle ( 325,-4046+150, 150, 150 ) --- GREEN local Area18 = createRadarArea ( 325+150,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area18Col = createColRectangle ( 325+150,-4046+150, 150, 150 ) --- RED local Area20 = createRadarArea ( 325+300,-4046+150, 150, 150, 0, 0, 0, 255 ) --- CENTRO Area20Col = createColRectangle ( 325+300,-4046+150, 150, 150 ) --- CENTRO local Area19 = createRadarArea ( 325+450,-4046+150, 150, 150, 255, 0, 0, 100 ) --- RED Area19Col = createColRectangle ( 325+450,-4046+150, 150, 150 ) --- RED local Area7 = createRadarArea ( 325+600,-4046+150, 150, 150, 0, 255, 0, 100 ) --- GREEN Area7Col = createColRectangle ( 325+600,-4046+150, 150, 150 ) --- GREEN local Area8 = createRadarArea ( 325,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area8Col = createColRectangle ( 325,-4046+300, 150, 150 ) --- GREEN local Area15 = createRadarArea ( 325+150,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area15Col = createColRectangle ( 325+150,-4046+300, 150, 150 ) -- Yellow local Area16 = createRadarArea ( 325+300,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area16Col = createColRectangle ( 325+300,-4046+300, 150, 150 ) -- Yellow local Area17 = createRadarArea ( 325+450,-4046+300, 150, 150, 255,255,0, 100 ) -- Yellow Area17Col = createColRectangle ( 325+450,-4046+300, 150, 150 ) -- Yellow local Area9 = createRadarArea ( 325+600,-4046+300, 150, 150, 0, 255, 0, 100 ) --- GREEN Area9Col = createColRectangle ( 325+600,-4046+300, 150, 150 ) --- GREEN local Area10 = createRadarArea ( 325,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area10Col = createColRectangle ( 325,-4046+450, 150, 150 ) --- GREEN local Area11 = createRadarArea ( 325+150,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area11Col = createColRectangle ( 325+150,-4046+450, 150, 150 ) --- GREEN local Area12 = createRadarArea ( 325+300,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area12Col = createColRectangle ( 325+300,-4046+450, 150, 150 ) --- GREEN local Area13 = createRadarArea ( 325+450,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area13Col = createColRectangle ( 325+450,-4046+450, 150, 150 ) --- GREEN local Area14 = createRadarArea ( 325+600,-4046+450, 150, 150, 0, 255, 0, 100 ) --- GREEN Area14Col = createColRectangle ( 325+600,-4046+450, 150, 150 ) --- GREEN local randomSpawnTable = { Area1, Area2, Area3, Area4, } function ComenzarAreasGreen () while true do local RandomArea = randomSpawnTable [ math.random(1, #randomSpawnTable) ] if not( isRadarAreaFlashing ( RandomArea ) ) then setRadarAreaFlashing ( RandomArea, true ) break end end end addCommandHandler("lol", function() ComenzarAreasGreen() end) acabo de probarlo y funciona bien. Ahi funciona pero solo se selecciona la 1 y la 2, y despues tira este error: Link to comment
Arsilex Posted October 11, 2015 Share Posted October 11, 2015 Claro por que no suele salir otras tienes 4 en la tabla el math.random es tan repetitivo que casi siempre da 1 o 2 o cosas así te sugeriría eligir otra manear de hacer random que la de mta no se podrías crear una funcion propio mas aleatoria, si usuarias tu funcion sin while te saldría un error parecido solo que con otras palabras Link to comment
Arsilex Posted October 11, 2015 Share Posted October 11, 2015 No me di cuenta de una cosa arriba tienes mal definido 2 areas la 3 y la 4 por eso solo hace random de 2 ya me parecia raro que nunca saliese 3 y 4 jeje Link to comment
Narutimmy Posted October 11, 2015 Author Share Posted October 11, 2015 Claro por que no suele salir otras tienes 4 en la tabla el math.random es tan repetitivo que casi siempre da 1 o 2 o cosas así te sugeriría eligir otra manear de hacer random que la de mta no se podrías crear una funcion propio mas aleatoria, si usuarias tu funcion sin while te saldría un error parecido solo que con otras palabras Ya vi el error, la variable de Area 3 y 4 estaban ma, estaba localArea3 en lugar de local Area3 Ya realize la pruba y todo bien se seleccionan las 3, el problema es que cuando las 4 ya fueron seleccionadas si se vuelve a ejecutar tira el error de infinito, ahi alguna manera de identificar cuando ya no quede ninguna? Para que cuando eso pase se lanze una nueva funcion que aga lo mismo pero con otra tabla de areas? Link to comment
UserToDelete Posted October 11, 2015 Share Posted October 11, 2015 No se si esto funcionará, pero teoricamente crea un cuadrado perfecto area = {} col = {} function gen () local cuadrado = 4 local x,y = 0,0 for i=1, cuadrado^2 do if x <= cuadrado then table.insert(area, createRadarArea ( 325+(x*150),-4046+(y*150), 150, 150, 0, 255, 0, 100 )) table.insert(col, createColRectangle ( 325+(x*150),-4046+(y*150), 150, 150 )) x = x + 1 else x = 0 y = y + 1 end end end Si esto funciona a la perfeccion.. usa: function getRandomRadar () for k,v in pairs(area) do if not isRadarAreaFlashing(v) then return v end end end Link to comment
Narutimmy Posted October 11, 2015 Author Share Posted October 11, 2015 No se si esto funcionará, pero teoricamente crea un cuadrado perfecto area = {} col = {} function gen () local cuadrado = 4 local x,y = 0,0 for i=1, cuadrado^2 do if x <= cuadrado then x = x + 1 table.insert(area, createRadarArea ( 325+(x*150),-4046+(y*150), 150, 150, 0, 255, 0, 100 )) table.insert(col, createColRectangle ( 325+(x*150),-4046+(y*150), 150, 150 )) else x = 0 y = y + 1 end end end Si esto funciona a la perfeccion.. usa: function getRandomRadar () for k,v in pairs(area) do if not isRadarAreaFlashing(v) then return v end end end En realidad creo un rectangulo, faltandole una esquina, pero lo crea todo al mismo tiempo, no es lo que busco Link to comment
Recommended Posts