View unanswered posts | View active topics It is currently Wed Jul 26, 2017 11:40 am



Reply to topic  [ 10 posts ] 
 Allowing projectiles to pass through weapons 
Author Message
User avatar

Joined: Sun Dec 09, 2007 3:08 pm
Posts: 481
Location: Islamic Republic of Bradistan, Yorkshire, England
Reply with quote
Post Allowing projectiles to pass through weapons
It's been a long time since I last played til recently, one thing that always got on my nerves is how weapons are basically an extra layer of armour for the body holding it. Is there a variable I can change for each weapon allowing bullets to pass through them? Even better if it were chance based depending on the size of the sprite, but that'd be wishful thinking.


Tue Dec 06, 2016 2:43 pm
Profile
User avatar

Joined: Fri Sep 13, 2013 1:39 am
Posts: 148
Location: ᴱᵛᵉʳʸʷʰᵉʳᵉ
Reply with quote
Post Re: Allowing projectiles to pass through weapons
Morbo!!! wrote:
It's been a long time since I last played til recently, one thing that always got on my nerves is how weapons are basically an extra layer of armour for the body holding it. Is there a variable I can change for each weapon allowing bullets to pass through them? Even better if it were chance based depending on the size of the sprite, but that'd be wishful thinking.


Well both things of what you say are correct. Changing sprite to something small makes it harder to hit, Making it null is practically non-hittable.
Though... Changing sprite may bring dissatisfaction and there is an easier way to achieve this without changing the sprites.

In any ".ini" you can change this simple line from 1 to 0 and you will get your desired outcome, at "HDFirearm". Note that this also changes so that you cannot shoot it while it is sitting on the ground either.
Code:
   GetsHitByMOs = 0


Ofcourse you'd have to locate the .ini for the weapon you are changing.


Tue Dec 06, 2016 8:55 pm
Profile
User avatar

Joined: Mon Oct 11, 2010 1:15 pm
Posts: 574
Location: Finlandia
Reply with quote
Post Re: Allowing projectiles to pass through weapons
I've tried making a Global Script that makes all weapons ignore MOs but it makes a ton of scripts malfunction, so it's not a viable way to do it.


Tue Dec 06, 2016 9:51 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 7411
Location: Here
Reply with quote
Post Re: Allowing projectiles to pass through weapons
4zK wrote:
I've tried making a Global Script that makes all weapons ignore MOs but it makes a ton of scripts malfunction, so it's not a viable way to do it.


^^^^^

A large number of scripted weapons need to find the gun, and rely on the gun being GetsHitByMOs for the projectile to effectively find it, or to easily grab the actor using it (RootID).

GetsHitByMOs = 0 makes it so the gun has no MOID, effectively breaking every scripted gun that uses MOID-based gun/actor finding.


Tue Dec 06, 2016 10:36 pm
Profile

Joined: Fri Sep 10, 2010 1:48 am
Posts: 619
Location: Halifax, Canada
Reply with quote
Post Re: Allowing projectiles to pass through weapons
You could probably do something a little more complex and make it so the gun's update script has a chance to remove wounds from itself and add them to the parent actor. There's probably no way to do this very well, but it's the closest thing to what you asked for that I can think of off the top of my head. I guess it might be better to get particles that are about to hit the gun then move them into the actor or something, so they hit the actor instead (or if there's a way to make something not collide with a specific MO that might work).
Either way it'd probably be a pretty heavy script to run on a lot of guns.


Wed Dec 07, 2016 1:48 am
Profile
User avatar

Joined: Mon Oct 11, 2010 1:15 pm
Posts: 574
Location: Finlandia
Reply with quote
Post Re: Allowing projectiles to pass through weapons
I already found a way to simulate the desired effect with a Global Script that sets the Scale value of all weapons to 0 and emits one-frame 'phantom' copies of the weapon on top of it each frame.

Even if you set Scale to 0, the offsets aren't affected, so everything functions the same apart from the hitbox being non-existent.

The only problem is that checking HFlipped doesn't seem to work and all phantom images constantly face to the right (while maintaining correct rotation etc.)

The phantom image also appears behind the parent actor since they aren't technically its' parent, but it's a purely aesthetic issue, like the latter.

I'll be updating my Global Script mod soon.


Wed Dec 07, 2016 1:52 pm
Profile
User avatar

Joined: Sun May 30, 2010 5:30 am
Posts: 851
Location: Auckland, NZ
Reply with quote
Post Re: Allowing projectiles to pass through weapons
Have the gun's sprite be 1x1 pixel with a GetsHitByMOs = 0 attachable with the proper sprite.


Thu Dec 08, 2016 1:54 am
Profile
User avatar

Joined: Mon Oct 11, 2010 1:15 pm
Posts: 574
Location: Finlandia
Reply with quote
Post Re: Allowing projectiles to pass through weapons
It seems that HFlipped isn't assigned on the frame of creation. Other than that, my Global Script works perfectly.

I've also made a variant where the Scale value of all weapons is set to 0 every second frame. It does exactly what Morbo asked for with there being a "chance" for particles to hit the weapon, and larger weapons are naturally more likely to get hit as they have a larger hitbox.

The only side-effect is that all weapons look translucent, since they're literally only "half-there."


Thu Dec 08, 2016 1:25 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 7411
Location: Here
Reply with quote
Post Re: Allowing projectiles to pass through weapons
4zK wrote:
It seems that HFlipped isn't assigned on the frame of creation. Other than that, my Global Script works perfectly.

I've also made a variant where the Scale value of all weapons is set to 0 every second frame. It does exactly what Morbo asked for with there being a "chance" for particles to hit the weapon, and larger weapons are naturally more likely to get hit as they have a larger hitbox.

The only side-effect is that all weapons look translucent, since they're literally only "half-there."


Could you spawn duplicates of the weapons but make them GetsHitByMOs = 0 and position them over the flip-flopping Scale guns that last more than one frame?

Would have to have a bit of tracking to check when the guns are put away in inventory/destroyed, but would look better.


Thu Dec 08, 2016 2:31 pm
Profile
User avatar

Joined: Mon Oct 11, 2010 1:15 pm
Posts: 574
Location: Finlandia
Reply with quote
Post Re: Allowing projectiles to pass through weapons
I thought about doing something like that, but it's a pain to track a MO like that through a Global Script. It's still probably doable though, spawning copies with a lifetime of one frame just seemed like an easier way to do it.


Thu Dec 08, 2016 2:41 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 10 posts ] 

Who is online

Users browsing this forum: brireezn, expakeria, Hilknata


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.028s | 18 Queries | GZIP : Off ]