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

Members Online

»
0 Active | 10 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

Tutorials

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

In this tutorial, I will show you how to make dead bodies in your singleplayer map.

Prerequisites:

  1. Basic understanding of radiant
  2. You know how to make a basic .gsc file and a _anim.gsc file
  3. Basic understanding of how to work with the zone files list

Having dead bodies in your map is not as easy as just putting in a model, but at least there are multiple ways of doing it. There are a few models of dead Americans, but no other.

Some of the stock singleplayer maps use different characters than Americans, and this is how you do it.

Before we begin, you should just know a few things about each method of adding dead bodies, as they have a few differences.


Method 1:
    1. No collision
    2. Should work with all human animations
    3. Simpler setup in Radiant
    4. Needs more files added to the zone files list than method 2


Method 2:
    1. Collision
    2. Should work with all human animations
    3. Needs more scripting than method 1

To both methods you need to include:

#include maps_utility;
#include common_scriptsutility;
#include maps_anim;


At the top of both your yourMapName.gsc and yourMapName_anim.gsc

 



Method 1

This method takes a script_model and applies an animation on it. This method is used in the "aftermath" and "launchfacility_b" maps.

The method adds dead bodies with this line:

level.scr_deadbody[ indexNumber ] = charactercharacterScript::main;

  • The indexNumber is just the number of the character you wish to use.
  • The characterScript is the name of the character you want in the "Call of Duty4/raw/character folder".

Here is an example:

level.scr_deadbody[ 1 ] = charactercharacter_dead_russian_loyalist_a::main;

 

This line goes into your yourMapName_anim.gsc if you have one, but it can also be placed in your main yourMapName.gsc after maps_load::main();

In your main yourMapName.gsc you also need to include this line:

maps_deadbody::main();

It has to be placed after maps_load::main();, and if you have placed the dead body script in your main .gsc, it has to be placed before that.

Another thing to note, is that all the animations are inside the _deadbody.gsc file. They follow the structure as any animation:

    level.scr_anim[ "dead_guy" ][ "death1" ]                = %exposed_death_nerve;
    level.scr_anim[ "dead_guy" ][ "death2" ]                = %exposed_death_falltoknees;
    level.scr_anim[ "dead_guy" ][ "death3" ]                = %exposed_death_headtwist;
    level.scr_anim[ "dead_guy" ][ "death4" ]                = %exposed_crouch_death_twist;
    level.scr_anim[ "dead_guy" ][ "death5" ]                = %exposed_crouch_death_fetal;
    level.scr_anim[ "dead_guy" ][ "death6" ]                = %death_sitting_pose_v1;
    level.scr_anim[ "dead_guy" ][ "death7" ]                = %death_sitting_pose_v2;
    level.scr_anim[ "dead_guy" ][ "death8" ]                = %death_pose_on_desk;
    level.scr_anim[ "dead_guy" ][ "death9" ]                = %death_pose_on_window;


  • dead_guy is the targetname we give a script_origin.
  • The death1-9 are the animation names, which we use in radiant to define what animation should be played.
  • The rest is just the source animation name.

The scripting part is over and we will move over to radiant, as it needs some information as well.

In radiant, you need to make a script_origin where you want your dead body. This script_origin needs these key/values in the entity editor:

       //Used to tie with the index we gave earlier, when defining the character

  • Key: script_index
  • Value: indexNumber

      //The animation name, which in this case is death1-9

  • Key: script_noteworthy
  • Value: animationName

      //Needed as it will otherwise become a ragdoll

  • Key: script_start
  • Value: 1

      //Animation object name, should not be anything else

  • Key: targetname
  • Value: dead_body


So in the end we have a script that could look like this:

#include common_scriptsutility;
#include maps_utility;
#include maps_anim;

main()
{
    mapsyourMapName_anim::main();
    maps_load::main();
    maps_deadbody::main();
}

And a yourMapName_anim.gsc script that could look like this:

#include maps_utility;
#include common_scriptsutility;
#include maps_anim;

main()
{
    anims();
}

#using_animtree("generic_human");
anims()
{      
    level.scr_deadbody[ 1 ] = charactercharacter_dead_russian_loyalist_a::main;
    level.scr_deadbody[ 2 ] = charactercharacter_sp_arab_regular_asad::main;
    level.scr_deadbody[ 3 ] = charactercharacter_sp_usmc_ghillie_price::main;
 
}

And this in radiant:

Method 1 entity editor

Remember that you will have to update your zone files with the missing files. You need to have "developer 1"  to pick up the files.


Extending method 1

1. Trigger dead bodies

If you want the bodies to appear at a certain time, make a trigger_once and give it a key/value of:

  • Key: targetname
  • Value: trigger_body

Target it at the script_origins from earlier by first selecting the trigger, and then the script_origin and press "w". Just make sure the target of the trigger_once and targetname of the script_origin is not "dead_body", as that will make them spawn immidiately. Also, some models may error out, saying you need to precache them. If that happens write this after maps_load::main();

precachemodel("name of missing model");

You can see the missing model in the error message, and the name will most likely also be found in the zone file.


2. Other animations

The standard death animations only consist of 9 animations in the _deadbody.gsc. If you want to add other animations, you need to include this in your yourMapName_anim.gsc:

level.scr_anim[ "dead_guy" ][ "death10" ]                = %cargoship_sleeping_guy_idle_1;
level.scr_animtree[ "dead_guy" ]                             = #animtree; 

Just increment the "death" count, and use it in radiant by typing in that name. The animtree needs to be in the scripting.

 



Method 2

This method makes an actor into a drone, and then gives the drone an animation. This method is used in the "airplane" map.

With this method, you have to include this line of code in yourMapName.gsc after maps_load::main();

array_thread( getentarray( "dead_body", "script_noteworthy"), ::AI_dead_body_think );

This runs the thread AI_dead_body_think on the actors that have dead_body as their script_noteworthy.

After the main() thread, include this thread:

AI_dead_body_think()
{
    eNode = getent( self.target, "targetname" );
    assertex( isdefined(eNode), "eNode not defined" );
    sAnim = eNode.script_noteworthy;
    assertex( isdefined( level.scr_anim[ "generic" ][ sAnim ], "There is no animation defined named: " + sAnim ) );

    guy = maps_vehicle_aianim::convert_guy_to_drone( self );
    guy.allowdeath = false;
    guy.NoFriendlyfire = true;
    maps_vehicle_aianim::detach_models_with_substr( guy, "weapon_" );
    guy.ignoreme = true;
    if ( !isdefined( guy.magic_bullet_shield ) )
        guy thread magic_bullet_shield();
    eNode thread anim_generic_loop( guy, sAnim, undefined, "stop_idle" );
}

This is the thread we call on all the dead_body entities.

Next in yourMapName_anim.gsc, include the animations you want to have. Here are some examples:

level.scr_anim[ "generic" ][ "death_pose_sit_1" ][0]            = %death_sitting_pose_v1;
level.scr_anim[ "generic" ][ "death_pose_sit_2" ][0]            = %death_sitting_pose_v2;
level.scr_anim[ "generic" ][ "death_pose_chair_1" ][0]            = %airlift_copilot_dead;
level.scr_anim[ "generic" ][ "death_pose_floor_1" ][0]            = %cargoship_sleeping_guy_idle_1;
level.scr_anim[ "generic" ][ "death_pose_floor_2" ][0]            = %cargoship_sleeping_guy_idle_2;
level.scr_anim[ "generic" ][ "death_pose_desk" ][0]                = %death_pose_on_desk;
level.scr_anim[ "generic" ][ "death_pose_window" ][0]            = %death_pose_on_window;


Remember to include #using_animtree("generic_human"); before the animations.

That's all for scripting.


In radiant, create an actor which you want to be the dead body. Give this actor the key/value in the entity editor:

  • Key: script_noteworthy
  • Value: dead_body

Also, create a script_origin with the key/value:

  • Key: script_noteworthy
  • Value: animationName

The animationName could be "death_pose_sit_1" as seen on the animations.

Next, select the actor and then the script_origin and press "w", so the script_origin becomes the target of the actor.

We end up having this script:

#include common_scriptsutility;
#include maps_utility;
#include maps_anim;

main()
{
    mapsyourMapName_anim::main();
    maps_load::main();
    
    array_thread( getentarray( "dead_body", "script_noteworthy"), ::AI_dead_body_think );
}

AI_dead_body_think()
{
    eNode = getent( self.target, "targetname" );
    assertex( isdefined(eNode), "eNode not defined" );
    sAnim = eNode.script_noteworthy;
    assertex( isdefined( level.scr_anim[ "generic" ][ sAnim ], "There is no animation defined named: " + sAnim ) );

    guy = maps_vehicle_aianim::convert_guy_to_drone( self );
    guy.allowdeath = false;
    guy.NoFriendlyfire = true;
    maps_vehicle_aianim::detach_models_with_substr( guy, "weapon_" );
    guy.ignoreme = true;
    if ( !isdefined( guy.magic_bullet_shield ) )
        guy thread magic_bullet_shield();
    eNode thread anim_generic_loop( guy, sAnim, undefined, "stop_idle" );
}

And the yourMapName_anim.gsc:

#include maps_utility;
#include common_scriptsutility;
#include maps_anim;

main()
{
    anims();
}

#using_animtree("generic_human");
anims()
{    
    level.scr_anim[ "generic" ][ "death_pose_sit_1" ][0]            = %death_sitting_pose_v1;
    level.scr_anim[ "generic" ][ "death_pose_sit_2" ][0]            = %death_sitting_pose_v2;
    level.scr_anim[ "generic" ][ "death_pose_chair_1" ][0]            = %airlift_copilot_dead;
    level.scr_anim[ "generic" ][ "death_pose_floor_1" ][0]            = %cargoship_sleeping_guy_idle_1;
    level.scr_anim[ "generic" ][ "death_pose_floor_2" ][0]            = %cargoship_sleeping_guy_idle_2;
    level.scr_anim[ "generic" ][ "death_pose_desk" ][0]                = %death_pose_on_desk;
    level.scr_anim[ "generic" ][ "death_pose_window" ][0]            = %death_pose_on_window;
}


And this in radiant:

Method 2 entity editor

Remember that you will have to update your zone files with the missing files. You need to have "developer 1"  to pick up the files.

 

This is what it looks like in the 3d view of radiant and in-game:

Methods

Method results

 

This should give you dead bodies in your map. Happy SP mapping!

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

»