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!

You can follow any responses to this entry through the RSS 2.0 feed.
Both comments and pings are currently closed.


15 Responses to “Custom, scripted Pie-Menu options”

  1. Carp - # May 12th, 2011 at 1:11 am

    Can the default unit AI be changed? Replacing “deliver and return” with custom rocket/dropship behavior, for example?

  2. Data - # May 12th, 2011 at 1:48 am

    The hardcoded pie-menu options can’t be changed, but the AI behavior can, since the hardcoded c++ implementations are now able to be overridden with Lua AI update routines! We have made good progress on porting the hardcoded versions to Lua so they’ll be exposed for you to change as you wish in B25 😀

  3. FinDude - # May 12th, 2011 at 5:22 am

    I see attachables are very much there for Lua, too.

  4. war_man333 - # May 12th, 2011 at 5:29 am

    Keep it up with the Devlog updates, makes it seem 200% less like the game is dying! 😛

  5. Natti - # May 12th, 2011 at 8:25 am

    Oh my god.
    I simply cannot wait for B25.
    Keep up the good work, guys.

  6. ramonimbao - # May 12th, 2011 at 8:26 am

    YESSSS! SO MANY POSSIBILITIES OPEN! BWAHAHAHAHA!!!

    (yeah, caps, heh)

  7. Footkerchief - # May 12th, 2011 at 8:50 am

    That’s cool and all, but PLEASE let us map pie menu options to keyboard shortcuts as well.

  8. Captain Kicktar - # May 12th, 2011 at 10:07 am

    How,Footkerchief? Perhaps with a button you press when a certain function is highlighted and then you press another button to bind it.

  9. Data - # May 12th, 2011 at 1:38 pm

    the problem with binding arbitrary things to keyboard keys is that it breaks down when other controllers are used, like gamepads. We try to make the game fully playable on any supported device, because having the keyboard player able to do special things isn’t fair in, for example, a 4-player game with one kb player and others using gamepads!

  10. Striker121 - # May 12th, 2011 at 2:21 pm

    Holy crap an update!!!!!! Great to see it’s still being worked on. Maybe I should check out the community again…..

  11. zalo - # May 12th, 2011 at 8:31 pm

    Hooray! AI Routines!

  12. ZevN47 - # May 13th, 2011 at 9:35 am

    Excellent!

  13. Mooseral - # May 14th, 2011 at 7:36 pm

    Nice. Good to see progress!

    Also awesome to see further support of 4-player gamepad shenanigans. This is one of the very best kinds of shenanigans.

  14. AaronLee - # May 18th, 2011 at 6:52 pm

    Ooh! I think I’m going to have to do some updartz for the Emporeans now, finally get that mod up to finished quality or somesuch.

  15. ndisplay - # May 19th, 2011 at 6:32 pm

    Hmm, what about making several hotkeys for each players (which would be defined in options), and then bind any action from pie menu to these hotkeys? It could be done right in the middle of game. Something like skills in MMORPGs, you know.