Jump to content

Home

Probably been asked b4 but...how do i make NPC's walk around?


dvader28

Recommended Posts

You assume correctly, however until we have scripting tools there is no much control in this. There are several 'common', existing scripts which you can use for this.

 

Example:

 

1st step:

- create 2 waypoint_navgoal entities. Put them at some distance from each other.

- select first one, press N and enter following values in the text fields:

key: targetname

value: ng1

- Press Enter and close the entity window.

- Repeat this for the second navgoal, only give it ng2 targetname.

2nd step:

 

-create NPC_Strormtrooper, place him somewhere from where he can see the navgoals.

 

- select him and press N.

 

Enter following (press Enter each time you have entered key & value):

 

key: parm1

value: ng1

 

key: parm2

value: ng2

 

key: spawnscript

value: common/2_point_patrol

 

- close entity window.

 

That's it. Upon spawning this trooper will roam between your 2 navgoals forever.

 

NOTE: if you put him where he cannot see his navgoal, this won'r work, unless you create a network of waypoints, waipoints connected to each other.

Link to comment
Share on other sites

Originally posted by RichDiesal

Forgot to ask, if you use waypoints, so the waypoints need to be connected to the navgoal entities or just each other?

 

IIRC, just each other. Each waypoint can be connected/targeted at other 2 waypoints (target and target2 keys in the entity window). If you have a complex level (with lotsa rooms and corridors), you must create a really huge waypoint network, assuming you want NPC's to be able to chase you and navigate thru the level. As to how to place them, you must visualise the NPC standing at the waypoint position, then place next one so he can see it and so on.

 

ps: there is also common/4_point_patrol script. It works the same only you can 4 navgoals to patrol between.

 

EDIT:

 

made a lil pic to to explain better:

 

http://home.planet.nl/~xcom/art/waypoints.gif

Link to comment
Share on other sites

Originally posted by G5_Wrath

will it also stop them from jumpin around like monkeys on acid as they follow their waypoints while fighting you?

 

 

No, at least I don't think so. Waypoints are for navigation only. They won't affect any behaviour.

Link to comment
Share on other sites

It just occured to me that you might be referring to bots in MP. Their behavior you can't control. It's hard coded.

 

In SinglePlayer there is some limited control over this which is done by scripting. Unfortunately, w/o tools and script definitions there isn't much I can tell about how to do it.

Link to comment
Share on other sites

Originally posted by RichDiesal

Do you happen to know of any script where the NPCs just...walk? With 2_point_patrol they just run everywhere... :)

 

I would make my own script, but I can't get the scripter to work (using the one from EF).

 

AFAIK, they only run when they spot the enemy (YOU :D ) otherwise they just walk while patrolling. You can force them to walk only by setting set_walking to true and set_running to false (I think). Anyway, I dunno if there is an existing script which does that. Probably is but I am not going to decompille them all to find out. What you can do is write the script you want and I'll (try to) compile it for you.

Link to comment
Share on other sites

Assuming

 

a) you can compile scripts

b) you have waypoint_navgoal called ng1

c) you have NPC

 

you should this.

Give your NPC a NPC_targetname.

 

key: NPC_targetname

value: trooper1

 

(or whatever name you like)

 

Create a trigger and target it at target_scriptrunner. This target_scriptrunner should have:

 

key: usescript

value: -!path to the script!-

 

Basically, the value should point to the script which you wanna execute. The script looks like this:

 

//Generated by BehavEd

rem ( "Go to Navgoal" );

affect ( "trooper1", /*@AFFECT_TYPE*/ FLUSH )
{

task ( "go1" )
{
	set ( /*@SET_TYPES*/ "SET_BEHAVIOR_STATE", /*@BSTATE_STRINGS*/ "BS_WALK" );
	set ( /*@SET_TYPES*/ "SET_NAVGOAL", "ng1" );
}

dowait ( "go1" );
}

You will need to compile it to IBI. Right now it's only possible with Elite Force GDK toolset.

Link to comment
Share on other sites

The JK2 scripting tools are yet to be released. EF tools can be used too but some ppl having trouble getting them to work w/o EF. LOL. :p

 

For the link, go to General Editing forum and check "Radiant Resources" sticky thread. The link for EF GDK is there somewhere.

Link to comment
Share on other sites

Hmm... I think it's something to do with SourceSafe or the Source File Path...

 

As is, my Source File Path points to a directory that doesn't exist... what is that?

 

Also, I have no SourceSafe (can't use it in Radiant or in the Compiler)... is that something I'd need? (I don't know what it is. :D)

Link to comment
Share on other sites

Do you have a directory called SourceForBehavED? Source File Path should point to it. If you don't have it, then your installation is incomplete. SourceSafe is, AFAIK, unimportant. (but I am not sure)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...