Demongo Posted June 19, 2009 Share Posted June 19, 2009 I am currently working on a module and it is full with civillians and other NPCs so I want to ask: How can I make NPCs walk around a module? Like on Taris. The Sith and Citzens are walking around Taris. Thanks in advance. Link to comment Share on other sites More sharing options...
disbeliever Posted June 19, 2009 Share Posted June 19, 2009 waypoints edit: sorry not more specific but I do not know how myself, just how its done. Link to comment Share on other sites More sharing options...
Prime Posted June 19, 2009 Share Posted June 19, 2009 Actually, there is a way for them to walk around randomly. I know I did it a long time ago for a mod I did for myself. Sorry that I can't remember the specifics. Link to comment Share on other sites More sharing options...
DarthStoney Posted June 19, 2009 Share Posted June 19, 2009 Here's a good link for how to do it http://www.lucasforums.com/showthread.php?t=142290 Link to comment Share on other sites More sharing options...
Demongo Posted June 19, 2009 Author Share Posted June 19, 2009 Well I need to know exactly the way how to do it. I am thinking of making waypoints, then create script to move to the waypoints or something like this....... EDIT: I followed SithSpecter's tutorial but it didn't work. I don't really know what can be the problem. Any help? Link to comment Share on other sites More sharing options...
logan23 Posted June 19, 2009 Share Posted June 19, 2009 Hey, Here is what you do to get the character to walk random. Just remember the NPC will start walking in the direction you point them. So don't have them all facing same way or each other since it might lead to them bumping into each other. Go to the utc's script area and locate k_def_spawn01 You will then open the script and go to the bottom and make one change- //****** TURN ON WALKPOINTS ****** // The following line causes the object to follow waypoints AssignCommand(OBJECT_SELF,ActionRandomWalk()); You place this line in and remove the old line, its in bold for you. Then compile and save the old k_def_spawn01 into another name....for example..... randwlk.nss Should look like this: //:: k_def_spawn01 /* v2.0 Default On Spawn In */ //:: Created By: Preston Watamaniuk //:: Modified By: Anthony Davis //:: Added treasure: Kevin Saunders #include "k_inc_generic" #include "k_inc_debug" #include "k_inc_treas_k2" void main() { //BEGIN WALK WAYPOINT BEHAVIORS (Comment In or Out to Activate ) //****** WAYPOINT PATH STYLE ****** // Object will follow waypoints in order, and then start over at beginning. // Example: WP_01, WP_02, WP_03, then return to WP_01 and continue... //GN_SetSpawnInCondition(SW_FLAG_WAYPOINT_WALK_CIRCULAR); // Object will follow waypoints in order, and then follow the waypoints backwards. // Example: WP_01, WP_02, WP_03, then WP_02, WP_01, //GN_SetSpawnInCondition(SW_FLAG_WAYPOINT_WALK_PATH); // Object will follow waypoints in a RANDOM order // Example: WP_02, WP_03, WP_01 //GN_SetSpawnInCondition(SW_FLAG_WAYPOINT_WALK_RANDOM); // Object will follow waypoints starting with NEAREST waypoint. // THIS WILL EFFECT THE ORDER THE WAYPOINTS ARE FOLLOWED! //GN_SetSpawnInCondition(SW_FLAG_WAYPOINT_START_AT_NEAREST); //****** WAYPOINT FREQUENCY ****** // Object will follow waypoints ONLY ONCE. // Leave commented out to have waypoints repeated forever. //GN_SetSpawnInCondition(SW_FLAG_WAYPOINT_WALK_ONCE); //****** WAYPOINT SPEED ****** // Object will RUN to waypoints. //GN_SetSpawnInCondition(SW_FLAG_WAYPOINT_WALK_RUN); //****** WAYPOINT PAUSING ****** // Object will PAUSE at each waypoints based on each option. // CObjects will ONLY turn to face in the waypoint direction if // the are pausing at the waypoint. // The pause times are: // Causes the Object to pause for 1 - 3 seconds at a waypoint //GN_SetSpawnInCondition(SW_FLAG_WAYPOINT_PAUSE_SHORT); // Causes the Object to pause for 4 - 6 seconds at a waypoint //GN_SetSpawnInCondition(SW_FLAG_WAYPOINT_PAUSE_LONG); // Causes the Object to pause for 1 - 10 seconds at a waypoint //GN_SetSpawnInCondition(SW_FLAG_WAYPOINT_PAUSE_RANDOM); //****** WAYPOINT ANIMATIONS ****** // Object will play an animation that has been specified with // SetLocalNumber(OBJECT_SELF, 29, <SOME ANIMATION NUMBER> ) // Local number 29 is reserved for animations. // This may conflict with ambient animations (further down) //GN_SetSpawnInCondition(SW_FLAG_USE_WAYPOINT_ANIMATION); // If using an animation at a waypoint, uncomment and set the following lin: //SetLocalNumber(OBJECT_SELF, 29, <SOME ANIMATION NUMBER> ); //****** WAYPOINT SERIES ****** // If this function is uncommented a number from 1 to 99 must be passed. // This number represents a waypoint series that uses the string "01" through "99" // instead of the creature's tag. // eg. WP_22_01 through WP_22_05. 22 is the series number set with this function. //GN_SetWalkWayPointsSeries( 1 ); //END WALK WAYPOINT BEHAVIORS //****** AMBIENT ANIMATIONS ****** // This will play Ambient Animations until the NPC sees an enemy or is cleared. // NOTE: that these animations will play automatically for Encounter Creatures. //GN_SetSpawnInCondition(SW_FLAG_COMMONER_BEHAVIOR); //GN_SetSpawnInCondition(SW_FLAG_FAST_BUFF); //GN_SetSpawnInCondition(SW_FLAG_AMBIENT_ANIMATIONS); //GN_SetSpawnInCondition(SW_FLAG_AMBIENT_ANIMATIONS_MOBILE); //****** COMPUTER DIALOG ****** //When a creature with this flag is talked to a computer dialogue will come up instead of the usual screens. //GN_SetSpawnInCondition(SW_FLAG_ON_DIALOGUE_COMPUTER); //****** CUSTOM USER DEFINED EVENTS ****** // The following settings will allow the user to fire one of the blank // user defined events in the NW_D2_DefaultD. Like the OnSpawnIn script, // this script is meant to be customized by the end user to allow for unique // behaviors. The user defined events user 1000 - 1010 //GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_HEARTBEAT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1001 //GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_PERCEPTION); //OPTIONAL BEHAVIOR - Fire User Defined Event 1002 //GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_ATTACKED); //OPTIONAL BEHAVIOR - Fire User Defined Event 1005 //GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_DAMAGED); //OPTIONAL BEHAVIOR - Fire User Defined Event 1006 //GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_DISTURBED); //OPTIONAL BEHAVIOR - Fire User Defined Event 1008 //GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_COMBAT_ROUND_END); //OPTIONAL BEHAVIOR - Fire User Defined Event 1003 //GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_DIALOGUE); //OPTIONAL BEHAVIOR - Fire User Defined Event 1004 //GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_DEATH); //OPTIONAL BEHAVIOR - Fire User Defined Event 1007 //GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_DISTURBED); //OPTIONAL BEHAVIOR - Fire User Defined Event 1008 //GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_BLOCKED); //OPTIONAL BEHAVIOR - Fire User Defined Event 1009 //GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_FORCE_AFFECTED); //OPTIONAL BEHAVIOR - Fire User Defined Event 1010 //GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_DIALOGUE_END); //OPTIONAL BEHAVIOR - Fire User Defined Event 1011 //****** BEGIN DEFAULT GENERIC BEHAVIOR (DO NOT TOUCH) ****** GN_SetDayNightPresence(AMBIENT_PRESENCE_ALWAYS_PRESENT); // This function although poorly named sets up the listening patterns and other // important data for the creature it should never be removed. GN_SetListeningPatterns(); SetLocalNumber(OBJECT_SELF, 11, 6);// FAK - OEI default turret cooldown //****** END DEFAULT GENERIC BEHAVIOR (DO NOT TOUCH) ****** //****** TREASURE PLACEMENT PlaceCritterTreasure(OBJECT_SELF, Random(4)-2); //****** TURN ON WALKPOINTS ****** // The following line causes the object to follow waypoints AssignCommand(OBJECT_SELF,ActionRandomWalk()); } Logan Link to comment Share on other sites More sharing options...
Demongo Posted June 19, 2009 Author Share Posted June 19, 2009 I have the ist version of the script, but I included that line, and it worked. Only one problem: When I speak to the NPC he stops moving around. Is there a script to put in the OnEndDialog box? Link to comment Share on other sites More sharing options...
ajlbibak Posted June 20, 2009 Share Posted June 20, 2009 From Making NPCs walk waypoints tutorial #glovemaster 19/01/09: A problem I found was that when you talked to them they stopped walking their waypoints, I had to add the following script to fire onEndDialog to fix it. #include "k_inc_generic" #include "k_inc_debug" #include "k_inc_treas_k2" void main(){ // Force them to continue walking waypoints. GN_WalkWayPoints(); } Link to comment Share on other sites More sharing options...
Demongo Posted June 20, 2009 Author Share Posted June 20, 2009 That script doesn't work(at least for me), I tried it. Link to comment Share on other sites More sharing options...
DarthStoney Posted June 20, 2009 Share Posted June 20, 2009 If this is for K1 try attatching this script to the end of the actual dialog tree its actually k_act_walkways2.nss already in K1. #include "k_inc_generic" #include "k_inc_debug" void main() { GN_SetSpawnInCondition(SW_FLAG_WAYPOINT_DEACTIVATE, FALSE); ClearAllActions(); DelayCommand(1.0, GN_WalkWayPoints()); } Link to comment Share on other sites More sharing options...
Robespierre Posted June 20, 2009 Share Posted June 20, 2009 Isn't there also a certain script like walk random or something? I seem to remember it only working on modules which had .pth files though. Link to comment Share on other sites More sharing options...
Demongo Posted June 20, 2009 Author Share Posted June 20, 2009 Isn't there also a certain script like walk random or something? I seem to remember it only working on modules which had .pth files though. Well I tried that, and it actually worked but "random walk" means take two steps, then stop. Then take 3 steps, and stop. Take a few steps then stop...etc. I need a script which forces the NPCs to go to waypoints I created for them. If this is for K1 try attatching this script to the end of the actual dialog tree its actually k_act_walkways2.nss already in K1. #include "k_inc_generic" #include "k_inc_debug" void main() { GN_SetSpawnInCondition(SW_FLAG_WAYPOINT_DEACTIVATE, FALSE); ClearAllActions(); DelayCommand(1.0, GN_WalkWayPoints()); } Thanks, I will try this, and just to be sure, can you send the .nss version of the script that is supposed to force the NPC to follow waypoints? EDIT: And spawn the NPC too ^ Link to comment Share on other sites More sharing options...
glovemaster Posted June 20, 2009 Share Posted June 20, 2009 That script I threw together above was a quick fix to make NPC's walk their waypoints after finishing a dialogue, since here we are using the random walk function then that won't work. I think this script should make the NPC walk randomly again, personally I'd consider using waypoints for a few NPC's just to make it look more realistic - a few browsing markets or whatever the situation. This function I think was intended more for ambient creatures. /* Resume random walk - onEndDialogue script. */ #include "k_inc_generic" #include "k_inc_debug" #include "k_inc_treas_k2" void main() { AssignCommand(OBJECT_SELF,ActionRandomWalk()); } Link to comment Share on other sites More sharing options...
Demongo Posted June 20, 2009 Author Share Posted June 20, 2009 That script I threw together above was a quick fix to make NPC's walk their waypoints after finishing a dialogue, since here we are using the random walk function then that won't work. I think this script should make the NPC walk randomly again, personally I'd consider using waypoints for a few NPC's just to make it look more realistic - a few browsing markets or whatever the situation. This function I think was intended more for ambient creatures. /* Resume random walk - onEndDialogue script. */ #include "k_inc_generic" #include "k_inc_debug" #include "k_inc_treas_k2" void main() { AssignCommand(OBJECT_SELF,ActionRandomWalk()); } Sorry if I said something wrong, but the best will be to tell everything what I have now. I've got an NPC(civil1.utc) with 4 waypoints(wp_civil1_01,wp_civil1_02,wp_civil1_03,wp_civil1_04). When I go in-game he just stands and he doesn't do anything, but when I talk to him, he begins following the waypoints. So I guess I need an Onspawn script. Link to comment Share on other sites More sharing options...
glovemaster Posted June 20, 2009 Share Posted June 20, 2009 Ah then you can try this script for onSpawn: /* Walk waypoints on spawn - onSpawn script, of course =] */ #include "k_inc_generic" #include "k_inc_debug" #include "k_inc_treas_k2" void main() { // SW_FLAG_WAYPOINT_WALK_PATH - Walks waypoints in order and then walks them in reverse. 1 - 2 - 3 - 2 - 1... // SW_FLAG_WAYPOINT_WALK_RANDOM - Self explanatory // SW_FLAG_WAYPOINT_START_AT_NEAREST - Object will follow waypoints starting with NEAREST waypoint. GN_SetSpawnInCondition(SW_FLAG_WAYPOINT_WALK_CIRCULAR); // Walks waypoints in a circle 1 - 2 - 3 - 1 -2 - 3... GN_SetDayNightPresence(AMBIENT_PRESENCE_ALWAYS_PRESENT); GN_SetListeningPatterns(); SetLocalNumber(OBJECT_SELF, 11, 6); PlaceCritterTreasure(OBJECT_SELF, Random(4)-2); GN_WalkWayPoints(); } The bit with commented SW_FLAG_WAYPOINT_* 's are different settings you can use with an explanation by them. You just need to replace the line GN_SetSpawnInCondition(SW_FLAG_WAYPOINT_WALK_CIRCULAR); with GN_SetSpawnInCondition(SW_FLAG_WAYPOINT_WALK_HOWEVER_YOU_WANT); Hope that helps -Glove Link to comment Share on other sites More sharing options...
Demongo Posted June 20, 2009 Author Share Posted June 20, 2009 Ah thank you so much!(I had to modify the script a little but it works) Now he starts walking when I enter the module:) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.