Data Realms Fan Forums
http://45.55.195.193/

Gib-Target
http://45.55.195.193/viewtopic.php?f=1&t=18173
Page 1 of 2

Author:  scottsman [ Fri Mar 19, 2010 2:41 am ]
Post subject:  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.

Author:  salt_1219 [ Fri Mar 19, 2010 8:54 pm ]
Post subject:  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.

Author:  dragonxp [ Fri Mar 19, 2010 11:18 pm ]
Post subject:  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.

Author:  Geti [ Sat Mar 20, 2010 12:06 am ]
Post subject:  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)

Author:  salt_1219 [ Sat Mar 20, 2010 8:02 am ]
Post subject:  Re: Gib-Target

Okay sorry I just suggested how I would have done it.

Author:  411570N3 [ Sat Mar 20, 2010 8:13 am ]
Post subject:  Re: Gib-Target

He was referring to Dragonxp and the fact that his suggestion couldn't work. Ever.

Author:  Geti [ Sat Mar 20, 2010 10:31 am ]
Post subject:  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 :P You'll just end up with a crapton of terrain rape.

Author:  Lizardheim [ Sat Mar 20, 2010 12:40 pm ]
Post subject:  Re: Gib-Target

You can ofcourse, have it be loads of bullets, like the dummy rail pistol.

Author:  Commodore111 [ Sun Mar 21, 2010 7:06 am ]
Post subject:  Re: Gib-Target

I think 999999999999 mass and an AEmitter that launcher the projectile would suffice. And 0 sharpness to prevent extreme terrain grape.

Author:  411570N3 [ Sun Mar 21, 2010 7:12 am ]
Post subject:  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.

Author:  Geti [ Sun Mar 21, 2010 8:00 am ]
Post subject:  Re: Gib-Target

fffuu- guys the script is there, no need to confuse the man.

Author:  411570N3 [ Sun Mar 21, 2010 8:02 am ]
Post subject:  Re: Gib-Target

Yeah, geti's script is what you should use. Our alternatives are better suited to other things.

Author:  scottsman [ Thu Mar 25, 2010 4:01 am ]
Post subject:  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.

Author:  dragonxp [ Thu Mar 25, 2010 4:18 am ]
Post subject:  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.

Author:  Geti [ Thu Mar 25, 2010 4:42 am ]
Post subject:  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)

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