How do i reference a variable or specific component just from the HitActor of a breakhit?

anonymous_user_337b3f61
Wed, 17 Apr 2019 14:53:54 +0000
Mobile

Hello.
Im wanting to get a reference to a variable from only a “hitactor”.
This is because im wanting a gun system that has most of the shooting side on the player, but is able to recieve the gun stats (damage, recoil, firerate, etc) by simply reading the guns variables.
Ive already got a gun grabbing system setup using linetracebychannel and hitactor, but i cant seem to reference any expected variables because im wanting to access whatever the hit actor is, not any one specific gun.
I also am needing help figuring out how to reference a specificly named component from just the hitactor of a breakhit.
IE: Every gun of mine has a piece called “muzzle”. Im wanting to spawn my bullet at the muzzle of whatever one im currently holding. I already have setup a bool for if i currently am holding a gun, and i have the hitactor of the one im holding, but i dont know how to properlly reference this info in the character blueprint.
I cant just do a normal cast, as that would specify one specific blueprint in the game, rather than whatever gun i happen to be holding.

Example:
Player picks up FN FAL, and their character recieves all of the variables needed from the gun itsself (firerate, damage, etc). The bullets are then spawned with those stats at the grabbed FN FAL’s muzzle.
The player can then drop the gun, and grab an MPX. The variables are grabbed from the MPX, the player blueprint processes them and does the firing, but is able to spawn the bullets at the MPX’s muzzle.

This would allow for a system where i can set up any gun i want and all i need is just to set it up to the trace channel (in this case GunPickup) and to put the variables in the gun. The same could be said for firemodes, i can just setup the firemodes and have bool’s in the guns themselves saying if full, semi, or burst are enabled.

This would make for a very information light (the vast majority of coding is in a single character as opposed to being stored in each gun), very easy to setup system where things could be removed, added, and edited incredibly easily, the only problem being, as i said, it seems i cant reference a blueprint’s variables simply from its Hitactor, nor can i do that for components.

14 posts - 1 participant