Anyone still around to help with LUA scripting for scenes?
Forums seem pretty dead, hopefully someone is around to help out? TBH my knowledge of LUA is abysmal. If any experienced modders could help me out I would appreciate it very much.
EDIT: Re-wrote the activites from scratch, mission starts without errors. No funds, have to add them yourself at this point. Destroying enemy brain doesn't cause win, I believe i removed this section of code... Tried to make it work somehow, check out CPUbrainCheck funtion. Entering trigger areas doesn't cause dropships to spawn, probably something to do with spawn timer so at this point not sure if LZs or loadouts work properly. Doors commented out, not sure if properly implemented.
A few questions:
How to use lua to add doors to scene. I took a look at the Zombie Cave mission code and came up with this but I'm getting errors.
Code:
self.KeyDoor1 = CreateTerrainObject("Door Cliff");
self.KeyDoor1.Pos = Vector(2976, 900);
self.KeyDoor1.Team = self.EnemyTeam;
self.KeyDoor1:EnableEmission(false); -- probably don't need this right?
MovableMan:AddParticle(self.KeyDoor1); --Errors here
How can I set the doors to change team to player team when player picks up the control chip? I have no code for this, absolutley no clue what to do here.
I'm also getting some formatting errors (expecting then here, expecting eof here etc...)
EDIT: Ship spawn code, not sure if this works properly...
Code:
function CliffBaseAssault:PhaseOne()
-- Loop through all actors to find an actor from our team. Be cautious with this loop and use it wiseley as it
-- may add signifiant lag if used many times especially when you have many actors.
for actor in MovableMan.Actors do
-- Check if an actor is from our team
if actor.Team == self.PlayerTeam then
-- Check if an actor from our team is inside an area, if it is spawn ship
if self.caveArea:IsInside(actor.Pos) then
local ship = RandomACDropship("Any", self.CPUTechName);
local actor = nil;
local weapon = nil;
for i = 0, 1 do
if math.random() >= self:GetCrabToHumanSpawnRatio(PresetMan:GetModuleID(Self.CPUTechName)) then
actor = CreateAHuman("Any", self.CPUTechName);
else
actor = RandomACrab("Any", self.CPUTechName);
end
if IsAHuman(actor) then
actor:AddInventoryItem(RandomHDFirearm("Primary Weapons", self.CPUTechName));
actor:AddInventoryItem(RandomHDFirearm("Secondary Weapons", self.CPUTechName));
if PosRand() < 0.5 then
actor:AddInventoryItem(RandomHDFirearm("Diggers", self.CPUTechName));
end
end
actor.AIMode = Actor.AIMODE_BRAINHUNT;
actor.Team = self.CPUTeam;
ship:AddInventoryItem(actor);
end
ship.Pos = Vector(self.DummyLZ:GetRandomPoint().X,0);
ship.Team = self.CPUTeam;
ship:SetControllerMode(Controller.CIM_AI, -1);
MovableMan:AddActor(ship);
self:AdvanceToTwo();
end
end
end
end
CPUBrainCheck Function - I know this is wrong but it's all I got.
Code:
function CliffBaseAssault:DoCPUBrainCheck()
if MovableMan:IsActor(self.CPUBrain) then
self:AddObjectivePoint("Destroy!", self.CPUBrain.AboveHUDPos+Vector(0,-16), Activity.TEAM_1, GameActivity.ARROWDOWN)
else
self.WinnerTeam = Activity.TEAM_1
ActivityMan:EndActivity()
end
end
I'll upload RTE with all lua and inis included so if anyone wants to take a look feel free!
EDIT: Updated RTE uploaded.