Saladin Newbie
Posts : 37 Thanked : 0 Engine : Other Skill : Very Beginner Type : Developer
| Subyek: [GML]nanya script random 2011-08-30, 15:57 | |
| kk kk,, aku mau nanya lagi nih padahal trid sebelah belon solved mau nanya, kalo di script GML, mau bikin random gmana ya? contoh klo di rm : - Code:
-
set var coba random 1-3 if coba =1 { switch 1 : on } if coba =2 { switch 2 : on } if coba=3 { switch 3 : on }
nah,, itu kalo di event rm kalo ga salah gitu tapi kalo di script gml kayak gmana ya tolong dong | |
|
Vsio Xutix Xox
Posts : 2377 Thanked : 18 Engine : Multi-Engine User Skill : Advanced Type : Developer
| Subyek: Re: [GML]nanya script random 2011-08-30, 16:18 | |
| kalau aku gini:
- Code:
-
nilai = choose(1,2,3,4,5,...) /*sampai 16 argumen*/
switch(nilai) { case 1: /*event 1*/;break; case 2: /*event 2*/;break; case 3: /*event 3*/;break; case 4: /*event 4*/;break; case 5: /*event 5*/;break; ... } EDITED:
Kalau mau bikin nilai random, cukup gini:
- Code:
-
nilai = random(value); /*value isi dgn angka. Nilainya akan dari 0 < nilai < value */ Contoh:
- Code:
-
nilai = random(20); /*maka nilainya: 0 < nilai < 20 */
| |
|
bungatepijalan Moe Princess
Posts : 1487 Thanked : 30 Engine : Multi-Engine User Skill : Intermediate Type : Developer
Trophies
Awards: | Subyek: Re: [GML]nanya script random 2011-08-30, 16:51 | |
| - Code:
-
coba = 1+irandom(2) //[1,2,3] switch(coba){ case 1: switch1 = true; break; case 2: switch2 = true; break; case 3: switch3 = true; break; } sori numpang nambah post | |
|
Saladin Newbie
Posts : 37 Thanked : 0 Engine : Other Skill : Very Beginner Type : Developer
| Subyek: Re: [GML]nanya script random 2011-08-30, 19:27 | |
| @vsio aku coba gak bisa kk vsio .. @bunga punya kk bunga baru bisa makasih solved... | |
|
Vsio Xutix Xox
Posts : 2377 Thanked : 18 Engine : Multi-Engine User Skill : Advanced Type : Developer
| Subyek: Re: [GML]nanya script random 2011-08-30, 20:42 | |
| | |
|
Sponsored content
| Subyek: Re: [GML]nanya script random | |
| |
|