Raised This Month: $12 Target: $400
 3% 

Solved Precache Models, Materials and Sound for replacing weapon model


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
RumbleFrog
Great Tester of Whatever
Join Date: Dec 2016
Location: Fish Tank
Old 03-19-2017 , 22:24   Precache Models, Materials and Sound for replacing weapon model
Reply With Quote #1

I have the following directory structures, how would I go about caching these and replace a weapon's model with it? It uses custom materials as well.

I've tried SetEntityModel() but no luck with that.

Code:
|
|   
+---materials
|   +---models
|   |   \---weapons
|   |       \---c_items
|   |               c_motor_flaregun.vmt
|   |               c_motor_flaregun.vtf
|   |               c_motor_flaregun_balloon.vtf
|   |               c_motor_flaregun_balloon_orange.vtf
|   |               c_motor_flaregun_c_flaregun_shell.vmt
|   |               c_motor_flaregun_c_flaregun_shell.vtf
|   |               c_motor_flare_shiny.vmt
|   |               
|   \---vgui
|       \---replay
|           \---thumbnails
+---models
|   \---weapons
|       +---c_models
|       |   +---c_flaregun_pyro
|       |   |       c_flaregun_pyro.dx80.vtx
|       |   |       c_flaregun_pyro.dx90.vtx
|       |   |       c_flaregun_pyro.mdl
|       |   |       c_flaregun_pyro.sw.vtx
|       |   |       c_flaregun_pyro.vvd
|       |   |       
|       |   \---c_motor_flaregun
|       |           c_motor_flaregun.dx80.vtx
|       |           c_motor_flaregun.dx90.vtx
|       |           c_motor_flaregun.mdl
|       |           c_motor_flaregun.sw.vtx
|       |           c_motor_flaregun.vvd
|       |           
|       \---w_models
|               w_flaregun_shell.dx80.vtx
|               w_flaregun_shell.dx90.vtx
|               w_flaregun_shell.mdl
|               w_flaregun_shell.sw.vtx
|               w_flaregun_shell.vvd
|               
\---sound
    \---weapons
            flaregun_shoot.wav
            flaregun_shoot_crit.wav

Last edited by RumbleFrog; 03-20-2017 at 19:40.
RumbleFrog is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 03-20-2017 , 00:30   Re: Precache Models, Materials and Sound for replacing weapon model
Reply With Quote #2

This is for the models and sounds but I don't know what to do with the materials.
PHP Code:
PrecacheModel("models/weapons/c_models/c_flaregun_pyro/c_flaregun_pyro.mdl"true);
PrecacheModel("models/weapons/c_models/c_motor_flaregun/c_motor_flaregun.mdl"true);
PrecacheModel("models/weapons/w_models/w_flaregun_shell.mdl"true);

PrecacheSound("sound/weapons/flaregun_shoot.wav"true);
PrecacheSound("sound/weapons/flaregun_shoot_crit.wav"true); 
cravenge is offline
RumbleFrog
Great Tester of Whatever
Join Date: Dec 2016
Location: Fish Tank
Old 03-20-2017 , 06:39   Re: Precache Models, Materials and Sound for replacing weapon model
Reply With Quote #3

Quote:
Originally Posted by cravenge View Post
This is for the models and sounds but I don't know what to do with the materials.
PHP Code:
PrecacheModel("models/weapons/c_models/c_flaregun_pyro/c_flaregun_pyro.mdl"true);
PrecacheModel("models/weapons/c_models/c_motor_flaregun/c_motor_flaregun.mdl"true);
PrecacheModel("models/weapons/w_models/w_flaregun_shell.mdl"true);

PrecacheSound("sound/weapons/flaregun_shoot.wav"true);
PrecacheSound("sound/weapons/flaregun_shoot_crit.wav"true); 
Thanks, any idea how to set the model for a weapon? I also seen PrecacheMaterial on SMLib but I never tried it
RumbleFrog is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 03-20-2017 , 06:55   Re: Precache Models, Materials and Sound for replacing weapon model
Reply With Quote #4

Unfortunately, no, unless you're talking about CS:GO, I definitely remember numerous posts about it. Look up for something like world model, view model, etc. using Search above.
cravenge is offline
RumbleFrog
Great Tester of Whatever
Join Date: Dec 2016
Location: Fish Tank
Old 03-20-2017 , 10:35   Re: Precache Models, Materials and Sound for replacing weapon model
Reply With Quote #5

Quote:
Originally Posted by cravenge View Post
Unfortunately, no, unless you're talking about CS:GO, I definitely remember numerous posts about it. Look up for something like world model, view model, etc. using Search above.
I found this: https://forums.alliedmods.net/showthread.php?t=164630 but not sure how it works, but I also found this:

Code:
new index = PrecacheModel("models/weapons/w_fire_rapier.mdl")
SetEntData(weapon, FindSendPropOffs("CBaseCombatWeapon", "m_iWorldModelIndex"), index, 4, true)
SetEntData(weapon, FindSendPropOffs("CBaseEntity", "m_nModelIndex"), index, 4, true)
But I heard it cause some problems.
RumbleFrog is offline
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 03-20-2017 , 10:47   Re: Precache Models, Materials and Sound for replacing weapon model
Reply With Quote #6

EDIT: my mistake
__________________

Last edited by Airkish; 03-20-2017 at 10:48.
Airkish is offline
RumbleFrog
Great Tester of Whatever
Join Date: Dec 2016
Location: Fish Tank
Old 03-20-2017 , 14:56   Re: Precache Models, Materials and Sound for replacing weapon model
Reply With Quote #7

Can anyone link me a plugin that could do this in TF2? Natives would be a nice bonus. I've tried TF2Items Give Weapons

Last edited by RumbleFrog; 03-20-2017 at 14:56.
RumbleFrog is offline
RumbleFrog
Great Tester of Whatever
Join Date: Dec 2016
Location: Fish Tank
Old 03-20-2017 , 19:40   Re: Precache Models, Materials and Sound for replacing weapon model
Reply With Quote #8

Never mind, I totally forgot about Valve's policy on attachments.
RumbleFrog is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:44.


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