View unanswered posts | View active topics It is currently Fri Dec 27, 2024 7:48 am



Reply to topic  [ 5 posts ] 
 Multiple Enemy Brains 
Author Message
User avatar

Joined: Tue Jul 31, 2007 11:25 pm
Posts: 81
Reply with quote
Post Multiple Enemy Brains
Hello, this is my first time tinkering with Lua.

I've made a scripted scene with two enemy brain cases. I want the script to keep the game going as long as there's enemy brains still living. One brain works as it should, but killing the other results in a win..


Mon Oct 19, 2009 6:54 pm
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post Re: Multiple Enemy Brains
Levelx wrote:
I want the script to keep the game going as long as there's enemy brains still living.

That is the default.
When I have fifty brains in skirmish if one dies I still live.

Well, anyway, I know absolutely nothing about the lua things used in missions but I think the gist would be:
Code:
if brain1:IsDead() == true and brain2:IsDead() == true then
gameover
end


Mon Oct 19, 2009 7:27 pm
Profile WWW
User avatar

Joined: Fri Jul 24, 2009 9:03 am
Posts: 159
Reply with quote
Post Re: Multiple Enemy Brains
I seem to remember WeeGee's DummyTwins scene uses lua to detect when both brains are dead, I think it uses a Lua code that searches an area for dummy brains and if it finds none then it continues to the next phase. If you look at that first then you could find some hints.


Mon Oct 19, 2009 7:53 pm
Profile
DRL Developer
DRL Developer

Joined: Fri May 15, 2009 10:29 am
Posts: 4107
Location: Russia
Reply with quote
Post Re: Multiple Enemy Brains
Umm, it just used lua to check if the enemy has a brain...


Thu Oct 22, 2009 4:40 pm
Profile
User avatar

Joined: Tue Jul 31, 2007 11:25 pm
Posts: 81
Reply with quote
Post Re: Multiple Enemy Brains
Code:
if not MovableMan:IsActor(self.CPUBrain1) and not MovableMan:IsActor(self.CPUBrain2) then
This code seems to work out ok. I see it's limited to 2 CPU brains though and it got me thinking: Is there a way to search for CPU brains, like GetUnassignedBrain(); does?


Fri Oct 23, 2009 5:51 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 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.034s | 13 Queries | GZIP : Off ]