Jump to content

Scripting NPCs to fight each other


Recommended Posts

Posted

I'm recreating the Yavin academy level from Jedi Outcast for my SP mod, and I want to have some NPCs fighting each other in the saber training area. I placed my two NPCs (which have the NPC_targetnames jedi1 and trainer1) and gave them the spawnscripts:

 

 

 

//Generated by BehavEd


affect ( "trainer1", /*@AFFECT_TYPE*/ FLUSH )
{
	set ( /*@SET_TYPES*/ "SET_BEHAVIOR_STATE", /*@BSTATE_STRINGS*/ "BS_DEFAULT" );
	set ( /*@SET_TYPES*/ "SET_INVINCIBLE", /*@BOOL_TYPES*/ "true" );
	set ( /*@SET_TYPES*/ "SET_ENEMY", "jedi1" );
	set ( /*@SET_TYPES*/ "SET_LOCKED_ENEMY", /*@BOOL_TYPES*/ "true" );
	set ( /*@SET_TYPES*/ "SET_CHASE_ENEMIES", /*@BOOL_TYPES*/ "true" );
	set ( /*@SET_TYPES*/ "SET_NO_FORCE", /*@BOOL_TYPES*/ "true" );
	set ( /*@SET_TYPES*/ "SET_LOOK_FOR_ENEMIES", /*@BOOL_TYPES*/ "true" );
	set ( /*@SET_TYPES*/ "SET_LEADER", "NULL" );
} 

 

 

 

 

 

//Generated by BehavEd


affect ( "jedi1", /*@AFFECT_TYPE*/ FLUSH )
{
	set ( /*@SET_TYPES*/ "SET_BEHAVIOR_STATE", /*@BSTATE_STRINGS*/ "BS_DEFAULT" );
	set ( /*@SET_TYPES*/ "SET_INVINCIBLE", /*@BOOL_TYPES*/ "true" );
	set ( /*@SET_TYPES*/ "SET_ENEMY", "trainer1" );
	set ( /*@SET_TYPES*/ "SET_LOCKED_ENEMY", /*@BOOL_TYPES*/ "true" );
	set ( /*@SET_TYPES*/ "SET_NO_FORCE", /*@BOOL_TYPES*/ "true" );
	set ( /*@SET_TYPES*/ "SET_CHASE_ENEMIES", /*@BOOL_TYPES*/ "true" );
	set ( /*@SET_TYPES*/ "SET_LOOK_FOR_ENEMIES", /*@BOOL_TYPES*/ "true" );
	set ( /*@SET_TYPES*/ "SET_LEADER", "NULL" );
}

 

 

 

 

Jedi1 does what I want. He/she continuously attacks trainer1. But trainer1 just stands there doing nothing. I'm trying to do something similar in another room with a jedi deflecting blasts from a seeker drone which continuously floats around and fires at him, but the same thing happens with those two NPCs. The seeker drone attacks the jedi and the jedi stands there doing nothing. What am I doing wrong?

Smoo likes this
Posted

One of the two opponent shoul be of an Enemy team during the fight.

you can change with the SET_PLAYER_TEAM SET_ENEMY_TEAM commands.

i think SET_LEADER is unuseful in this case. can confuse NPCs. this can be used only when they are in BS_FOLLOW_LEADER state

build in the map an invisible walls arounds the fight places with the block NPC shader, for avoid other npc can see \ attack the "enemy" npc and for avoid of these NPCs to go around for all the room. 

therfiles and DarthStevenus like this
Posted

Yeah, I put the block NPC shader up, built a little fence around the duel area because they were going all over the place. And I added SET_LEADER because the unresponsive jedi kept following me around. It seemed to fix the problem, but I'll remove it when I add the set team commands.

Posted

Yeah, I put the block NPC shader up, built a little fence around the duel area because they were going all over the place. And I added SET_LEADER because the unresponsive jedi kept following me around. It seemed to fix the problem, but I'll remove it when I add the set team commands.

mmm neverminded the problem that friend npcs ever follow player...

in that case, i reject: set_leader null is a good escamoutage for avoid it when you need some passive allied NPC that can fight (so not CINEMATIC mode) but that you not want he follow the player. basically SET_LEADER is fine for enemy team because tell NPC who is the boss that lead a fight team. npcs with a leader follow him and protect him into the fight. :) is good, for example, for a wave of stormtrooper with an imperial commander. the commander should be targetted as leader of stormies.

in that specific case however, the team change should be sufficient for making a good fight. ^_^

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...