Legacy:Mod Ideas/RagDollPhysics - Unreal Wiki

# Legacy:Mod Ideas/RagDollPhysics

### From Unreal Wiki, The Unreal Engine Documentation Site

< Legacy:Mod Ideas
Mod ideas for UT 2004 – Changing Ragdoll Physics parameters

## Description

This small mod allows the user to enter the configuration menu upon adding the mutator to the game, and changing various parameters to change the behavior on ragdolls in the game. Any ideas for enhancements or bug fixes are appreciated.

### Code

Here is the code for MutRagDollPhysics.uc.

    /******************************************************************************************
         MutRagDollPhysics
         This mutator allows player to configure ragdoll properties.
    ******************************************************************************************/
    class MutRagDollPhysics extends Mutator
          config;

    //variable declarations
    var globalconfig int nRagInvInertia;
    var globalconfig int nRagSpinScale;
    var globalconfig int nRagDeathUpKick;

    //Gui properties
    const PROPNUM = 3;
    //Macros
    const RAG_INV_INERTIA       = 0;
    const RAG_SPIN_SCALE        = 1;
    const RAG_DEATH_UP_KICK     = 2;

    //widgets declaration
    var localized string MutPropsDisplayText[PROPNUM];
    var localized string MutDescText[PROPNUM];

    function ModifyPlayer(Pawn Other)
    {
         local xPawn x;
         x = xPawn(Other);
         if(x != None)
         {
              x.RagInvInertia     = nRagInvInertia;
              x.RagSpinScale      = nRagSpinScale;
              x.RagDeathUpKick    = nRagDeathUpKick;
         }
         Super.ModifyPlayer(Other);
    }

    /*
    The function used to obtain the "hint" text that is displayed at the bottom
    of the config window.
    */
    static event string GetDescriptionText(string PropName)
    {
         switch (PropName)
         {
              case "nRagInvInertia"     :  return default.MutDescText[RAG_INV_INERTIA];
              case "nRagSpinScale"      :  return default.MutDescText[RAG_SPIN_SCALE];
              case "nRagDeathUpKick"    :  return default.MutDescText[RAG_DEATH_UP_KICK];
         }
         return Super.GetDescriptionText(PropName);
    }

    /*
    This function is called to actually add the configuration options for the
    mutator to the configuration window.
    */
    static function FillPlayInfo(PlayInfo PlayInfo)
    {
         Super.FillPlayInfo(PlayInfo);  // Always begin with calling parent
         //RagInvInertia property
         PlayInfo.AddSetting(default.GameGroup, "nRagInvInertia", default.MutPropsDisplayText[RAG_INV_INERTIA], 0, 0, "Text", "8;0:500");
         //RagSpinScale
         PlayInfo.AddSetting(default.GameGroup, "nRagSpinScale", default.MutPropsDisplayText[RAG_SPIN_SCALE], 0, 0, "Text", "8;0:100");
         //RagDeathUpKick
         PlayInfo.AddSetting(default.GameGroup, "nRagDeathUpKick", default.MutPropsDisplayText[RAG_DEATH_UP_KICK], 0, 0, "Text", "8;150:800");
    }

    defaultproperties
    {
         //Defaults
         nRagInvInertia = 4
         nRagSpinScale = 2.5
         nRagDeathUpKick = 150

         MutPropsDisplayText[RAG_INV_INERTIA] = "Ragdoll Inertia"
         MutDescText[RAG_INV_INERTIA] = "This will change the inertia of which the ragdoll will achieve."
         //for some reason, the predefined values up top do not work in default properties when greater than 0.
         MutPropsDisplayText[1] = "Ragdoll Spin Scale"
         MutDescText[1] = "This will determine the rate of spin on the ragdoll."

         MutPropsDisplayText[2] = "Ragdoll Upwards Kick"
         MutDescText[2] = "This will determine upwards motion on death."

         ConfigMenuClassName = ""
         GroupName = "Ragdoll"
         FriendlyName = "Ragdoll"
         description = "Allows you to change specific properties on ragdoll effects."
    }

## Enhancements/Bugs

Mad: Possibly add code to turn off gibbing of players.

## Discussion

Mad: I thought it was funny to see any non-gibbed ragdolls fly all over the place upon death, so I thought I would share it with you guys.

##### Views

- Legacy
- Discussion
- Current revision

##### Search