FAKK2 Editing

/ home / game - view / fakked.ritual.com / tutorial06

What's New Entities Turtorials Scripting Advanced Techniques Technical Documents Links | Want to learn how to script characters to walk around a level and play animation's through your level script? It's easy! Here's the files, now read below. First, add a NPC character, or enemy, which ever you want. I chose to add Kerrie because the description of her is hilarious, "My name is Kerrie, I look a lot like my sister Julie but I'm knocked up." Ok, next, position the character any where you like, but be sure to have in mind where you want the character to start walking from and where you want the character to stop walking. Or you can make the character continue walking endlessly by setting up a loop in your script like this `start:` `thread walk_around_loop` `walk_around_loop: //the label used to loop the script thread.` `$character walk here` `wait <time>` `$character turn 180` `wait <time>` `$character walk to starting position` `wait <time>` `$character turn 180` `wait <time>` `goto walk_around_loop //this line will cause the script pointer to return to the line` `//labeled "walk_around_loop:", and then begin to execute the commands again. As you will` `//see, this will happened continuously.` Back to the main task, getting Kerrie to walk around the level. There are several ways you can make Kerrie walk around the level. You could randomly generate numbers used for the "turnto" angles, then have her walk foward for a certain time, or perhaps have that time be randomly generated as well. Or... you can be smart and set her to walk to various way points throughout the level, which is the method I chose, because I'm smart, damnit! I added two info_waypoints as the two spots I want Kerrie walking to and fro. Next, give each info_waypoint a unique targetname. Last thing to do is create a script to along with the level. `//Script by Reid "BrushBoy" Kimball //Ritual Entertainment Level Design and Scripting Intern Summer 2k through Winter 2k //November, 14th 2000 start: //always have this, or init: both do the same thing as far as I know.` `thread walk_kerrie //start executing this thread. end //if it ever exists out of the loop, terminate processing of the script.` `walk_kerrie: //label for the thread. $kerrie walkto $wp02 //"$kerrie" refers to the targetname I gave my NPC, kerrie. walkto is //the command, and $wp02 is the info_waypoint that the NPC will walk to. wait 5 //wait 5 seconds before continuing with the thread. $kerrie walkto $wp01 //make $Kerrie walk to the first waypoint. wait 5 //wait 5 seconds before continuing with the thread. I wait 5 seconds so the NPC can //complete walking.` `goto walk_kerrie //loop back up to the top to start the whole thread over again, and again, //endlessly until the player quits the level.` `end //end the thread` Then of course, compile your level, make sure your script is saved with the same name as your level, but with a .scr extension, plus it resides in the maps directory. Load up your level and the character you added should be walking around. -BrushBaron