Edited the Assassination mission for co-op, problems
Hey everyone, I just got CC and I love it. Thanks for this great scene, too.
So after forcing myself to learn the very basics of LUA coding, through some excruciating trial and error I clumsily managed to make this scene two-player co-op. It's very playable, but there are some kinks I'm still trying to work out.
I edited "assassination.rte\Activities.ini" so that
Then, in "assassination.rte\Scenes\Scripts\assassination.lua",
Code:
-- Set up players
for player = 0, self.PlayerCount - 0 do
--Set the brain to playerActor. The only reason we do this is that the game crashes without a brain. Even if the playerActor dies, it won't matter, though.
pl = CreateAHuman("Shinobi Tengu", "DarkStorm.rte");
pl.AIMode = Actor.AIMODE_SENTRY;
pl.Team = 0;
pl:AddInventoryItem(CreateHDFirearm("D17-S Pistol", "DarkStorm.rte"));
pl:AddInventoryItem(CreateHDFirearm("D35-S Carbine", "DarkStorm.rte"));
pl:AddInventoryItem(CreateTDExplosive("D61 Chaff Grenade Type 1", "DarkStorm.rte"));
pl:AddInventoryItem(CreateTDExplosive("P.A. Frag Nade", "PelianArmy.rte"));
pl:AddInventoryItem(CreateTDExplosive("P.A. Plasma Nade", "PelianArmy.rte"));
pl.Pos = Vector(79,429);
MovableMan:AddActor(pl)
playerActor = pl;
self:SetPlayerBrain(playerActor, player);
self:SetLandingZone(playerActor.Pos, player);
end
In the second line I changed "self.Playercount - 0" instead of 1. Anything besides 0 doesn't spawn anything and causes a Mission Failure since Player 1 is the brain.
The game spawns
three copies of the actor I specified - two are controlled by the players and the third just does his own AIMODE thing. I can't for the life of me figure out how to spawn a second, unique actor for Player 2 to control. Everything I've tried has resulted in the scene not loading because of an "end expected" or some incomplete argument.
Player 2 must attempt to switch actors in order to control the one he is supposed to start with.
I have some questions:
1. The scene is set so that you cannot switch actors (both players) - it makes sense in the gameplay of this mission, but can somebody please explain to me where this is scripted so I can figure out how to change it in the future?
2. Is there a way to spawn a second, different actor as Player 2?
3. Why is that third actor there, and how do I stop it from spawning?
4. Whenever Player 2 dies, the game crashes. Huh?