View unanswered posts | View active topics It is currently Fri Dec 27, 2024 9:39 am



Reply to topic  [ 6 posts ] 
 Wounds via lua? 
Author Message
User avatar

Joined: Fri Dec 28, 2007 4:19 am
Posts: 1119
Reply with quote
Post Wounds via lua?
Is it currently possible to wound stuff using lua? As in not creating a emitter and such.


Sat Jan 02, 2010 1:35 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Wounds via lua?
If you mean create a custom wound, you can position a GetsHitByMOs = 0 and HitsMOs = 0 object at specific location to the wounded object and have the fake wound do stuff with Lua.


Sat Jan 02, 2010 1:41 am
Profile
User avatar

Joined: Fri Dec 28, 2007 4:19 am
Posts: 1119
Reply with quote
Post Re: Wounds via lua?
Might as well attempt to clarify, is it possible to wound a target <No custom wounds here> without a MOPixel impacting it?


Sat Jan 02, 2010 1:47 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Wounds via lua?
Basic sticking Lua. You'll need to put in your own pointers, if statements, and effects. The object will rotate with the "wounded" object, and will move like a real wound.

Code:
function Create(self)
   self.stickpositionX = 0; -- Just some variables put down (but don't edit them) so we know they exist
   self.stickpositionY = 0;
   self.stickrotation = 0;

   self.target = <pointer to target>; -- You want these four lines here to be set one time,
   self.stickpositionX = self.Pos.X-self.target.Pos.X; -- so you put them in Update if you want
   self.stickpositionY = self.Pos.Y-self.target.Pos.Y; -- Just make sure they're not set more than one time
   self.stickrotation = self.target.RotAngle; -- Unless you want the object to stick to something else

end

function Update(self)
   self.Pos = self.target.Pos + Vector(self.stickpositionX,self.stickpositionY):RadRotate(self.target.RotAngle-self.stickrotation);
   self.RotAngle = self.target.RotAngle;
   self.Vel = self.target.Vel; -- Or you can make this (Vector(0,0))
end


Edit: this will work on something that doesn't have custom wounds, too.
EDit2: Wait, if it it doesn't have a custom wound like Entry/Exit Wound, it can't be wounded at all.


Sat Jan 02, 2010 2:05 am
Profile
User avatar

Joined: Fri Dec 28, 2007 4:19 am
Posts: 1119
Reply with quote
Post Re: Wounds via lua?
Wait wait wait wait... Can you actually call on the object's entry/exit wound? Like...
Code:
particle = CreateAEmitter(object.EntryWound);

With checks for the wounds existing in the first place.


Sat Jan 02, 2010 2:45 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Wounds via lua?
I don't think so, you'll have to test that out. The code I put allows you to create anything and it will "stick" to the desired object, and then you could do fake wound effects via Lua. Below is a poison dart gun I wipped up in about 5 minutes to show you.


Attachments:
Dart Gun.rte.zip [2.36 KiB]
Downloaded 149 times
Sat Jan 02, 2010 3:38 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.095s | 14 Queries | GZIP : Off ]