View Single Post
Author Message
Qtheman
Junior Member
Join Date: Oct 2010
Old 10-19-2020 , 02:52   [L4D2] Find entities/models attached to survivors?
Reply With Quote #1

Okay, how to explain this...

Well, I posted my Weapon Skin Manager plugin a few days ago, and as I mentioned in the post, there's a bug I'm aware of with defibrillators - namely, the defib-sans-paddles model doesn't get the correct skin, it just resets to the default when equipped.

I don't know if that makes sense, so to explain: if there's a defib with skin 1 on the ground and a survivor picks it up, then it'll have skin 1 applied while on their back (holstered), or if they drop it in exchange for a first aid kit or whatever. However, when they actually equip it, the model on their back resets to skin 0 (the default), while the paddles they hold use skin 1 as they're supposed to.
As far as I'm aware, this bug only applies to the defibrillator. I suspect there might be a somewhat similar bug with ammo upgrades using their default skin when deployed, but I haven't had much chance to look into that yet (and even then, I have an idea as to how I might go about fixing it).

I will admit up-front that I don't know if it's the best approach, or even a good one, but the way I was hoping to fix this was by first saving each client's current defib skin to an array, and then, when a defib is brought out, to find the back (paddle-less) model via modelname, get its owner's/parent's (whatever the term would be here) client ID, and use that to select which array entry to use for its skin.

Of course, this was before I realized I can't figure out how to find entities by their modelname, or if it's even possible...
Is there some method I could use to do that? Or, alternatively, is there a way to get information on the models attached to a survivor's body? I assume there's both the "defibrillator weapon" entity and an "attachment" entity at work in this scenario, seeing as there are two distinct models when a player has the defib out, but I'm not sure where to start looking.

Thanks.
__________________
KyuuGryphon

Last edited by Qtheman; 10-20-2020 at 21:18. Reason: problem solved, thanks everyone :)
Qtheman is offline