Post news RSS Script Everything!

w00t! Lua on everything in B23!! this means B23 release i coming!

Posted by on

Contrary to what some have feared, we have been working (albeit slowly) on Cortex Command during and after the GDC madness. The biggest new feature for Build 23 is the ability to attach Lua scripts to not only the Missions, but any MovableObject in the game!In the ini definition of any Preset in the game, an optional line can be added to make any object of that Preset load and use a script file:

AddAmmo = AEmitter
PresetName = Destroyer Cannon Shot
ScriptPath = Dummy.rte/Devices/Weapons/Launchers/Destroyer.lua
The test script file Destroyer.lua looks like this - try to figure out what it does to the projectile:

function Create(self)
print("CREATED: " .. self.PresetName);
self.testTimer = Timer();
end

function Destroy(self)
print("DESTROYED: " .. self.PresetName);
end

function Update(self)
if self.testTimer:IsPastSimMS(1500) then
self.Vel = self.Vel + Vector(0, 1);
end
end

That simple! You can attach any data or timers or whatever you wish to the object, and since almost the entire C++ engine is exposed to the Lua state, modders will have a LOT of power to play with! You will be able to come up with completely new, custom logic for how anything and everything should behave. Want homing bullets? Custom AI behavior? Crazy special effects? No problem!Next up is to get get the documentation for all the Lua bindings in the engine made. It’s all about scraping the C++ source for the thorough documentation and spitting it out to legible files, but we’re not far off.

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.