Data Realms Fan Forums
http://45.55.195.193/

Gas Grenade - Instadeath, No gib, help needed.
http://45.55.195.193/viewtopic.php?f=73&t=16446
Page 1 of 1

Author:  CombatMedic02 [ Sat Sep 05, 2009 5:49 pm ]
Post subject:  Gas Grenade - Instadeath, No gib, help needed.

Hey guys! Probably a small amount of help needed here as I still can’t get my head around Lua.

I need a Lua script that sets the HP of actors to 0 when in an area. This is for the attached gas grenade that I have made. I didn't want the actor to gib when they are affected by the grenade as it is gas and it wouldn't turn them into Swiss cheese.

So yeah... actor just dropping dead would be good. Grenade has all the .ini, sound, images and such done, it just needs this Lua file to have it completely finished.

All help and comments for this project are greatly received, it still is a WIP and I probably will make other little grenades to release it as a pack when done. Any one that helps will be credited in the index file and in the release post. :grin:

Thanks in advance,

CBM02

Attachments:
File comment: What I have so far.
GasGrenade.rte.rar [119.89 KiB]
Downloaded 182 times

Author:  Lizardheim [ Sat Sep 05, 2009 5:53 pm ]
Post subject:  Re: Gas Grenade - Instadeath, No gib, help needed.

shook's hueg pack of stuff has death drones with something similar.

Author:  TorrentHKU [ Sat Sep 05, 2009 5:54 pm ]
Post subject:  Re: Gas Grenade - Instadeath, No gib, help needed.

Arg, ninja'd. I was just about to suggest Shook's pack. It has a gas bomb that decreases health for anything breathing the gas.

Author:  CombatMedic02 [ Sat Sep 05, 2009 6:27 pm ]
Post subject:  Re: Gas Grenade - Instadeath, No gib, help needed.

Hmmm I'll check it out but i'm not sure if it'll be what I'm looking for and I'm not sure I could edit it. I can't Lua at all... :-(

Author:  Shook [ Sat Sep 05, 2009 7:04 pm ]
Post subject:  Re: Gas Grenade - Instadeath, No gib, help needed.

Code:
function Update(self)
   for actor in MovableMan.Actors do
      local avgx = actor.Pos.X - self.Pos.X;
      local avgy = actor.Pos.Y - self.Pos.Y;
      local dist = math.sqrt(avgx ^ 2 + avgy ^ 2);
      if dist < 70 then
      --Set the above value to the radius in pixels you want.
         actor.Health = 0;
      end
   end
end

That should do the trick. I think. I hope you get what i mean with the comment below "dist < 70". ;)

Author:  CombatMedic02 [ Sat Sep 05, 2009 7:25 pm ]
Post subject:  Re: Gas Grenade - Instadeath, No gib, help needed.

Hmmm... I've made it so the gas grenade gibs MOPixels with the Lua Script attached [so the area is around them pixals] but they are not causing death. o.o

Any suggestions?

Author:  numgun [ Sat Sep 05, 2009 8:38 pm ]
Post subject:  Re: Gas Grenade - Instadeath, No gib, help needed.

Having a Lua script like the one shook posted on each individual particle is not a good idea. It'll lag horribly, mainly. And the script isnt very suitable for this situation.

Make a pinned emitter with that shook's script attached and the emitter itself it spews harmless gas particles that just are there to create an illusion the gas particles are doing the hurting.

The dist < (Number) controls the range. 70 is 70 pixels from the center in a circle.

Author:  Geti [ Sat Sep 05, 2009 10:23 pm ]
Post subject:  Re: Gas Grenade - Instadeath, No gib, help needed.

Code:
function Update(self)
   for actor in MovableMan.Actors do
      local dist = SceneMan:ShortestDistance(self.Pos, actor.Pos, true).Magnitude
      if dist < 70 then
      --Set the above value to the radius in pixels you want.
         actor.Health = 0;
      end
   end
end
fix'd
and if you wanted a box you should have used a box.

Author:  CombatMedic02 [ Sun Sep 06, 2009 11:38 am ]
Post subject:  Re: Gas Grenade - Instadeath, No gib, help needed.

Aha! That's fixed it. Needs a little tweeking but it pretty much done now. :grin:

Thanks Geti and Shook and all of you who have helped me out.

I'll see if I can get a pack together... maybe I’ll try my hand at some smoke canisters for distractions and such. :grin:

But yeah, thanks for all your help guys!

CBM02

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