Raised This Month: $32 Target: $400
 8% 

[TF2] Custom Weapons 3 (Beta 2)


Post New Thread Reply   
 
Thread Tools Display Modes
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 09-22-2020 , 23:58   Re: [TF2] Custom Weapons 3 (Beta 2)
Reply With Quote #261

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 - 123 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 #262

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 #263

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
trbz_
Junior Member
Join Date: May 2018
Old 12-20-2020 , 00:57   Re: [TF2] Custom Weapons 3 (Beta 2)
Reply With Quote #264

I've been busy at college for the past 6 months and haven't been working on my mod. I get back, and now every time I try to equip a custom weapon, the server instantly crashes, with no info in the sourcemod error log.

When the server starts it says [UPDATER] Could not open c:\users\ethan\desktop\steamcmd\tf2\tf\addons \sourcemod\gamedata\tf2.items.txt for writing, not sure if this is related

Last edited by trbz_; 12-20-2020 at 01:02.
trbz_ is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 12-20-2020 , 01:16   Re: [TF2] Custom Weapons 3 (Beta 2)
Reply With Quote #265

Quote:
Originally Posted by trbz_ View Post
I've been busy at college for the past 6 months and haven't been working on my mod. I get back, and now every time I try to equip a custom weapon, the server instantly crashes, with no info in the sourcemod error log.

When the server starts it says [UPDATER] Could not open c:\users\ethan\desktop\steamcmd\tf2\tf\addons \sourcemod\gamedata\tf2.items.txt for writing, not sure if this is related
I don't use this plugin, but it seems like a permissions issue. Here's my copy of tf2.items.txt that was auto updated in July. Maybe it will work for you.
Attached Files
File Type: txt tf2.items.txt (142 Bytes, 109 views)
PC Gamer is offline
trbz_
Junior Member
Join Date: May 2018
Old 12-20-2020 , 17:12   Re: [TF2] Custom Weapons 3 (Beta 2)
Reply With Quote #266

Quote:
Originally Posted by PC Gamer View Post
I don't use this plugin, but it seems like a permissions issue. Here's my copy of tf2.items.txt that was auto updated in July. Maybe it will work for you.
That worked. Thanks a lot!
trbz_ is offline
doroemon
Senior Member
Join Date: Dec 2009
Location: TF2 AFK Server
Old 01-06-2021 , 04:29   Re: [TF2] Custom Weapons 3 (Beta 2)
Reply With Quote #267

Code:
L 01/06/2021 - 17:23:18: [SM] Exception reported: Array index out-of-bounds (index -1, limit 2049)
L 01/06/2021 - 17:23:18: [SM] Blaming: cw3\attributes\zethax-attributes.notload
L 01/06/2021 - 17:23:18: [SM] Call stack trace:
L 01/06/2021 - 17:23:18: [SM]   [1] Line 843, C:\Users\dora\Desktop\srcds manager\ServerFile\TF2Server\tf\addons\sourcemod\scripting\zethax-attributes.sp::OnTakeDamage
L 01/06/2021 - 17:23:18: [SM] Exception reported: Array index out-of-bounds (index -1, limit 2049)
L 01/06/2021 - 17:23:18: [SM] Blaming: cw3\attributes\zethax-attributes.notload
L 01/06/2021 - 17:23:18: [SM] Call stack trace:
L 01/06/2021 - 17:23:18: [SM]   [1] Line 843, C:\Users\dora\Desktop\srcds manager\ServerFile\TF2Server\tf\addons\sourcemod\scripting\zethax-attributes.sp::OnTakeDamage
L 01/06/2021 - 17:23:18: [SM] Exception reported: Array index out-of-bounds (index -1, limit 2049)
L 01/06/2021 - 17:23:18: [SM] Blaming: cw3\attributes\zethax-attributes.notload
L 01/06/2021 - 17:23:18: [SM] Call stack trace:
L 01/06/2021 - 17:23:18: [SM]   [1] Line 843, C:\Users\dora\Desktop\srcds manager\ServerFile\TF2Server\tf\addons\sourcemod\scripting\zethax-attributes.sp::OnTakeDamage
I download it from here
Can someone fix it ? thanks a lot!
__________________
I'm just a guy who's a server operator for fun.
https://steamcommunity.com/groups/cfmsg
doroemon is offline
JohnnyAlexander
Junior Member
Join Date: Aug 2020
Location: Chile
Old 04-03-2021 , 17:24   Re: [TF2] Custom Weapons 3 (Beta 2)
Reply With Quote #268

Hi, I'm replicating the Giant Charged Soldier's Original using this plugin. I know there is a "critboost" attribute that is a consumable only. Is there a way to code crits only on the active weapon?

I'm aware of "provide on active" which I've also tried.
JohnnyAlexander is offline
Memepugg
Junior Member
Join Date: Aug 2019
Old 05-13-2021 , 23:08   Re: [TF2] Custom Weapons 3 (Beta 2)
Reply With Quote #269

I'm having trouble with making my own custom weapon
1. When I load up the weapon I made, It seems its stats haven't been changed/added at all. I admit I'm not the greatest at coding or anything and I know on the TF2 wiki it displays some attributes as a percentage or reverse percentage so I'm not sure what I'm doing with those.

2. I added a custom model for it and I put the stuff I think needs to be put in for the custom model to work but that doesn't work either. I have seen other's talk about the customs models not working but idk if another plugin is needed for that work or what. Idk what I'm doing wrong with these 2

And this is what the code for the weapon I'm working on looks like:

Quote:
"Cerberus"
{
"classes"
{
"heavy" "0"
}
"baseclass" "minigun"
"baseindex" "15"
"nobots" "1"
"quality" "6"
"logname" "cerberus"
"description" "+15 faster firing speed\n+50 bullets per shot\n25% less accurate\n-20% damage penalty\n50% slower spin time
"attributes"
{
"fire rate bonus"
{
"plugin" "tf2attributes"
"value" "0.85"
}
"bullets per shot bonus"
{
"plugin" "tf2attributes"
"value" "1.5
}
"spread penalty"
{
"plugin" "tf2attributes"
"value" ".25"
}
"damage penalty"
{
"plugin" "tf2attributes"
"value" "0.8"
}
"minigun spinup time increased"
{
"plugin" "tf2attributes"
"value" "1.5"
}
"weapon_allow_inspect"
{
"plugin" "tf2attributes"
"value" "1"
}
}
"viewmodel"
{
"modelname" "models/weapons/c_models/c_trigun/c_minigun.mdl"
}
"worldmodel"
{
"modelname" "models/weapons/c_models/c_trigun/c_minigun.mdl"

"sound"
{
"player"
{
"find" ")weapons/minigun_shoot.wav"
"replace" "weapons/heavy/trigun_shoot.wav"
"pitch" "150"
}
}
}

Last edited by Memepugg; 05-13-2021 at 23:11. Reason: Better clairfication on issues
Memepugg is offline
KenanTheFab
New Member
Join Date: Oct 2021
Old 10-28-2021 , 15:05   Re: [TF2] Custom Weapons 3 (Beta 2)
Reply With Quote #270

Quote:
Originally Posted by Memepugg View Post
I'm having trouble with making my own custom weapon
1. When I load up the weapon I made, It seems its stats haven't been changed/added at all. I admit I'm not the greatest at coding or anything and I know on the TF2 wiki it displays some attributes as a percentage or reverse percentage so I'm not sure what I'm doing with those.

2. I added a custom model for it and I put the stuff I think needs to be put in for the custom model to work but that doesn't work either. I have seen other's talk about the customs models not working but idk if another plugin is needed for that work or what. Idk what I'm doing wrong with these 2

And this is what the code for the weapon I'm working on looks like:

You forgot " after "slower spin time"
KenanTheFab is offline
Reply



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 16:02.


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