Gurtag
Member
hey guys, i been using an random script i got from digging old treads think ilu post it, use it to display ramdom backgounds/panels in a level, i use it in a none type entity with several follows i spawn on the level, my idea is to make kind of mortal kombat tower like game mode in wich every level is random(only the visual part) it works but there are 2 issues i would like to solve and they are out of my knoledge... first thing every time i start the game and start say gamemode it display the same follow# , random script only start to work after been ingame and restarting say gamemode, also how could be done to prevent the script from picking a follow# that was allready used so it doesnt repeat same follow..
here the code i am using i mod a bit to work with 10 follows so far...
here the code i am using i mod a bit to work with 10 follows so far...
Code:
@script
void self = getlocalvar("self");
if( frame == 0)
{
int r = rand()%99;
if (r <0)
{ // If the r is negative,
r = r*-1; // Make it positive
}
if( r >=0 && r <=9)
{
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW1"));
}
else if( r >=10 && r <=19)
{
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW2"));
}
else if( r >=20 && r <=29)
{
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW3"));
}
else if( r >=30 && r <=39)
{
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW4"));
}
else if( r >=40 && r <=49)
{
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW5"));
}
else if( r >=50 && r <=59)
{
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW6"));
}
else if( r >=60 && r <=69)
{
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW7"));
}
else if( r >=70 && r <=79)
{
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW8"));
}
else if( r >=80 && r <=89)
{
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW9"));
}
else if( r >=90 && r <=99)
{
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW10"));
}
}
@end_script