Author |
Message |
CombatMedic02
Joined: Wed Dec 17, 2008 11:35 am Posts: 122 Location: London
|
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. Thanks in advance, CBM02
Attachments:
File comment: What I have so far.
GasGrenade.rte.rar [119.89 KiB]
Downloaded 170 times
|
Sat Sep 05, 2009 5:49 pm |
|
|
Lizardheim
DRL Developer
Joined: Fri May 15, 2009 10:29 am Posts: 4107 Location: Russia
|
Re: Gas Grenade - Instadeath, No gib, help needed.
shook's hueg pack of stuff has death drones with something similar.
|
Sat Sep 05, 2009 5:53 pm |
|
|
TorrentHKU
Loose Canon
Joined: Sun Mar 29, 2009 11:07 pm Posts: 2992 Location: --------------->
|
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.
Last edited by TorrentHKU on Sun Sep 06, 2009 1:57 am, edited 1 time in total.
|
Sat Sep 05, 2009 5:54 pm |
|
|
CombatMedic02
Joined: Wed Dec 17, 2008 11:35 am Posts: 122 Location: London
|
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...
|
Sat Sep 05, 2009 6:27 pm |
|
|
Shook
Joined: Fri Feb 16, 2007 8:43 pm Posts: 1695 Location: AH SHIT FUCK AUGH
|
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".
|
Sat Sep 05, 2009 7:04 pm |
|
|
CombatMedic02
Joined: Wed Dec 17, 2008 11:35 am Posts: 122 Location: London
|
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?
|
Sat Sep 05, 2009 7:25 pm |
|
|
numgun
Joined: Sat Jan 13, 2007 11:04 pm Posts: 2932
|
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.
|
Sat Sep 05, 2009 8:38 pm |
|
|
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
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.
|
Sat Sep 05, 2009 10:23 pm |
|
|
CombatMedic02
Joined: Wed Dec 17, 2008 11:35 am Posts: 122 Location: London
|
Re: Gas Grenade - Instadeath, No gib, help needed.
Aha! That's fixed it. Needs a little tweeking but it pretty much done now. 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. But yeah, thanks for all your help guys! CBM02
|
Sun Sep 06, 2009 11:38 am |
|
|
|