Data Realms Fan Forums
http://45.55.195.193/

Multiple Enemy Brains
http://45.55.195.193/viewtopic.php?f=73&t=16894
Page 1 of 1

Author:  Levelx [ Mon Oct 19, 2009 6:54 pm ]
Post subject:  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..

Author:  CrazyMLC [ Mon Oct 19, 2009 7:27 pm ]
Post subject:  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

Author:  Samohan25 [ Mon Oct 19, 2009 7:53 pm ]
Post subject:  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.

Author:  Lizardheim [ Thu Oct 22, 2009 4:40 pm ]
Post subject:  Re: Multiple Enemy Brains

Umm, it just used lua to check if the enemy has a brain...

Author:  Levelx [ Fri Oct 23, 2009 5:51 am ]
Post subject:  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?

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/