Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 87 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

Tutorials

»
CoD4 Mapping
ratings:
Awful Rating
Poor Rating
Average Rating
Good Rating
Excellent Rating
sneak knifing sequence
Versions: You must be logged in to view history.

Shows you how to setup a sequence with a lone enemy hanging out then your teammate stabs him in the neck.

 

Okay so a lot of people have been asking me how I did this so here goes...
This script is actually used in the level icbm so I can't take credit for it.

This tutorial assumes you know how to do basic mapping and scripting. 

Part 1: Setting up your map

a. First we will need two spawners: one enemy and one ally

--- put a key/value pair on the ally spawner "targetname" : "knifer"

--- put a key/value pair on the enemy spawner "targetname" : "knife_me"

b. Next, we will need a node_scripted

--- put it where you want the enemy to hang out, and make it face in the right direction.

--- also make sure there is enough space behind it so your ally can sneak up on the enemy.

--- give it a key/value of "targetname" : "knife_node"

It should look like this

 

Part 2: Script setup

a. Add these lines to the top of your .gsc file

#include common_scripts\utility;
#include maps\_utility;
#include maps\_anim;
#include maps\_stealth_logic;

b. Put these lines of code in your .gsc file:

#using_animtree("generic_human");
knife_setup()
{
 flag_init( "knife_sequence_starting" );
 flag_init( "knife_sequence_done" );

 precacheModel( "weapon_parabolic_knife" );

 level.player thread stealth_ai();

 createthreatbiasgroup( "friendly" );
 createthreatbiasgroup( "victims" );
 setignoremegroup( "friendly", "victims" );

 knifer_spawner = getent( "knifer", "targetname" );
 knifer_spawner add_spawn_function( ::stealth_ai );
 knifer_spawner add_spawn_function( ::set_ThreatBias_Group, "friendly" );
 level.knifer = knifer_spawner stalingradSpawn(); 

 level.knifeKillNode = getnode( "knife_node", "targetname" ); 
 knifee_spawner = getent( "knife_me", "targetname" ); 
 knifee_spawner add_spawn_function( ::AI_hostile_think );
 knifee_spawner add_spawn_function( ::stealth_ai );
 knifee_spawner add_spawn_function( ::set_ThreatBias_Group, "victims" );
 level.badguy = knifee_spawner stalingradSpawn();

 level._effect["knife_stab"] = loadfx ("misc/parabolic_knife_stab");
 level.scr_anim[ "knifer" ][ "knifekill" ]    = %ICBM_patrol_knifekill_winner;
 level.scr_anim["hostile"][ "phoneguy_idle_start" ]   = %patrol_bored_idle_cellphone;
 level.scr_anim["hostile"][ "phoneguy_idle" ][0]    = %patrol_bored_idle_cellphone;
 level.scr_anim["hostile"][ "phoneguy_alerted" ]    = %parabolic_phoneguy_reaction;
 level.scr_anim["hostile"][ "phoneguy_death" ]    = %ICBM_patrol_knifekill_looser;
}

begin_knife()
{
 level.badguy thread AI_hostile_knife_kill_think();
 level.badguy waittill( "death" );
 flag_set( "knife_sequence_done" );
}

AI_hostile_think()
{
 self endon( "death" );
 
 self.animname = "hostile";
 self.allowdeath = true;
 self.ignoreme = true;
 self.health = 1;
 self thread stealth_enemy_endon_alert();
 
 level.knifeKillNode  anim_reach_solo( self, "phoneguy_idle_start" );
 level.knifeKillNode thread anim_loop_solo( self, "phoneguy_idle", undefined, "stop_idle" );
 
 
 self waittill( "stealth_enemy_endon_alert" );
 
 self setthreatbiasgroup();
 self.ignoreme = false;
 level.knifer.ignoreAll = false;
 level.knifeKillNode  notify( "stop_idle" );
}

AI_hostile_knife_kill_think()
{
 self endon( "death" );
 self endon( "stealth_enemy_endon_alert" );

 level.knifer setgoalpos( self.origin );
 flag_set( "knife_sequence_starting" );
 
 level.knifeKillNode anim_reach_solo( level.knifer, "knifekill" );
 
 self thread knife_kill_fx();
 self thread AI_hostile_knife_kill_abort_think();
 level.knifer attach( "weapon_parabolic_knife", "TAG_INHAND" );
 level.knifer playsound ( "scn_icbm_knife_melee" );
 
 level.knifeKillNode thread anim_single_solo( level.knifer, "knifekill" );
 level.knifeKillNode thread anim_single_solo( self, "phoneguy_death" );
 
 time =  getanimlength( self getanim( "phoneguy_death" ) );
 time -= 2.75;
 self delaythread( time, ::AI_hostile_knife_kill_finish_anim );
 self delaythread ( time, ::set_ignore_all );
 
 level.knifeKillNode waittill( "phoneguy_death" );
 
 level notify( "knife_kill_done" );
 level.knifer.ignoreAll = false;
 level.knifer setgoalpos( level.knifer.origin );
 level.knifer stopanimscripted();
 
 self.a.nodeath = true;
 self.allowdeath = true;

 self dodamage( self.health + 50, ( 0, 0, 0 ) );
}

AI_hostile_knife_kill_finish_anim()
{
 self endon( "stealth_enemy_endon_alert" );
 
 self notify( "_stealth_stop_stealth_logic" );
 self.allowdeath = false;
 self.a.nodeath = true;
}
set_ignore_all()
{
 self.ignoreall = true;
}

set_threatbias_group( group )
{
 assert( threatbiasgroupexists( group ) );
 self setthreatbiasgroup( group );
}

AI_hostile_knife_kill_abort_think()
{
 flag_wait( "knife_sequence_starting" );
 
 self waittill_either( "death", "stealth_enemy_endon_alert" );
 level.knifer detach( "weapon_parabolic_knife", "TAG_INHAND" );
 level.knifer stopanimscripted();
}

knife_kill_fx()
{
 self endon( "death" );
 
 self waittillmatch( "single anim", "knife hit" );
 playfxontag( level._effect[ "knife_stab" ], self, "j_neck" );
}

 

c. Add these lines to your main() function:

main()
{
,,,
 maps_stealth_logic::stealth_init();
 maps_stealth_behavior::main();
 knife_setup();
,,,
}

 

Part 3: Zone file setup

Put these lines in your zone file:

xanim,icbm_patrol_knifekill_looser
xanim,icbm_patrol_knifekill_winner
xanim,parabolic_phoneguy_reaction
xanim,patrol_bored_idle_cellphone
fx,misc/parabolic_knife_stab
xmodel,weapon_parabolic_knife

 

Part 4: Soundalias setup

Put this line in your soundalias csv (don't forget to change YOUR_MAPNAME_HERE):

scn_icbm_knife_melee,,level/scn_icbm_knife_melee1.wav,0.7,0.7,na,1,1,50,1800,effects1,streamed,,,,YOUR_MAPNAME_HERE,,,,,,,,0.2,,,,,

 

Part 6: Call the function!

Call begin_knife() when you want the knifing to happen!

 

I hope this helps! :) 

 

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»