Raised This Month: $52 Target: $400
 13% 

[TF2] Custom Weapons 3 (Beta 2)


Post New Thread Reply   
 
Thread Tools Display Modes
Old Bill
Junior Member
Join Date: Jun 2020
Old 08-01-2020 , 10:29   Re: [TF2] Custom Weapons 3 (Beta 2)
Reply With Quote #251

Quote:
I made an attribute that would replace the projectile of a demoman's pipe with a custom one. It is just fine, the model path is passed from the weapon's configuration file and it sets the projectile to it but the strangest thing is that the bool variable that sets the attribute true never go false (or be destroyed with OnEntityDestroyed) it just stays true after you change the weapon.

https://pastebin.com/KZrRwNVv

I believe it has something to do with projectiles being created over and over so it messes up the index or something. Maybe it has something to do with, maybe EntIndexToEntRef???
Fixed, I needed to use iWeapon instead of iClient for the variable and used this function to check if the attribute is present

https://pastebin.com/c7Wi42a8

Last edited by Old Bill; 08-01-2020 at 22:10.
Old Bill is offline
DrCactus
Junior Member
Join Date: Mar 2013
Old 08-06-2020 , 05:17   Re: [TF2] Custom Weapons 3 (Beta 2)
Reply With Quote #252

Hello. I've run into a bit of a snag with my server and the plugin.
I've been trying to get custom view models for weapons working, but haven't had much success, and I just get very zoomed out stock models.

I understand we can't have world models, but it would be nice to have viewmodels for players. Also, is it possible to not make them zoomed out?

I am using the afterburner as a base, as well as the "firkin flamer" model
(this is only because these are the ones I have on hand at the moment, and just needed something quick to test out, and will be using a different model and make my own weapon later)

here is a slightly abbreviated version of Pryo_1_Afterburner.txt

Code:
"Test"
{
	"classes"
	{
		"pyro"	"0"
	}
	"baseclass"	"flamethrower"
	"baseindex"	"21"
	"nobots"	"1"
	"quality"	"6"
	"logname"	"test"
	"description"	"test"
	"attributes"
	{
		"damage penalty"
		{
			"plugin"	"tf2attributes"
			"value"	"0.5
		}
	}
	"viewmodel" // Custom viewmodel.
	{
		"modelname"		"models/weapons/c_models/c_firkin_flamer/c_firkin_flamer.mdl" // Location of the viewmodel file.
	}
}

Last edited by DrCactus; 08-06-2020 at 06:45.
DrCactus is offline
Old Bill
Junior Member
Join Date: Jun 2020
Old 08-09-2020 , 09:00   Re: [TF2] Custom Weapons 3 (Beta 2)
Reply With Quote #253

Quote:
Originally Posted by DrCactus View Post
Hello. I've run into a bit of a snag with my server and the plugin.
I've been trying to get custom view models for weapons working, but haven't had much success, and I just get very zoomed out stock models.

I understand we can't have world models, but it would be nice to have viewmodels for players. Also, is it possible to not make them zoomed out?

I am using the afterburner as a base, as well as the "firkin flamer" model
(this is only because these are the ones I have on hand at the moment, and just needed something quick to test out, and will be using a different model and make my own weapon later)

here is a slightly abbreviated version of Pryo_1_Afterburner.txt

Code:
"Test"
{
	"classes"
	{
		"pyro"	"0"
	}
	"baseclass"	"flamethrower"
	"baseindex"	"21"
	"nobots"	"1"
	"quality"	"6"
	"logname"	"test"
	"description"	"test"
	"attributes"
	{
		"damage penalty"
		{
			"plugin"	"tf2attributes"
			"value"	"0.5
		}
	}
	"viewmodel" // Custom viewmodel.
	{
		"modelname"		"models/weapons/c_models/c_firkin_flamer/c_firkin_flamer.mdl" // Location of the viewmodel file.
	}
}


Actually you can have both custom world and view models, but I think your problem is with the model itself. I believe the model you are trying to use has custom animations which are not supported. Only c_models are, which have just the (weapon body model)

PHP Code:

        
"viewmodel"
    
{
        
"modelname"        "path/path/path"
    
}
            
"worldmodel"
    
{
        
"modelname"        "path/path/path"
    

This one worked for me, https://steamcommunity.com/sharedfil.../?id=741236065

Last edited by Old Bill; 08-09-2020 at 09:05.
Old Bill is offline
DrCactus
Junior Member
Join Date: Mar 2013
Old 08-10-2020 , 18:48   Re: [TF2] Custom Weapons 3 (Beta 2)
Reply With Quote #254

Quote:
Originally Posted by Old Bill View Post
Actually you can have both custom world and view models, but I think your problem is with the model itself. I believe the model you are trying to use has custom animations which are not supported. Only c_models are, which have just the (weapon body model)

PHP Code:

        
"viewmodel"
    
{
        
"modelname"        "path/path/path"
    
}
            
"worldmodel"
    
{
        
"modelname"        "path/path/path"
    

This one worked for me, https://steamcommunity.com/sharedfil.../?id=741236065
Decided to give it a shot, and I still get the missing model issue, where the model is invisible.
This is the code I am currently using
Code:
"Test"
{
	"classes"
	{
		"pyro"	"0"
	}
	"baseclass"	"flamethrower"
	"baseindex"	"21"
	"nobots"	"1"
	"quality"	"6"
	"logname"	"afterburner"
	"description"	"test"
	"attributes"
	{
		"weapon_allow_inspect"
		{
			"plugin"	"tf2attributes"
			"value"		"1"
		}
	}
    "viewmodel"
    {
		"modelname"        "weapons/c_models/c_explothrower/c_explothrower.mdl"
    }
    "worldmodel"
    {
        "modelname"        "weapons/c_models/c_explothrower/c_explothrower.mdl"
    } 
}

Last edited by DrCactus; 08-10-2020 at 19:18.
DrCactus is offline
Old Bill
Junior Member
Join Date: Jun 2020
Old 08-11-2020 , 03:10   Re: [TF2] Custom Weapons 3 (Beta 2)
Reply With Quote #255

Quote:
Originally Posted by DrCactus View Post
Decided to give it a shot, and I still get the missing model issue, where the model is invisible.
This is the code I am currently using
Code:
"Test"
{
	"classes"
	{
		"pyro"	"0"
	}
	"baseclass"	"flamethrower"
	"baseindex"	"21"
	"nobots"	"1"
	"quality"	"6"
	"logname"	"afterburner"
	"description"	"test"
	"attributes"
	{
		"weapon_allow_inspect"
		{
			"plugin"	"tf2attributes"
			"value"		"1"
		}
	}
    "viewmodel"
    {
		"modelname"        "weapons/c_models/c_explothrower/c_explothrower.mdl"
    }
    "worldmodel"
    {
        "modelname"        "weapons/c_models/c_explothrower/c_explothrower.mdl"
    } 
}

World or view model?, please provide a screenshot too.
Old Bill is offline
RasputinFF2
Junior Member
Join Date: Feb 2019
Old 09-08-2020 , 23:22   Re: [TF2] Custom Weapons 3 (Beta 2)
Reply With Quote #256

Where can I download custom weapons?
__________________
Hey guys, just a boss creator passing by.
RasputinFF2 is offline
torridgristle
Junior Member
Join Date: Aug 2020
Old 09-22-2020 , 12:42   Re: [TF2] Custom Weapons 3 (Beta 2)
Reply With Quote #257

In game_sounds_weapons.txt there are sounds defined that use multiple sound files, is there a way to replace a sound that uses only one sound file with a sound that uses multiple randomly chosen sound files? Like the stock Revolver with the Enforcer?
torridgristle is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 09-22-2020 , 23:58   Re: [TF2] Custom Weapons 3 (Beta 2)
Reply With Quote #258

Quote:
Originally Posted by torridgristle View Post
In game_sounds_weapons.txt there are sounds defined that use multiple sound files, is there a way to replace a sound that uses only one sound file with a sound that uses multiple randomly chosen sound files? Like the stock Revolver with the Enforcer?
You can make a plugin that replaces specific weapon sounds with something else. To replace the revolver shot sound with random enforcer sounds you can do something like this:
PHP Code:
#include <sourcemod>
#include <sdktools>

#pragma semicolon 1

public Plugin myinfo 
{
    
name "[TF2] Revolver Sound Replacement",
    
author "torridgristle",
    
description "Replaces Revolver Shooting Sounds with Enforcer Sounds",
    
version "PLUGIN_VERSION 1.0",
    
url "www.sourcemod.com"    
}

public 
OnPluginStart()
{
    
AddNormalSoundHook(SoundHook);
    
PrecacheSound("weapons/tf_spy_enforcer_revolver_01.wav");
    
PrecacheSound("weapons/tf_spy_enforcer_revolver_02.wav");
    
PrecacheSound("weapons/tf_spy_enforcer_revolver_03.wav");
    
PrecacheSound("weapons/tf_spy_enforcer_revolver_04.wav");
    
PrecacheSound("weapons/tf_spy_enforcer_revolver_05.wav");
    
PrecacheSound("weapons/tf_spy_enforcer_revolver_06.wav");
    
PrecacheSound("weapons/tf_spy_enforcer_revolver_crit.wav");    
}

public 
Action:SoundHook(clients[64], &numClientsString:sound[PLATFORM_MAX_PATH], &entity, &channel, &Float:volume, &level, &pitch, &flags)
{
    if (
StrEqual(sound"weapons/revolver_shoot.wav"))
    {
        
int iRand GetRandomInt(1,6);
        switch (
iRand)
        {
        case 
1:
            {
                
Format(soundsizeof(sound), "weapons/tf_spy_enforcer_revolver_01.wav");
                
EmitSoundToClient(entity"weapons/tf_spy_enforcer_revolver_01.wav"entity);
                return 
Plugin_Changed;
            }
        case 
2:
            {
                
Format(soundsizeof(sound), "weapons/tf_spy_enforcer_revolver_02.wav");
                
EmitSoundToClient(entity"weapons/tf_spy_enforcer_revolver_02.wav"entity);
                return 
Plugin_Changed;
            }
        case 
3:
            {
                
Format(soundsizeof(sound), "weapons/tf_spy_enforcer_revolver_03.wav");
                
EmitSoundToClient(entity"weapons/tf_spy_enforcer_revolver_03.wav"entity);
                return 
Plugin_Changed;
            }
        case 
4:
            {
                
Format(soundsizeof(sound), "weapons/tf_spy_enforcer_revolver_04.wav");
                
EmitSoundToClient(entity"weapons/tf_spy_enforcer_revolver_04.wav"entity);
                return 
Plugin_Changed;
            }
        case 
5:
            {
                
Format(soundsizeof(sound), "weapons/tf_spy_enforcer_revolver_05.wav");
                
EmitSoundToClient(entity"weapons/tf_spy_enforcer_revolver_05.wav"entity);
                return 
Plugin_Changed;
            }
        case 
6:
            {
                
Format(soundsizeof(sound), "weapons/tf_spy_enforcer_revolver_06.wav");
                
EmitSoundToClient(entity"weapons/tf_spy_enforcer_revolver_06.wav"entity);
                return 
Plugin_Changed;
            }                
        }            
    }
    if (
StrEqual(sound"weapons/revolver_shoot_crit.wav"))
    {
        
Format(soundsizeof(sound), "weapons/tf_spy_enforcer_revolver_crit.wav");
        
EmitSoundToClient(entity"weapons/tf_spy_enforcer_revolver_crit.wav"entity);
        return 
Plugin_Changed;
    }
    return 
Plugin_Continue;

Note: This plugin has not been tested so let me know if it works for you. It is supposed to replace a revolver shot sound with a randomly selected enforcer shot sound. There are six possible enforcer shot sounds. It also replaces a revolver critical shot sound with the enforcer critical shot sound. In my opinion all six of the enforcer shot sounds sounded almost identical.

Keep in mind that if you don't like the stock game sounds you can add your own sounds to the game. I added custom sounds to the Batsaber on my server to make it sound more like a lightsaber. I also changed some of the many annoying Announcer sounds such as control point warnings/flag drops/etc. to a much quieter duck quack.

Enjoy!
Attached Files
File Type: sp Get Plugin or Get Source (replacerevolversound.sp - 25 views - 2.6 KB)
PC Gamer is offline
torridgristle
Junior Member
Join Date: Aug 2020
Old 09-25-2020 , 08:06   Re: [TF2] Custom Weapons 3 (Beta 2)
Reply With Quote #259

Quote:
Originally Posted by PC Gamer View Post
You can make a plugin that replaces specific weapon sounds with something else. To replace the revolver shot sound with random enforcer sounds you can do something like this:

Note: This plugin has not been tested so let me know if it works for you. It is supposed to replace a revolver shot sound with a randomly selected enforcer shot sound. There are six possible enforcer shot sounds. It also replaces a revolver critical shot sound with the enforcer critical shot sound. In my opinion all six of the enforcer shot sounds sounded almost identical.

Keep in mind that if you don't like the stock game sounds you can add your own sounds to the game. I added custom sounds to the Batsaber on my server to make it sound more like a lightsaber. I also changed some of the many annoying Announcer sounds such as control point warnings/flag drops/etc. to a much quieter duck quack.

Enjoy!
Wow, thanks!
torridgristle is offline
torridgristle
Junior Member
Join Date: Aug 2020
Old 09-30-2020 , 19:03   Re: [TF2] Custom Weapons 3 (Beta 2)
Reply With Quote #260

How do I define the slot that a weapon should use?

I tried to make a new weapon based on Sniper's secondary SMG to use as a primary for Scout, and it was defined as "scout" "0" in the classes at the top of the config, so at the very least it appeared in the custom weapons menu as a primary for Scout, but it acted as though it occupied the second slot while the first slot did nothing, and of course I either didn't have access to Scout's actual intended secondary weapon or it didn't exist at all.

I imagine using the SMG as a baseclass caused it to inherit the behavior of being in the second slot, but I don't see any methods of changing the slot a weapon uses beyond the classes defined at the start, which seems to purely exist for the custom weapons menu to arrange items.

Config


Also, when another player equipped this, their weapon was invisible. As far as I can interpret the situation this isn't a custom model since it's the SMG with an unchanged model, so what can I do about this?
torridgristle 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 15:46.


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