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



Reply to topic  [ 9 posts ] 
 Gas Grenade - Instadeath, No gib, help needed. 
Author Message
User avatar

Joined: Wed Dec 17, 2008 11:35 am
Posts: 122
Location: London
Reply with quote
Post 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 170 times
Sat Sep 05, 2009 5:49 pm
Profile WWW
DRL Developer
DRL Developer

Joined: Fri May 15, 2009 10:29 am
Posts: 4107
Location: Russia
Reply with quote
Post 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
Profile
Loose Canon
User avatar

Joined: Sun Mar 29, 2009 11:07 pm
Posts: 2992
Location: --------------->
Reply with quote
Post 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
Profile WWW
User avatar

Joined: Wed Dec 17, 2008 11:35 am
Posts: 122
Location: London
Reply with quote
Post 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
Profile WWW
User avatar

Joined: Fri Feb 16, 2007 8:43 pm
Posts: 1695
Location: AH SHIT FUCK AUGH
Reply with quote
Post 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
Profile WWW
User avatar

Joined: Wed Dec 17, 2008 11:35 am
Posts: 122
Location: London
Reply with quote
Post 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
Profile WWW

Joined: Sat Jan 13, 2007 11:04 pm
Posts: 2932
Reply with quote
Post 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
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post 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
Profile WWW
User avatar

Joined: Wed Dec 17, 2008 11:35 am
Posts: 122
Location: London
Reply with quote
Post 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


Sun Sep 06, 2009 11:38 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 9 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.027s | 15 Queries | GZIP : Off ]