Page 1 of 1

random

PostPosted: Sun Aug 19, 2007 12:19 am
by I robot
can any one tell me the code for random create actor? :?: :?: :?: :?: :?: :?: :?: :?: :?: :?: :?: :?:

PostPosted: Sun Aug 19, 2007 12:59 am
by d-soldier
Slap this into the event you wish to do the creating, and fill in the blanks below.

int n;
n=rand(5);
if (n==0)
{
//insert create actor script here
}
if (n==1)
{
//insert create actor script here
}
if (n==2)
{
//insert create actor script here
}
if (n==3)
{
//insert create actor script here
}
if (n==4)
{
//insert create actor script here
}

PostPosted: Sun Aug 19, 2007 1:02 am
by I robot
Thanks :mrgreen: :mrgreen: :D :D :mrgreen: :mrgreen:

PostPosted: Sun Aug 19, 2007 11:38 am
by Troodon
d-soldier wrote:Slap this into the event you wish to do the creating, and fill in the blanks below.

int n;
n=rand(5);
if (n==0)
{
//insert create actor script here
}
if (n==1)
{
//insert create actor script here
}
if (n==2)
{
//insert create actor script here
}
if (n==3)
{
//insert create actor script here
}
if (n==4)
{
//insert create actor script here
}


This is off-topic but can the 'int n' be used with the switch function? If yes, it would be shorter wouldn't it? I never adopted the switch code for some unknown reason.

PostPosted: Sun Aug 19, 2007 3:44 pm
by d-soldier
I never adopted the switch code because I have to idea how to use it... :D So maybe it would... I dunno.

PostPosted: Sun Aug 19, 2007 4:13 pm
by Jay S.
tekdino wrote:can the 'int n' be used with the switch function? If yes, it would be shorter wouldn't it? I never adopted the switch code for some unknown reason.

I think it can... just tried this code out and it worked:
Code: Select all
int n=0;
switch(n)
{
    case 1:
    //stuff...
    break;
    case 2:
    //more stuff...
    break;
}

PostPosted: Fri Aug 24, 2007 6:01 pm
by I robot
thanks all :D :D :D :D :D :D :mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen: :D :mrgreen: :mrgreen: