View unanswered posts | View active topics It is currently Thu Dec 26, 2024 5:07 pm



Reply to topic  [ 6 posts ] 
 Edited the Assassination mission for co-op, problems 
Author Message

Joined: Wed May 13, 2009 12:42 am
Posts: 3
Reply with quote
Post 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
Code:
PlayerCount = 2


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. :x
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?


Last edited by mewarmo990 on Wed May 13, 2009 3:08 am, edited 2 times in total.



Wed May 13, 2009 1:41 am
Profile
User avatar

Joined: Thu Feb 12, 2009 1:47 am
Posts: 1182
Reply with quote
Post Re: Edited the Assassination mission for co-op, problems
This belongs in the mission's thread.


Wed May 13, 2009 1:57 am
Profile
User avatar

Joined: Mon Jun 30, 2008 9:13 pm
Posts: 499
Location: Finland
Reply with quote
Post Re: Edited the Assassination mission for co-op, problems
Give me the .lua, I'll see about it. Always wanted to learn how to do this anyway.


Wed May 13, 2009 5:34 am
Profile

Joined: Wed May 13, 2009 12:42 am
Posts: 3
Reply with quote
Post Re: Edited the Assassination mission for co-op, problems
Sure, thanks. I'm feeling pretty clueless so I'd appreciate any advice you can give me.


Attachments:
File comment: Don't forget to change PlayerCount in Activities
assassination.lua.zip [2.62 KiB]
Downloaded 227 times
Wed May 13, 2009 5:59 am
Profile
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post Re: Edited the Assassination mission for co-op, problems
The issue is that both players are using the same actor variable.

BTW, I have no idea why there is that loop.

Get rid of it.


Wed May 13, 2009 7:14 am
Profile
User avatar

Joined: Mon Jun 30, 2008 9:13 pm
Posts: 499
Location: Finland
Reply with quote
Post Re: Edited the Assassination mission for co-op, problems
What mail said. That is, replace your codeblock with this:
Code:
   pl = CreateAHuman("Soldier Heavy");
   pl.AIMode = Actor.AIMODE_SENTRY;
   pl.Team = 0;
   pl:AddInventoryItem(CreateHDFirearm("Pistol"));
   pl.Pos = Vector(89,429);
   MovableMan:AddActor(pl)

   playerActor = pl;
   self:SetPlayerBrain(playerActor, 0);
   self:SetLandingZone(playerActor.Pos, 0);
   
   pl2 = CreateAHuman("Soldier Heavy");
   pl2.AIMode = Actor.AIMODE_SENTRY;
   pl2.Team = 0;
   pl2:AddInventoryItem(CreateHDFirearm("Pistol"));
   pl2.Pos = Vector(49,429);
   MovableMan:AddActor(pl2)

   playerActor = pl2;
   self:SetPlayerBrain(playerActor, 1);
   self:SetLandingZone(playerActor.Pos, 1);

Doesn't cause splitscreen to happen, but at least it gives the other guy to player 2.


Wed May 13, 2009 5:37 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.058s | 14 Queries | GZIP : Off ]