04-03-2011, 09:11
(This post was last modified: 04-03-2011, 15:54 by rotceh_dnih.)
this is a follow on from my tut here
today we will see two examples of RandomInt switch first random killstreaks on spawn then death messages and alittle explanation at the end
Lets start
Like before we start by makeing a thread called randomstuff in OnPlayerSpawned like so
then our thread
and now death message's
this time we are going to call our thread randommessage after death
and the randomswitch
now lets break it down
is the random switch of 15 starting with case 0: ending on case 14:
and after the last break; is what what want to do ie
as always hope this helps someone learn xD as im am still verymuch a learner myself
credit's: iAegle for helping a noob
today we will see two examples of RandomInt switch first random killstreaks on spawn then death messages and alittle explanation at the end
Lets start
Like before we start by makeing a thread called randomstuff in OnPlayerSpawned like so
Code:
onPlayerSpawned()
{
self endon("disconnect");
for(;;)
{
self waittill("spawned_player");
self thread randomstuff();
}
}
Code:
randomstuff()
{
switch(RandomInt(15))
{
case 0:
self.randomKillstreak = "radar_mp";
break;
case 1:
self.randomKillstreak = "counteruav_mp";
break;
case 2:
self.randomKillstreak = "tow_turret_drop_mp";
break;
case 3:
self.randomKillstreak = "supplydrop_mp";
break;
case 4:
self.randomKillstreak = "turret_drop_mp";
break;
case 5:
self.randomKillstreak = "mortar_mp";
break;
case 6:
self.randomKillstreak = "napalm_mp";
break;
case 7:
self.randomKillstreak = "rcbomb_mp";
break;
case 8:
self.randomKillstreak = "helicopter_mp";
break;
case 9:
self.randomKillstreak = "radardirection_mp";
break;
case 10:
self.randomKillstreak = "m220_tow_drop_mp";
break;
case 11:
self.randomKillstreak = "airstrike_mp";
break;
case 12:
self.randomKillstreak = "helicopter_gunner_mp";
break;
case 13:
self.randomKillstreak = "helicopter_player_firstperson_mp";
break;
case 14:
self.randomKillstreak = "dogs_mp";
break;
}
self maps\mp\gametypes\_hardpoints::giveKillstreak(self.randomKillstreak );
}
this time we are going to call our thread randommessage after death
Code:
onPlayerSpawned()
{
self endon("disconnect");
for(;;)
{
self waittill("spawned_player");
self waittill("death");
self thread maps\mp\gametypes\_hud::fadeToBlackForXSec( 0.0, 4, 0, 1 );
self thread randommessage();
}
}
Code:
randommessage ()
{
switch(RandomInt(15))
{
case 0:
self.randommessage = "^1A man's dying is more the survivors' affair than his own.";
break;
case 1:
self.randommessage = "^1If the enemy is in range, so are you.";
break;
case 2:
self.randommessage = "^1War does not determine who is right - only who is left.";
break;
case 3:
self.randommessage = "^1Never forget that your weapon was made by the lowest bidder.";
break;
case 4:
self.randommessage = "^1Teamwork is essential, it gives them other people to shoot at";
break;
case 5:
self.randommessage = "^1For death begins with life's first breath And life begins at touch of death";
break;
case 6:
self.randommessage = "^1All that is necessary for evil to succeed is for good men to do nothing";
break;
case 7:
self.randommessage = "^1If you can't remember, the claymore is pointed toward you.";
break;
case 8:
self.randommessage = "^1It is a blessing to die for a cause, because you can so easily die for nothing.";
break;
case 9:
self.randommessage = "^1Older men declare war. But it's the youth who must fight and die";
break;
case 10:
self.randommessage = "^1When you have to kill a man it costs nothing to be polite.";
break;
case 11:
self.randommessage = "^1Death takes the good, too good to stay, And leaves the bad, too bad to take away";
break;
case 12:
self.randommessage = "^1use emotion for the many and reserve reason for the few";
break;
case 13:
self.randommessage = "^1Battle is an orgy of disorder.";
break;
case 14:
self.randommessage = "^1There is no glory in battle worth the blood it costs";
break;
}
self iPrintlnBold( self.randommessage );
}
Code:
switch(RandomInt(15))
and after the last break; is what what want to do ie
Code:
break;
}
self iPrintlnBold( self.randommessage );
}
OR
break;
}
self maps\mp\gametypes\_hardpoints::giveKillstreak(self.randomKillstreak );
}
credit's: iAegle for helping a noob
Go home IW.... your drunk.
Youtube: http://www.youtube.com/user/TheMrStacie
Twitter: https://twitter.com/#!/rotceh_dnih
Youtube: http://www.youtube.com/user/TheMrStacie
Twitter: https://twitter.com/#!/rotceh_dnih