Jump to content

[Solved] Shooting myself


Angelwolf
 Share

Recommended Posts

I have just noticed a very, very strange bug in my game which also appears to be affecting some of my other games.

 

If I run and shoot (especially with the shotgun from the FPS Weapons Pack) then I actually shoot and injure myself. The faster the player move speed, the more the damage. With a run speed of 5, 50hp is removed from the player.

 

I don't understand why or how this is happening. I'm completely clueless. I have tried using the original player FPS script, have tried loading the player prefab back in etc. Can't seem to get it to work normally.

 

Has this happened to anyone else?

Link to comment
Share on other sites

Ok, after pulling my hair out for hours and hours, I finally figured out what was causing this. And I honestly have no idea why, because it doesn't make sense.

 

A directional light.

 

Deleting the directional light fixed everything. I don't know why, but it did. Now... where did I leave my whisky?

Link to comment
Share on other sites

Whoa that is the most interesting bug of all time. It would be easily fixable just by checking to make sure the hit object isn't the player himself.

  • Upvote 2

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Nothing should hit the player if SetPickInfo is 0. but I can see in cases where you want things to shoot at you.

 

Yeah, the way you'd go around this is make a collision type that hits everything but the player, and have your pick function use that.

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

My first solution attempt at this was to make the person firing the projectile to me immune from it, but my limited coding knowledge meant I couldnt quite work it out. The speed issue mentioned by nick.ace is definitely plausable; since removing the directional light the fps has increased.

Link to comment
Share on other sites

I have the same issue and have for some time. Just haven't got around to trying to figure it out. I am using the FPS Pack from the store. It seems to have started around the time the Merc came out. The Shot Gun hurt's sad.png a lot. I have actually used it to kill me testing re-spawn code. I was my own enemy.

 

Maybe the hitbox is intersecting with the bullet. Possible that the pick point is too close to player hitbox, rotation or speed related? Haven't had time to try to figure it out, this never used to happen to me. I thought maybe it was just some bug I created but it happens with clean install, new project and very randomly.

 

 

BTW loving leadwerks, runs like butter on my machine. So quiet.

 

People who purchased the weapon pack and die by their own weapon may not be to happy.

I will keep an eye on the post's. I know the say's solved but, re-coding the dlc weapons you just bought to use them would have to suck. Especially if you are just getting started and you just bought them. Just sayin.

Link to comment
Share on other sites

Angelwolf, Just tried re- moving light and I still shoot myself. I have child pivots for HUD and game info. I will try moving and removing those next. It seems to occur mostly on first firing gun. Had dropped the vwep prefab into the scene in the past and it seemed to help, but I can still shoot myself. Maybe this will be my focus today.

Link to comment
Share on other sites

just checked an old script and didn't shoot myself. Further investigation shows hitbox for bullets at line 177, FPSPlayer script.

if I translate the zed axis value negitive (-1) I can't seem to be able to shoot myself and the merc can still kill me. I usually do not change the original scripts that come Leadwerks I make a copy so I have reference if I mess up. I changed this line at 181

hitbox:Translate(0,0.9,-1)

 

--Hitbox for bullets

self.entity:SetCollisionType(Collision.Character)

local hitbox = Model:Box(0.5,1.8,0.5)

hitbox:SetPosition(self.entity:GetPosition())

hitbox:Translate(0,0.9,-1)

hitbox:SetParent(self.entity,true)

hitbox:SetCollisionType(Collision.Prop)

hitbox:SetShadowMode(0)

  • Upvote 2
Link to comment
Share on other sites

Increasing your move speed still can effect this though. so 0.5 works with a 2.5 move speed so you may have to adjust this if you require higher speeds. Just implementing a check like they said above is the better choice but for someone with little coding knowledge this is a quick work around.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...