Jump to content

Player defeats 2 NPCs to change map


Go to solution Solved by Circa,

Recommended Posts

Posted

Hi.

I've been working on some basic scripts and can't seem to figure out how to make this work. I'm sure it's not that complicated. The thing is, Player faces two opponents (Pic and Gorc), after defeating both of them, the player changes the map. I have something like this written based on some JA scripts, but doesn't seem to work:

Part in the BSP:

{
"classname" "NPC_spawner"
"NPC_targetname" "gorc"
"deathscript" "11gorc/gorcdead"
"NPC_type" "gorc"
"angle" "0"
"origin" "0 -800 4"
}
{
"classname" "NPC_spawner"
"NPC_targetname" "pic"
"deathscript" "11gorc/picdead"
"NPC_type" "pic"
"angle" "0"
"origin" "70 -800 4"
}
{
"classname" "target_level_change"
"mapname" "voj_tower"
"targetname" "map_change"
"origin" "-100 -408 4"
}

And the scripts - Gorcdead.ibi:

rem ( "Gorc is dead. Flush yourself." );
set ( "brosdead", "+1" );

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

	if ( $get( FLOAT, "brosdead")$, $ =$, $2$ )
	{
		affect ( "player", /*@AFFECT_TYPE*/ FLUSH )
		{
			sound ( /*@CHANNELS*/ CHAN_VOICE, "sound/chars/kyle/misc/gloat1.mp3" );
		}
		run ( "11gorc/gorcpicdead" );
	}

}

picdead.ibi:

//Generated by BehavEd

rem ( "Pic is dead. Flush yourself." );
set ( "brosdead", "+1" );

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

	if ( $get( FLOAT, "brosdead")$, $ =$, $2$ )
	{
		affect ( "player", /*@AFFECT_TYPE*/ FLUSH )
		{
			sound ( /*@CHANNELS*/ CHAN_VOICE, "sound/chars/kyle/misc/ffturn.mp3" );
		}
		run ( "11gorc/gorcpicdead" );
	}

}

and the script that should be called if both NPCs are dead - gorcpicdead.ibi:

rem ( "Play video, then level change" );
set ( /*@SET_TYPES*/ "SET_OBJECTIVE_SUCCEEDED", /*@OBJECTIVES*/ "HOTH3_OBJ3" );
sound ( /*@CHANNELS*/ CHAN_LOCAL, "sound/interface/update.mp3" );
wait ( 2000.000 );
sound ( /*@CHANNELS*/ CHAN_LOCAL, "sound/interface/update.mp3" );
wait ( 2000.000 );
sound ( /*@CHANNELS*/ CHAN_LOCAL, "sound/interface/update.mp3" );
wait ( 2000.000 );
sound ( /*@CHANNELS*/ CHAN_LOCAL, "sound/interface/update.mp3" );
wait ( 1.000 );
set ( /*@SET_TYPES*/ "SET_VIDEO_PLAY", "DF2_13tower" );
wait ( 1.000 );
rem ( "change the level" );
use ( "map_change" );

 

Posted

Easiest solution would be to place a target_count in the map linked with the target_level_change (or another target_scriptrunner with the end level script), a count of 2, and set a deathscript on both brothers that uses the counter. As soon as the Brothers of the Sith are both killed, the end script will be run or the level will be changed, based on what it's linked to.

mjt and NAB622 like this
Posted

No need for a deathscript, NPCs should use their npc_target upon death, so you can directly connect them to the target_count without any scripting.

mjt likes this
  • Solution
Posted

I used this tutorial for my Christmas map, although it was for MP, it should work for SP too I assume. Wonko is right, NPC_Target activates on death so no need for an additional script.

http://map-forge.net/wiki/doku.php?id=tutorials:npcwaves_data:npcwaves

Of course this isn't multiple waves in your case, but it shows you how to use the counter function so a script runs when all NPCs are dead that are linked to the counter, even if its just 2.

Posted

Thanks everyone for the help! 😄 I've tried Circa's tutorial and it works that way.

I've put together a rather basic demo version of the Dark forces 2 game, though I'm not sure, if I'm allowed to share it. I've used the resources from various mods and it was meant for personal use. And the game has a beginning of Nar S. and an end at the Valley, around 7 levels.

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