Jump to content

Home

More scripting stuff


JavaGuy

Recommended Posts

Here's the script:

*******************************************

rem ( "Script to make stormtroopers chase Kyle" );

rem ( "parm1: NPC_targetname of stormtrooper" );

rem ( "parm2: Navgoal to which to run" );

declare ( STRING, "nav1" );

set ( "nav1", get( STRING, "SET_PARM2") );

 

affect ( get( STRING, "SET_PARM1"), FLUSH )

{

set ( "SET_IGNOREENEMIES", "true" );

set ( "SET_BEHAVIOR_STATE", "BS_CINEMATIC" );

 

task ( "gonav1" )

{

set ( "SET_NAVGOAL", get( STRING, "nav1") );

}

 

dowait ( "gonav1" );

set ( "SET_ENEMY", "kyle" );

set ( "SET_IGNOREENEMIES", "false" );

set ( "SET_AGRESSION", 5 );

set ( "SET_BEHAVIOR_STATE", "BS_DEFAULT" );

}

*******************************************

 

I set parm1 to "stormtrooper1", which is the shared npc_targetname of a bunch of stormtroopers. I set parm2 to "rock1", which is the targetname of a nav point near some rocks. The nav point has a radius of 50, and it's declared as a waypoint_navgoal, so I know it's legal to set a radius for it. So far so good. Now when the script runs, what I want to happen is that the stormtroopers run over to the rocks _first_ and then attack (hence the ignore enemies, which seems to be necessary even when they're in cinematic behavior state).

 

What really happens is that _one_ of the stormtroopers does exactly what I want/expect the script to make him do, while the others just stand their ground and start shooting at me.

 

Any advice?

Link to comment
Share on other sites

well, since one of them does what the script says and the others dont, maybe it doesnt like multiple npc_target names; or maybe, the script for some reason only runs once

 

the only thing i can see that might work, is maybe try having each stormtrooper entity call the script; but that probably isnt the optimal way to do it...

Link to comment
Share on other sites

That seems to be it, since I changed one of the stormtroopers to be called stormtrooper2, then copied my scriptrunner and changed the new one's parm1 to stormtrooper2, and now I see two troopers doing what I wanted and the rest standing around.

 

That's actually kind of cumbersome, but hey, getting things exactly the way one wants them in life usually requires some work. :)

Link to comment
Share on other sites

hmm.

Select a boss out of your storm troopers. Probably the nearest one to the trigger.

Give him a NPC_targetname "st_boss" for example.

Give the others a NPC_targetname "st_marines" for example.

Make a script that sets the marines leader as "st_boss" and give marines the behavior state of Follow Leader. Set this script as the spawnscript of each stormtrooper except the boss.

 

The trigger entity should trigger a target_scriptrunner.

The script ,which target_scriptrunner uses, should set the leader's (st_boss) nav goal to any navgoal 4 in the map. Navgoal uses targetname, not script_targetname. You would set the leader's running value to true before setting navgoal. You can also set "st_marines" to run with this script.

 

The script should use two affect commands, one for st_boss and one for st_marines.

 

Now. I didnt try to stop them firing while they are on the move, but this method makes the other stormtroopers to follow their leader and the leader goes his navgoal with the others following him. You can modify the second script to make them just run insted of running and shooting at the same time.

 

I hope you got the idea.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...