Author |
Message |
scottsman
Joined: Thu Dec 31, 2009 9:31 am Posts: 30
|
Gib-Target
Hi, I'm gonna be doing some modding, and I was curious if there was any way I could instantly gib a target when hit. I tried search and couldn't find anything usefull, so now I'm asking. Thanks in advance.
|
Fri Mar 19, 2010 2:41 am |
|
|
salt_1219
Joined: Tue Jan 12, 2010 8:25 pm Posts: 400 Location: mukilteo, wa
|
Re: Gib-Target
is this for a weapon ? If so you could try adding a super high sharp value to the projectile, and increase the mass maybe.
|
Fri Mar 19, 2010 8:54 pm |
|
|
dragonxp
Joined: Wed Sep 09, 2009 3:16 am Posts: 3032 Location: Somewhere in the universe
|
Re: Gib-Target
salt_1219 wrote: is this for a weapon ? If so you could try adding a super high sharp value to the projectile, and increase the mass maybe. Or attach a simple lua script. Which defines that if the MOPixel hits an actor, Gib.This.
|
Fri Mar 19, 2010 11:18 pm |
|
|
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
Re: Gib-Target
Oh god we need a new rule about those posting in these help threads, and them knowing what they're talking about. More sharpness increases the chance of wounding (and after that the chance of it punching through the back side) and more mass increases the kinetic force/impulse applied. More mass increases the chance of a target gibbing, but neither of these are perfect/relevant solutions. As dragon said, a script could be used, however I do wish people would look into how to actually implement these things before posting. The script would look something like this: Code: function Update(self) local targetID = SceneMan:CastMORay(self.Pos,((self.Vel / self.Vel.Magnitude)*20),0,0,false,5) -- cast a ray ahead of yourself if targetID ~= nil and targetID ~= 255 then local dist = SceneMan:ShortestDistance(MovableMan:GetMOFromID(MovableMan:GetRootMOID(targetID)).Pos, self.Pos, true).Magnitude; if dist < 40 then -- if whatever is in front of you is less than 40 px ahead MovableMan:GetMOFromID(MovableMan:GetRootMOID(targetID)):GibThis() -- gib it self.ToDelete = true --and delete yourself end end end end You'll want to put some things like transfer of velocity and impulses into the script, to make it more dramatic, but this should work (untested, check the console with the ~ button for errors)
|
Sat Mar 20, 2010 12:06 am |
|
|
salt_1219
Joined: Tue Jan 12, 2010 8:25 pm Posts: 400 Location: mukilteo, wa
|
Re: Gib-Target
Okay sorry I just suggested how I would have done it.
|
Sat Mar 20, 2010 8:02 am |
|
|
411570N3
Joined: Wed Jan 07, 2009 10:26 am Posts: 4074 Location: That quaint little British colony down south
|
Re: Gib-Target
He was referring to Dragonxp and the fact that his suggestion couldn't work. Ever.
|
Sat Mar 20, 2010 8:13 am |
|
|
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
Re: Gib-Target
To clarify, I wouldn't do it salt's way either, due to the recoil issue of raising mass (you'd need to use an aemitter or a script to bump the mass to prevent your guy from splattering) and the fact that mass based collisions are unreliable for gibbing. Sharpness won't work either way You'll just end up with a crapton of terrain rape.
|
Sat Mar 20, 2010 10:31 am |
|
|
Lizardheim
DRL Developer
Joined: Fri May 15, 2009 10:29 am Posts: 4107 Location: Russia
|
Re: Gib-Target
You can ofcourse, have it be loads of bullets, like the dummy rail pistol.
|
Sat Mar 20, 2010 12:40 pm |
|
|
Commodore111
Joined: Sun Oct 11, 2009 7:47 pm Posts: 132
|
Re: Gib-Target
I think 999999999999 mass and an AEmitter that launcher the projectile would suffice. And 0 sharpness to prevent extreme terrain grape.
|
Sun Mar 21, 2010 7:06 am |
|
|
411570N3
Joined: Wed Jan 07, 2009 10:26 am Posts: 4074 Location: That quaint little British colony down south
|
Re: Gib-Target
Or make it fire a normal 0 sharpness bullet that has its mass set to something ridiculous on Create(), a la Shook's Srs Cannon.
|
Sun Mar 21, 2010 7:12 am |
|
|
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
Re: Gib-Target
fffuu- guys the script is there, no need to confuse the man.
|
Sun Mar 21, 2010 8:00 am |
|
|
411570N3
Joined: Wed Jan 07, 2009 10:26 am Posts: 4074 Location: That quaint little British colony down south
|
Re: Gib-Target
Yeah, geti's script is what you should use. Our alternatives are better suited to other things.
|
Sun Mar 21, 2010 8:02 am |
|
|
scottsman
Joined: Thu Dec 31, 2009 9:31 am Posts: 30
|
Re: Gib-Target
Geti wrote: Oh god we need a new rule about those posting in these help threads, and them knowing what they're talking about. More sharpness increases the chance of wounding (and after that the chance of it punching through the back side) and more mass increases the kinetic force/impulse applied. More mass increases the chance of a target gibbing, but neither of these are perfect/relevant solutions. As dragon said, a script could be used, however I do wish people would look into how to actually implement these things before posting. The script would look something like this: Code: function Update(self) local targetID = SceneMan:CastMORay(self.Pos,((self.Vel / self.Vel.Magnitude)*20),0,0,false,5) -- cast a ray ahead of yourself if targetID ~= nil and targetID ~= 255 then local dist = SceneMan:ShortestDistance(MovableMan:GetMOFromID(MovableMan:GetRootMOID(targetID)).Pos, self.Pos, true).Magnitude; if dist < 40 then -- if whatever is in front of you is less than 40 px ahead MovableMan:GetMOFromID(MovableMan:GetRootMOID(targetID)):GibThis() -- gib it self.ToDelete = true --and delete yourself end end end end You'll want to put some things like transfer of velocity and impulses into the script, to make it more dramatic, but this should work (untested, check the console with the ~ button for errors) Okay, mayby i'm just not that good at this and am missing somthing obvious, but how would one implement such a script? would it be a different file or somthing. I'm pretty much clueless here.
|
Thu Mar 25, 2010 4:01 am |
|
|
dragonxp
Joined: Wed Sep 09, 2009 3:16 am Posts: 3032 Location: Somewhere in the universe
|
Re: Gib-Target
scottsman wrote: Geti wrote: Oh god we need a new rule about those posting in these help threads, and them knowing what they're talking about. More sharpness increases the chance of wounding (and after that the chance of it punching through the back side) and more mass increases the kinetic force/impulse applied. More mass increases the chance of a target gibbing, but neither of these are perfect/relevant solutions. As dragon said, a script could be used, however I do wish people would look into how to actually implement these things before posting. The script would look something like this: Code: function Update(self) local targetID = SceneMan:CastMORay(self.Pos,((self.Vel / self.Vel.Magnitude)*20),0,0,false,5) -- cast a ray ahead of yourself if targetID ~= nil and targetID ~= 255 then local dist = SceneMan:ShortestDistance(MovableMan:GetMOFromID(MovableMan:GetRootMOID(targetID)).Pos, self.Pos, true).Magnitude; if dist < 40 then -- if whatever is in front of you is less than 40 px ahead MovableMan:GetMOFromID(MovableMan:GetRootMOID(targetID)):GibThis() -- gib it self.ToDelete = true --and delete yourself end end end end You'll want to put some things like transfer of velocity and impulses into the script, to make it more dramatic, but this should work (untested, check the console with the ~ button for errors) Okay, mayby i'm just not that good at this and am missing somthing obvious, but how would one implement such a script? would it be a different file or somthing. I'm pretty much clueless here. Somewhere in your MOPixel script, put ScriptPath = [YourGun].rte/GibTarget.Lua Make a .txt document, paste the script inside it and save as a .Lua file.
|
Thu Mar 25, 2010 4:18 am |
|
|
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
Re: Gib-Target
Try not to quote a large volume of text when making a small reply, but yes, it would be another file. Basically, open notepad (or notepad++ if you have it, very good program for scripting), make a new file, paste that in and save it as (make sure "all files" is selected down the bottom) bulletscript.lua in you gun's folder, or anywhere in your .rte really. this will save it as a lua script that the game can read. Now, add into your particle definition (eg. "AddAmmo = MOPixel") a line that says "ScriptPath = <yourrtename>.rte/<path to where you saved the script here>/bulletscript.lua" minus quotes, and it should work. If not, I've made a typo somewhere, or you have. If I have, it'll cause problems in game. If you have, it'll either crash or print an error to the console (which you can check at any point with the ~ button)
|
Thu Mar 25, 2010 4:42 am |
|
|
|
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
|
|