Author |
Message |
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: Throwing knives
make your throwing knife a regular tdexplosive with an infinite triggerdelay
on impact it gibs into a globalaccscalar = 0 mosrotating with the following code
function Create(self) for actor in MovableMan.Actors do local curdist = 50; local dist = SceneMan:ShortestDistance(self.Pos,actor.Pos); if dist.Magnitude < curdist then self.target = actor; self.RotAngle = dist.Direction; --not actually sure if this works end end if self.target then self.diffx,self.diffy = self.target.Pos.X - self.Pos.X,self.target.Pos.Y - self.Pos.Y; end end
function Update(self) if MovableMan:IsActor(self.target) == true then self.Pos.X = self.target.Pos.X - self.diffx; self.Pos.Y = self.target.Pos.Y - self.diffy; end end
should work but it's all untested pseudocode so don't expect it to
and the comment is in there because sceneman.shortestdistance returns a polar vector, one of the arguments for which is magnitude, but I'm not sure if the other is .Dir or .Direction (it should be both but hey, who knows)
|
Fri Feb 12, 2010 6:03 am |
|
|
Potatamoto
Joined: Fri Jan 01, 2010 4:37 am Posts: 112 Location: Why do you wanna know? Are you a serial killer?!?
|
Re: Throwing knives
How are the knives coming along?
|
Wed Feb 17, 2010 5:48 am |
|
|
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
Re: Throwing knives
dist.Direction should be dist.AbsRadAngle methinks.
|
Wed Feb 17, 2010 6:04 am |
|
|
CrazyMLC
Joined: Fri Dec 22, 2006 4:20 am Posts: 4772 Location: Good news everyone!
|
Re: Throwing knives
I've been slacking because of lack of Lua knowledge, though now that Grif has donated some code I can try to put something together.
|
Wed Feb 17, 2010 1:50 pm |
|
|
CrazyMLC
Joined: Fri Dec 22, 2006 4:20 am Posts: 4772 Location: Good news everyone!
|
Re: Throwing knives
For some reason it refuses to work, but here it is for now.
|
Fri Feb 19, 2010 5:27 am |
|
|
lafe
Joined: Sat Mar 28, 2009 2:33 pm Posts: 718
|
Re: Throwing knives
CrazyMLC wrote: For some reason it refuses to work, but here it is for now. I made recursively gibing knives here; download/file.php?id=31288
|
Fri Feb 19, 2010 2:32 pm |
|
|
Potatamoto
Joined: Fri Jan 01, 2010 4:37 am Posts: 112 Location: Why do you wanna know? Are you a serial killer?!?
|
Re: Throwing knives
Thanks, Lafe but I'd rather just have it kill instantly rather than gibbing and spraying blood everywhere. EDIT: By the way once they're done, could you make them a gun so you don't run out of them?
|
Wed Feb 24, 2010 3:14 am |
|
|
Potatamoto
Joined: Fri Jan 01, 2010 4:37 am Posts: 112 Location: Why do you wanna know? Are you a serial killer?!?
|
Re: Throwing knives
CrazyMLC wrote: For some reason it refuses to work, but here it is for now. Correct me if I'm wrong but would you be able to do some copy/paste of some scripts in other bombs? Like the stick grenades in the ronin faction. You could copy that and then just add all the sparkle magic you need to. Would that make you be able to throw them??
|
Sun Mar 07, 2010 11:06 pm |
|
|
CrazyMLC
Joined: Fri Dec 22, 2006 4:20 am Posts: 4772 Location: Good news everyone!
|
Re: Throwing knives
Possibly. I got everything other than the sparkle magics to work, so we'll have to see. I'll have to go over the Lua some more to see what is wrong since the console isn't giving me any errors.
|
Tue Mar 09, 2010 8:21 am |
|
|
andronicus
Joined: Fri Aug 13, 2010 2:18 pm Posts: 2
|
Re: Throwing knives
Yeah that is very possible. Let me make you a throwing knife. throwing knife
Last edited by andronicus on Fri Aug 13, 2010 7:48 pm, edited 1 time in total.
|
Fri Aug 13, 2010 2:56 pm |
|
|
Benpasko
Joined: Sun Aug 09, 2009 9:26 am Posts: 1633
|
Re: Throwing knives
You DO realize that the last post in this topic was 6 months ago? I think any interest in this would have died by now.
|
Fri Aug 13, 2010 7:42 pm |
|
|
Joesycop
Joined: Mon Oct 19, 2009 9:04 am Posts: 302 Location: Under Your Bed
|
Re: Throwing knives
Yeah. This should probaly be locked or deleted. Whatever
|
Thu Aug 19, 2010 12:10 pm |
|
|
Duh102
happy carebear mom
Joined: Tue Mar 04, 2008 1:40 am Posts: 7096 Location: b8bbd5
|
Re: Throwing knives
I'll take that as a request and fulfill it.
|
Thu Aug 19, 2010 12:45 pm |
|
|
|