View unanswered posts | View active topics It is currently Thu Jan 09, 2025 11:28 pm



Reply to topic  [ 9 posts ] 
 Lua Question 
Author Message
User avatar

Joined: Thu Jun 12, 2008 10:06 pm
Posts: 68
Location: Texas
Reply with quote
Post Lua Question
I am not very well in the lua codes, and I was wondering if it was actually possible to make things happen when a particle damages an actor.

Example: Lets say when bullet hits actor it causes the actor to gib.

I need to know if its possible or not. If it is, can you please give me a copy of the code for it?


Mon Jun 01, 2009 4:05 am
Profile
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post Re: Lua Question
Check if the health changes?

Better yet, have the wounds spawn particles that communitcate with the nearest actor with the right PresetName.


Mon Jun 01, 2009 4:17 am
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Lua Question
On destroy have the nearest actor gib if it's on an enemy team?

Really there's tons of ways to do it.


Mon Jun 01, 2009 5:00 am
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post Re: Lua Question
Hes using an example to find out how to do something, and he means when the... sigh.

Actor A shoots actor B
Actor B has code to make it so that when he is shot he explodes.
Boom.

not

Actor A shoots actor B
Actor B has code to make it so that when he is shot the shooter explodes.
Boom.


Mon Jun 01, 2009 5:53 am
Profile WWW
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Lua Question
That's what my code would do?

On the destroy function of a PARTICLE find the nearest actor and if it's within a certain distance gib it.


Mon Jun 01, 2009 5:58 am
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post Re: Lua Question
Hm.
He wanted to code for that, and now so do I


Mon Jun 01, 2009 6:01 am
Profile WWW
User avatar

Joined: Mon Jun 30, 2008 9:13 pm
Posts: 499
Location: Finland
Reply with quote
Post Re: Lua Question
You could also use CastMORay to find out if the particle has collided with something and then gib that something.


Mon Jun 01, 2009 8:18 am
Profile
User avatar

Joined: Thu Jun 12, 2008 10:06 pm
Posts: 68
Location: Texas
Reply with quote
Post Re: Lua Question
Grif wrote:
That's what my code would do?

On the destroy function of a PARTICLE find the nearest actor and if it's within a certain distance gib it.


Grif, could you post some code please. So you could gib it, or do whatever you wanted with it right?


Tue Jun 02, 2009 12:53 am
Profile
User avatar

Joined: Mon Jun 30, 2008 9:13 pm
Posts: 499
Location: Finland
Reply with quote
Post Re: Lua Question
Code:
function Update(self)
     self.atarget = (SceneMan:CastMORay(Vector(self.Pos.X - self.Vel.X,self.Pos.Y - self.Vel.Y),Vector(self.Vel.X,self.Vel.Y),0,0,true,5))
     --check if self is colliding with any MO. If yes, returns MOID of that MO.
     self.target = MovableMan:GetMOFromID(MovableMan:GetRootMOID(self.atarget))
     --get the root MO from the MOID
     if self.target ~= nil then  --if collision happened
       --do stuff to the MO
       self.target:GibThis()
     end
end


Tue Jun 02, 2009 9:07 am
Profile
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.050s | 13 Queries | GZIP : Off ]