Archive for May, 2011


Posted by Data in Cortex Command - May 12th, 2011

Grappling hook demo, courtesy of CaveCricket48 and LizardFor the next version, we have implemented a subtle yet very powerful feature that I hope the modding community will have a lot of fun with. Extra, custom Pie-Menu options can now be defined for any Actor or HeldDevice, so that a Lua script is run each time that option is activated by the player in-game.

The custom options will show up only when an Actor of a Preset with them defined is selected, or he’s holding a device that itself has extra options defined. The options’ icons can also be of custom size and design. As an example, can you figure out what this modded Actor’s extra Pie-Menu option will do??: (it’s not what you see to the right)

In MyMod.rte/Robots/Robots.ini:

AddActor = AHuman
  CopyOf = Robot 1
  PresetName = Suicidal Robot
  AddPieSlice = Slice
    Description = Detonate Limb
    Direction = 2
    Icon = Icon
      CopyOf = MyCoolIcon
    ScriptPath = MyMod.rte/Scripts/Dismember.lua
    FunctionName = Dismember

in MyMod.rte/Scripts/Dismember.lua:

function Dismember(actor)
  humanoid = ToAHuman(actor);
  if humanoid then
    if humanoid.EquippedItem then
      humanoid:ReloadFirearm();
    elseif humanoid.FGLeg then
      humanoid.FGLeg:GibThis();
    elseif humanoid.BGLeg then
      humanoid.BGLeg:GibThis();
    elseif humanoid.FGArm then
      humanoid.FGArm:GibThis();
    elseif humanoid.BGArm then
      humanoid.BGArm:GibThis();
    else
      humanoid.Head:GibThis();
    end
  end
end

This new modding feature effectively connects the entire Lua scripting interface and all its modding opportunities to the real-time gameplay presented to the player. Custom firing modes of weapons, explosive self-destruction of Actors, mission-specific commands.. you name it; pretty much anything is possible!