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



Reply to topic  [ 6 posts ] 
 Changing TDExplosive Variables on Activation 
Author Message
User avatar

Joined: Thu Dec 28, 2006 12:47 am
Posts: 40
Reply with quote
Post Changing TDExplosive Variables on Activation
Is there a way to make grenades change their GibImpulseLimit, GetsHitByMOs and such when thrown as opposed to just on the ground?


Sun Feb 21, 2010 10:19 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Changing TDExplosive Variables on Activation
You can't change GibImpulseLimit, but you can change GetsHitByMOs. If you have something like:

Code:
function Update(self)

   if self:IsActivated() == true then
       self.GetsHitByMOs = false;
   end

end


it will make the grenade GetsHitByMOs false/0 when the grenade is activated.


Sun Feb 21, 2010 10:36 pm
Profile
User avatar

Joined: Thu Dec 28, 2006 12:47 am
Posts: 40
Reply with quote
Post Re: Changing TDExplosive Variables on Activation
Also, can you replace the grenade with a new object when thrown? Maybe that'll solve not being able to change the gib values.


Last edited by firecrystal on Mon Feb 22, 2010 2:04 am, edited 2 times in total.



Mon Feb 22, 2010 1:27 am
Profile
User avatar

Joined: Thu Mar 06, 2008 10:54 pm
Posts: 1360
Location: USA
Reply with quote
Post Re: Changing TDExplosive Variables on Activation
Just make the grenade disappear and make another object spawn with the same stats

Code:
function Update(self)
if self:IsActivated() == true then
   NewObject = CreateMOPixel("Particle SMG2");
   NewObject.Pos.X = self.Pos.X
   NewObject.Pos.Y = self.Pos.Y
   NewObject.Vel = self.Vel
   MovableMan:AddParticle(NewObject);
   self.ToDelete = true;
end
end


You would change the name of the particle and class of it according to what you wanted to create but thats basically what you would do. Im sure CaveCricket has a more creative way to do it tho :D
Hope this helps


Mon Feb 22, 2010 1:42 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Changing TDExplosive Variables on Activation
^ That's pretty much they way to do it.


Mon Feb 22, 2010 1:48 am
Profile
User avatar

Joined: Thu Dec 28, 2006 12:47 am
Posts: 40
Reply with quote
Post Re: Changing TDExplosive Variables on Activation
Thank you for the help. I'm basically trying to make safe grenades that don't explode until thrown.

Edit: I may need to change a few things, as the grenade I tested this on turned into several copies of the activated version, making it more like an overpowered cluster grenade.

Double Edit: I can't seem to make it stop either. It apparently turns into an SMG perfectly, just not a TDExplosive. Does it copy the Lua script over to things it makes?

Okay, I fixed it, I was using NewObject.Activate(); instead of NewObject:Activate();
Also, I must remember that "Does Not Equal" in Lua is ~= and not !=.


Mon Feb 22, 2010 1:51 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 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 | 13 Queries | GZIP : Off ]