[SNIPPET][CSS]custom viewmodels without flickers and without disabling prediction
PHP Code:
this snippet changes the ump45 viewmodel to the p90 and the mp5 viewmodel to the tmp. i stuck the 2nd weapon code in there last minute just so you could see how it was done, that needs recoding a bit since theres a lot of duplicate code. in css each client gets 2 viewmodel entities, one seems to be unused from what i could tell so i just use that as a proxy. the unused viewmodel isn't predicted so clients with high pings will get delays before animations are played. the code handle spectators aswell (thanks to GoD-Tony for mentioning a way to get it to work). in the thread mentioned above there is a snippet for world models but its not worth it because the model won't change when its on the ground or on the players back, also if the players weapon changes serverside which wasn't done on the client e.g weapon drop/pickup the weapon becomes invisible. as long as the custom model has the same number of animations as the original, all custom animations have the same names as those in the original and the custom animations are the same length as the originals things will work fine otherwise you get animation glitches and such. this snippet(modified) may work in other games if they also give clients an unused viewmodel, tf2 uses an extra one for the spies cloak activating/deactivating hand. in the sdk code clients can only have a maximum of 2 viewmodels, it may be different for hl2 mods and games may have their own maximum defined. if clients haven't got the maximum number of viewmodels you can create a new one using an sdk call on the player using berni's virtual offset dumper look for CreateViewModel(int). the parameter is an index for how many viewmodels the client has, "m_nViewModelIndex" on the viewmodel stores its index, if the client has one viewmodel, its index will be 0, if they have 2 one will be 0 and the other 1 like an array. so to create a 2nd viewmodel you want to use an index of 1, 2 for a 3rd etc. |
Re: [SNIPPET][CSS]custom viewmodels without animation glitches or disabled prediction
very nice, so the problem why it didnt work for you the first time is that you created a new entity instead using the unused one? nice find indeed
|
Re: [SNIPPET][CSS]custom viewmodels without flickers and without disabling prediction
yeah, it would have been better if the new one worked cause i have no idea what the so called unused one is for. i'm guessing any more than the maximum not created with CreateViewModel(this checks if the client has the maximum) don't get properly linked to the player. in the original thread the first snippet i posted i was manually creating the new viewmodel based on CreateViewModel's code without the check which is proberly why it didn't work.
|
Re: [SNIPPET][CSS]custom viewmodels without flickers and without disabling prediction
From a quick test this seems to be working great. Very nice find blodia. :up:
|
Re: [SNIPPET][CSS]custom viewmodels without flickers and without disabling prediction
Great! Enormous Thanks!!
|
Re: [SNIPPET][CSS]custom viewmodels without flickers and without disabling prediction
seems like DODS didnīt like it , I got this errors:
Quote:
|
Re: [SNIPPET][CSS]custom viewmodels without flickers and without disabling prediction
looks like you only have one viewmodel, try the sdkcall mentioned in the first post with 1 as the parameter, if it still doesn't work then it means you can only have one viewmodel in dods.
|
Re: [SNIPPET][CSS]custom viewmodels without flickers and without disabling prediction
|
Re: [SNIPPET][CSS]custom viewmodels without flickers and without disabling prediction
I have problem with hands animation ("m_nSequence"), than hit to wall or something animations works, because m_nSequence randomly changes to 2,4,5... but if you hitting nothing, just slashing air, m_nSequence returns 3 every time, so animation stuck.. So you need wait after m_nSequence return 0 and than press one time left (or right) mouse button, and again wait... if dont wait.. animation stuck.... ;/
|
Re: [SNIPPET][CSS]custom viewmodels without flickers and without disabling prediction
m_nSequence is the animation played so it changes whenever an animation is played. to me seems the model you're using doesn't have all the animations or same animation names.
m_nSequence is an enumeration of all the animations compiled in the model, from what i can tell 0 is the idle animation, i'm not sure how the rest are listed. as i mentioned in the first post your custom model must have the same number of animations or with will edit glitches when the game tries to play animations that aren't there, same issue if the names don't match as the game plays animations by name. if the custom model animations are too long they will get cut short when another animation begins or if they're too short you will get pauses before the next one e.g reload animation will finish but the gun hasn't reloaded yet. |
All times are GMT -4. The time now is 15:48. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.