Data Realms Fan Forums
http://45.55.195.193/

Changing TDExplosive Variables on Activation
http://45.55.195.193/viewtopic.php?f=73&t=17906
Page 1 of 1

Author:  firecrystal [ Sun Feb 21, 2010 10:19 pm ]
Post subject:  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?

Author:  CaveCricket48 [ Sun Feb 21, 2010 10:36 pm ]
Post subject:  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.

Author:  firecrystal [ Mon Feb 22, 2010 1:27 am ]
Post subject:  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.

Author:  Mind [ Mon Feb 22, 2010 1:42 am ]
Post subject:  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

Author:  CaveCricket48 [ Mon Feb 22, 2010 1:48 am ]
Post subject:  Re: Changing TDExplosive Variables on Activation

^ That's pretty much they way to do it.

Author:  firecrystal [ Mon Feb 22, 2010 1:51 am ]
Post subject:  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 !=.

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