Jump to content

Scripting an NPC to Wait & issues


Recommended Posts

I have a firefight where the player goes behind some crates to take cover. There is a trigger here which spawns two storm troopers to run from the room the player was just in. Its a long, L shaped hallway. I have the NPC's set up to wait for 3 and 4 seconds before entering the fight. My problem is that both will enter the room and fire, 1 will enter the room and fire, or both will stay in the room they spawned in and not move at all.

 

Here is the script I have written. I'm not sure if I have the WAIT in the right spot or should it be stuck under the first task. I'm using some basic tutorials I've found. BTW, I have the same script for the second npc just with different values. Could the angerscript be triggered when the NPC's hear the firing and its overriding their tasks?

 

 

 

script1.jpg

 

 

script2.jpg

Link to comment

I always have trouble getting npcs to move when they are not in BS_CINEMATIC. I would have them spawn in cinematic mode, move, and then return to BS_DEFAULT. And having a task for wait shouldn't be necessary. Make the anger script into a task and have it run when the moves have been made. Tell me if that works... :D

Link to comment

No, that didn't work all the way. My storm trooper will run to the point consistently but he'll just stand there staring at me. If i shoot him, then it seems the anger script kicks in and he does his alt-fire thing. He won't fire at me on his own.   

Link to comment

I think the anger script is definitely overriding all your other scripting, because of the FLUSH command. Just to clarify, adding another task with all the commands of the second script (the anger one) and then running that task after "go2" didn't work? I've had lots of trouble with NPCs and their stubbornness - they can be tricky!

Link to comment

Well, thanks for your help. It works consistently now with 2 troopers. Unfortunately, your recommendation of switching to a behavior state of Cinematic didn't really work out.  Not sure why. They just ran to the end and stared at me until I shot them, then they fired, even with this new script, below. I switched it back to BS_Default and unchecked the Cinematic tag for the NPC and it all worked. 

 

This stuff is beyond confusing. I can't even get Waypoints to work correctly which is odd. Every NPC in each of my two levels is scripted in some way. 

 

 

 

ambush2.jpg

Link to comment

You rarely need more than one waypoint_navgoal. Just have a proper waypoint net. And the only thing that needs to go into a dowait task is SET_NAVGOAL, since that's the only way to wait for him to finish. But since you don't want to wait for that anyway you don't need a task at all.

Link to comment

Well, I'm using the only tutorial I found online and this is what that guy did with the DOWAIT part. There are also DOWAITS used in the game scripts so I'm just following that. Also, no matter what I do, no NPC's of mine will follow a waypoint network. I've followed Rich Diesal's tutorial on it but my npc just likes to sit there. This is why I used the navgoals. It works fine.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...