Tutorial *62*


Yipee the RIPs are back...

Legion (Roscoe Sincero) has buggered off to work on his ElimaReaper patch, so I'll be filling his shoes for a while.
He is still active in a consultancy capacity, so I can still draw on his wealth of knowledge for support.

So, my name is Pob the Impaler (Paul Johnstone), you can send me mail at:
[email protected] (for home)
OR
[email protected] (for College)
I don't mind which address you use, so when I inevitably make a boo-boo you'll know how to send me
hate-mail :)
My site is at: http://www.btinternet.com/~impaler please help my hit-counter and visit!

Roscoe Sincero's address is [email protected]

//------------//
//-Credits--//
//-----------//

Steve Polge - For the Reaper bots
Alan Kivlin - For the clever scoreboard stuff
Lee Smith - For ProQCC
Roscoe Sincero - For starting it all off and for giving me a shot of his ElimaReaper!


|=========================================================|

ALWAYS MAKE A BACKUP OF YOUR CODE BEFORE TRYING ONE OF MY LESSONS. IF THERE IS A MISTAKE IN IT WHICH RUINS YOUR CODE OR BLOWS UP YOUR HOUSE, TOUGH SHIT, RESTORE THE BACKUP AND TELL ME WHERE I FUCKED UP.

This is a "Mini RIP" it adds a couple of teeny weeny things that significantly enhance the patch.

First up.... Doesn't it annoy you that in teamplay, the baddys always have skin 15? Well it pisses me Right Off.
So I've changed it to a random choice of skin, it's dead easy, but it looks cool...
BTW you need a player.mdl with 15 skins to see this working.
Read the original reaper readme.txt to see whatI'm blethering about. :)


Step 1


Open up defs.qc 'cos we are gonna add a new variable.

at the bottom add:



//==begin code==//

float randombotskin;

//==end code==//



save & close defs.qc



Step 2
Open up client.qc

We only want choose the random skin ONCE per level, so we need to use a function that is only called once!

First up, find the function ClientConnect(); search for void () ClientConnect = {

Above this function add this:



//====begin code====//

float () getrandombotskin = {

// Get a random bot skin for the enemy team bots.

local float botskin;

botskin = random();

if (botskin <= 0.066)

	{

	return(0);

        }

if ((botskin > 0.066) && (botskin <= 0.132))

	{

	return(1);

	}

if ((botskin > 0.132) && (botskin <= 0.198))

	{

	return(2);

	}

if (( botskin > 0.198) && (botskin <= 0.264))

	{

	return(3);

	}

if ((botskin > 0.264) && (botskin <= 0.33))

	{

	return(4);

	}

if ((botskin > 0.33) && (botskin <= 0.396))

	{

	return(5);

	}

if ((botskin > 0.396) && (botskin <= 0.462))

	{

	return(6);

	}

if ((botskin > 0.462) && (botskin <= 0.528))

	{

	return(7);

	}

if ((botskin > 0.528) && (botskin <= 0.594))

	{

	return(8);

	}

if ((botskin > 0.594) && (botskin <= 0.66))

	{

	return(9);

	}

if ((botskin > 0.66) && (botskin <= 0.726))

	{

	return(10);

	}

if ((botskin > 0.726) && (botskin <= 0.792))

	{

	return(11);

	}

if ((botskin > 0.792) && (botskin <= 0.858))

	{

	return(12);

	}

if ((botskin > 0.858) && (botskin <= 0.924))

	{

	return(13);

	}

if ((botskin > 0.924) && (botskin <= 1.000))

	{

	return(15);

	}

else

{

return(15);

}

};

//===end code==//


Step 3


Now find ClientConnect() again. search for void () ClientConnect = {



Find the line:

 self.impulse = 204.000;



under this add:

//====begin code===//

randombotskin = getrandombotskin();  // get random team bot skin for this level

//===end code===//



Save & close client.qc


Step 4


Now open botspawn.qc

search for all occurences of the line:

skinChange (self,15.000);



replace all occurences of this with:



//====begin code===//

skinChange (self,randombotskin);

//=== end code====//



Save and close botspawn.qc.



Compile and run!

(Remember to turn on skins mode and teamplay  :)



Good isn't it!!!  :)

Next up we are going to fix a bug Roscoe forgot to fix in his coop code.

You may have noticed that when playing coop, on anything less than skill 3 the bots can't shoot
their own arses, nevermind the monsters! So let's fix it.


Step 1

Open botfight.qc



Find the function botaim() search for vector () botaim = {



find the lines:

if (!coop)

{

      lead = (self.enemy.origin - self.enemy.oldorigin);

      lead = (((lead * (MOVETYPE_WALK - sk)) * 3.500) * (random () - 0.500));

      tg = (tg + lead);

}



under these lines add:



//====begin code====//

else

{

lead = '0 0 0';

tg = (tg +lead);

}

//===end code===//



save and close botfight.qc

compile and play coop on skill 0, you wuss!  :)

See ya next time kiddies!



 
Sign up
Login:
Passwd:
[Remember Me]