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



Reply to topic  [ 11 posts ] 
 Gibbing self after slowing down into a set speed 
Author Message
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Gibbing self after slowing down into a set speed
I want to gib an object if it's speed gets reduced a lot, how could I do it?

Until now my code looks like this:

Code:
function Update(self)

 if self.Vel < (5,5) or self.Vel < (-5,-5) or self.Vel < (5,-5) or self.Vel < (-5,5) then
      self:GibThis();
 end
end


But it's not working.


Fri Mar 04, 2011 9:34 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post Re: Gibbing self after slowing down into a set speed
Code:
function Update(self)
    if self.Vel.Magnitude <= 25 or self.Vel.Magnitude >= -25 then
        self:GibThis()
    end
end


Fri Mar 04, 2011 9:36 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Re: Gibbing self after slowing down into a set speed
Thanks, that worked perfectly.

Edit: Wait a second, not so perfectly.
The lua console give me this error:
Attempt to call method "GibThis" (a nil value)

What's wrong then?


Fri Mar 04, 2011 9:41 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post Re: Gibbing self after slowing down into a set speed
Try putting a semicolon (;) after gibthis.


Fri Mar 04, 2011 9:47 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Re: Gibbing self after slowing down into a set speed
Still, same error.


Fri Mar 04, 2011 9:47 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post Re: Gibbing self after slowing down into a set speed
Is the thing actually being destroyed? If so then it could be that it's calling an update or two before actually disappearing.

If not then try:
Code:
function Update(self)
    if self.Vel.Magnitude <= 25 and self.ToDelete ~= true then
        self:GibThis()
    end
end]


EDIT: DERP ME, try this instead. Thank you CaveCricket48.


Fri Mar 04, 2011 9:52 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Re: Gibbing self after slowing down into a set speed
I keep getting the same error.

I placed a function on it when it is destroyed, so I can recognize that the particle is actually gibbing, but after it's lifetime rather than after reducing its speed.


Fri Mar 04, 2011 9:57 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post Re: Gibbing self after slowing down into a set speed
What is your object? It sounds like it cannot gib anyway. Set:
Code:
self.ToDelete = true;
instead.


Fri Mar 04, 2011 10:07 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Re: Gibbing self after slowing down into a set speed
A mo pixel.

Now I realized I'm an idiot =D MOPixels don't gib :cclol:

Thanks.
A lot.


Fri Mar 04, 2011 10:13 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post Re: Gibbing self after slowing down into a set speed
You can make it look like they gibbed by creating object in the destroy function.


Fri Mar 04, 2011 10:31 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Re: Gibbing self after slowing down into a set speed
Yep, that was what I did.

You see, I've seen some explosive round codes, and they all looked fairly the same to me.

So I decided to create my own because of 2 reasons:
1) Learning, progresing, tried to make something "different" in my own way.
2) I didn't want to ask anyone for his code.


Fri Mar 04, 2011 10:35 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 11 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.053s | 14 Queries | GZIP : Off ]