Data Realms Fan Forums
http://45.55.195.193/

Crashes Game But Shouldnt, Please Help
http://45.55.195.193/viewtopic.php?f=73&t=18961
Page 1 of 1

Author:  Laraso [ Fri Jun 11, 2010 2:49 am ]
Post subject:  Crashes Game But Shouldnt, Please Help

Hey, I am trying to make a gun that shoots a bomb, and when the bomb explodes everything within the blast radius gets converted to a certain team. In the code below, I put the lua I am using for the green team converter.

Code:
function Destroy(self)
   for actor in MovableMan.Actors do
      local diff = math.sqrt(math.pow((actor.Pos.X-self.Pos.X),2) + math.pow((actor.Pos.Y - self.Pos.Y),2))
         if diff < 50 then
            actor.Team = 1
      end
   end
end


The code works fine. It converts anything that isn't on team 1 (green team) to team 1. However, there are a few issues with this.

Problem 1: If I am on team 0, and shot one of my team 0 soldiers to convert him to team 1, he will successfully convert to team 1 and my soldiers will start shooting him. However, I can still switch back to him, and when I do he goes back to team 0. Not only this, but people on team 1 cannot control him even after he has been converted.

Problem 2: If a converted object dies while it is still converted, the game will crash. No matter what. If I shoot said object with a different gun that converts it back to team 0, though, the game will not crash.

What did I do wrong? Please help.

Author:  Duh102 [ Fri Jun 11, 2010 3:29 am ]
Post subject:  Re: Crashes Game But Shouldnt, Please Help

For both, teamswitching doesn't exactly work very well in b23. Lua is quite the buggy system in the current Cortex.

Author:  Laraso [ Fri Jun 11, 2010 3:36 am ]
Post subject:  Re: Crashes Game But Shouldnt, Please Help

So the code is right but lua is not implemented well enough into Cortex Command for it to work?

Author:  Duh102 [ Fri Jun 11, 2010 4:04 am ]
Post subject:  Re: Crashes Game But Shouldnt, Please Help

Yeah, that. We're hoping it gets fixed in the next build.

Author:  Grif [ Fri Jun 11, 2010 8:05 am ]
Post subject:  Re: Crashes Game But Shouldnt, Please Help

Well, in the case of teamswitching, it's not exactly a problem with Lua; lua can rather obviously switch teams just fine.

It's more of an issue with the engine not being designed to accomodate actors switching teams, so presumably certain attributes, memory values, random junk, etc, etc, doesn't switch over, leading to the instability that causes crashes.

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