AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved [TF2] tf_ragdoll -> issues with m_flModelScale, also general loadout change issues (https://forums.alliedmods.net/showthread.php?t=295454)

404UserNotFound 03-26-2017 01:51

[TF2] tf_ragdoll -> issues with m_flModelScale, also general loadout change issues
 
I've been screwing around with ragdolls. I've got what I set out to create working beautifully, other than two issues (one minor, one major).

The minor issue is that I can't seem to set m_flModelScale on a tf_ragdoll entity I've created.
- SetEntPropFloat results in "tf_ragdoll doesn't have m_flModelScale" nonsense which Google has shown me may be a result of something to do with EntIndexToEntRef
- Using AcceptEntityInput to set SetModelScale results in "Entity is not a CBaseEntity"

The major issue is that for some reason, loadout changes completely stop functioning on my test server after a while. With a lot of help from Pelipoika, I figured out m_hRagWearables and have been successfully spawning ragdolls that have the same cosmetics as the player and also respect the player's current hand/torso/head scale (m_flModelScale was the last thing I wanted to get working).

So those are my 2 problems.

Spoiler below contains my testing plugin. I figure it'll potentially help someone out with something. For example, that "unused burning death animations" plugin that was created from a snippet I put out, the wearables stuff would be perfect for that plugin. Aside from the aforementioned 2 issues, the plugin works like a charm. I've already got plans for this code including using it to update the tf_ragdolls in my Roll The Dice to respect the player's wearables/scale for "Freeze" and my custom "Midas Touch" RTD perk. It'd also be useful for the sm_freeze command as a better alternative to "color the player blue" and it'd definitely be useful for this plugin.

Please don't be too harsh on my formatting style and how I did things. It's just a private testing plugin that is acting as the launchpad for a few ideas I have.

NOTE: The "sm_rag" command in the plugin below doesn't just create a ragdoll where you are with your cosmetics; it turns you entirely invisible, blocks all attacking and sets you to MOVETYPE_NONE. Think of it as a TF2 version of a Garry's Mod "Ragdoll a player" command. The firstperson view when you're "ragdolled" isn't the best (you're practically inside the ragdoll). Probably because of my stupid fuckin' usage of SetClientViewEntity and AcceptEntityInput on "SetForcedTauntCam" at the same time.

Spoiler

Benoist3012 03-26-2017 05:53

Re: [TF2] tf_ragdoll -> issues with m_flModelScale, also general loadout change issue
 
Funny thing is that I've also worked on custom ragdoll a while back, your loadout problem is simply from the netprop you mention in your code.
Code:
m_hRagWearables
http://steamcommunity.com/sharedfile.../?id=597605825
As you can see there, I attached my cosmetics to a custom ragdoll (not tf_ragdoll), but upon respawning I couldn't get my wearable back, and that's simply because they were on the ragdoll. However deleting the ragdoll (and so the wearables with it), I could respawn with my wearables, but then you may tell me, during your tests the ragdoll wasn't no longer there and so the wearables, but as you know the ragdoll is client-side handled, so it can disappear on your end, but the entity used to create it (tf_ragdoll), is still there on the server. So a fix to that would be to delete the tf_ragdoll entity upon re-spawning, and I'm pretty sure it's what the game does, and deleting the tf_ragdoll entity won't delete the ragdoll on client's end, the client will decide whenever it should be deleted.

But either way, your current approach of setting wearables is wrong, in SF2 upon replacing ragdoll to dispatch desired death effects, the ragdoll is set under that netprop on the client: SetEntPropEnt(client, Prop_Send, "m_hRagdoll", ent, 0);(it doesn't matter when you set it, as long it's in the same frame as the creation of the ragdoll entity).
And it automatically adds the wearables on client's end, and the game will also delete the tf_ragdoll entity whenever it's needed.

Now about the model scale, I doubt there's any way to set it, CTFRagdoll has m_flModelScale as datamap, but it means that it's not networked so it's pretty much useless. You can try it, but I doubt you'll get anything from it.

404UserNotFound 03-26-2017 09:29

Re: [TF2] tf_ragdoll -> issues with m_flModelScale, also general loadout change issue
 
Your image is dead. Also, shit. So let me get this clear: Set SetEntPropEnt(client, Prop_Send, "m_hRagdoll", ent, 0); is essentially setting my ragdoll to be the iRagdoll entity I'm creating? Sweeeet. So I don't even have to mess with m_hMyWearables or m_hRagWearables?


All times are GMT -4. The time now is 17:33.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.