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



Reply to topic  [ 5 posts ] 
 Crashes Game But Shouldnt, Please Help 
Author Message
User avatar

Joined: Sun Feb 21, 2010 10:40 pm
Posts: 97
Reply with quote
Post 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.


Fri Jun 11, 2010 2:49 am
Profile
happy carebear mom
User avatar

Joined: Tue Mar 04, 2008 1:40 am
Posts: 7096
Location: b8bbd5
Reply with quote
Post 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.


Fri Jun 11, 2010 3:29 am
Profile
User avatar

Joined: Sun Feb 21, 2010 10:40 pm
Posts: 97
Reply with quote
Post 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?


Fri Jun 11, 2010 3:36 am
Profile
happy carebear mom
User avatar

Joined: Tue Mar 04, 2008 1:40 am
Posts: 7096
Location: b8bbd5
Reply with quote
Post Re: Crashes Game But Shouldnt, Please Help
Yeah, that. We're hoping it gets fixed in the next build.


Fri Jun 11, 2010 4:04 am
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post 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.


Fri Jun 11, 2010 8:05 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.064s | 13 Queries | GZIP : Off ]