Data Realms Fan Forums
http://forums.datarealms.com/

Wounds via lua?
http://forums.datarealms.com/viewtopic.php?f=73&t=17493
Page 1 of 1

Author:  DSMK2 [ Sat Jan 02, 2010 1:35 am ]
Post subject:  Wounds via lua?

Is it currently possible to wound stuff using lua? As in not creating a emitter and such.

Author:  CaveCricket48 [ Sat Jan 02, 2010 1:41 am ]
Post subject:  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.

Author:  DSMK2 [ Sat Jan 02, 2010 1:47 am ]
Post subject:  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?

Author:  CaveCricket48 [ Sat Jan 02, 2010 2:05 am ]
Post subject:  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.

Author:  DSMK2 [ Sat Jan 02, 2010 2:45 am ]
Post subject:  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.

Author:  CaveCricket48 [ Sat Jan 02, 2010 3:38 am ]
Post subject:  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 164 times

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