Hi Bozzy,
We used LUA in FarCry; each mission had a mission script that had a list of functions in it, e.g.:
function Mission:Event_ruins_entered()
Hud:AddMessage('Doyle: Well done you opened the entrance.',8);
Hud:AddMessage('Doyle:Now get in there and find my assistent.',8);
Hud:CompleteObjective(Localize("BreakIntoTheCata"))
Hud:CompleteObjective(Localize("PlaceTheExplosiv"))
Hud:SetRadarObjective("PDA");
end
which allowed us designers to set events and localized speech tokens without having to hit up a programmer.
Also, reloading changed scripts (rather than recompiling changed code) saves a lot of time when tweaking values - here's a segment from the Proximity Mine script:
function ProximityMine:OnReset()
local Min = { x=-self.Properties.Radius/2, y=-self.Properties.Radius/2, z=-self.Properties.Radius/2 };
local Max = { x=self.Properties.Radius/2, y=self.Properties.Radius/2, z=self.Properties.Radius/2 };
self:SetBBox( Min,Max );
self:DrawObject( 0,1 );
self.Enabled = self.Properties.bEnabled;
self.activation_sound=Sound:Load3DSound(self.Properties.fileActivationSound)
self.Who = nil;
self.Died = 0;
self:GotoState( "Waiting" );
end
function ProximityMine:Event_Enable( sender )
self.Enabled = 1;
BroadcastEvent( self,"Enable" );
end
function ProximityMine:Event_Disable( sender )
self.Enabled = 0;
BroadcastEvent( self,"Disable" );
end
function ProximityMine:Event_Explode( sender )
if (self.Enabled)then
self:Explode();
self:GotoState( "Dead" );
end
BroadcastEvent( self,"Trigger" );
end
All the scripts for FarCry are easily accessible in the FCData directory on the CD, none of them are compiled.