Inside3D tutorials.
Created By: | Pob the Impaler (Paul Johnstone) |
A.W.Johnstone@btinternet.com | |
Difficulty Scale | Easy/Medium |
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
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.
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!