View unanswered posts | View active topics It is currently Wed Jan 08, 2025 10:24 pm



Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
 Gib-Target 
Author Message

Joined: Thu Dec 31, 2009 9:31 am
Posts: 30
Reply with quote
Post 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
Profile
User avatar

Joined: Tue Jan 12, 2010 8:25 pm
Posts: 400
Location: mukilteo, wa
Reply with quote
Post 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
Profile
User avatar

Joined: Wed Sep 09, 2009 3:16 am
Posts: 3032
Location: Somewhere in the universe
Reply with quote
Post 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
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post 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
Profile WWW
User avatar

Joined: Tue Jan 12, 2010 8:25 pm
Posts: 400
Location: mukilteo, wa
Reply with quote
Post Re: Gib-Target
Okay sorry I just suggested how I would have done it.


Sat Mar 20, 2010 8:02 am
Profile
User avatar

Joined: Wed Jan 07, 2009 10:26 am
Posts: 4074
Location: That quaint little British colony down south
Reply with quote
Post 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
Profile WWW
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post 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.


Sat Mar 20, 2010 10:31 am
Profile WWW
DRL Developer
DRL Developer

Joined: Fri May 15, 2009 10:29 am
Posts: 4107
Location: Russia
Reply with quote
Post Re: Gib-Target
You can ofcourse, have it be loads of bullets, like the dummy rail pistol.


Sat Mar 20, 2010 12:40 pm
Profile

Joined: Sun Oct 11, 2009 7:47 pm
Posts: 132
Reply with quote
Post 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
Profile WWW
User avatar

Joined: Wed Jan 07, 2009 10:26 am
Posts: 4074
Location: That quaint little British colony down south
Reply with quote
Post 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
Profile WWW
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Gib-Target
fffuu- guys the script is there, no need to confuse the man.


Sun Mar 21, 2010 8:00 am
Profile WWW
User avatar

Joined: Wed Jan 07, 2009 10:26 am
Posts: 4074
Location: That quaint little British colony down south
Reply with quote
Post 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
Profile WWW

Joined: Thu Dec 31, 2009 9:31 am
Posts: 30
Reply with quote
Post 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
Profile
User avatar

Joined: Wed Sep 09, 2009 3:16 am
Posts: 3032
Location: Somewhere in the universe
Reply with quote
Post 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
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post 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
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 16 posts ]  Go to page 1, 2  Next

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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.064s | 14 Queries | GZIP : Off ]