Raised This Month: $23 Target: $400
 5% 

[TF2] Custom Weapons 3 (Beta 2)


Post New Thread Reply   
 
Thread Tools Display Modes
SirBlockles
Junior Member
Join Date: Mar 2017
Location: /home/muddy
Old 07-07-2020 , 20:54   Re: [TF2] Custom Weapons 3 (Beta 2)
Reply With Quote #251

I wrote a custom wearable dispenser weapon with its own custom attribute, and it all works fine on that front, but... The default attributes refuse to work. It seems that making the weapon a wearable makes it not considered "worn." It has the attribs applied - the dispenser part still works just fine - yet none of the stock attributes work. If I change the weapon to any other class, like buff_item, the passive effects are fully functional. The problem is that I don't want the weapon selectable in any fashion, pressing the 2 slot should do nothing. Am I doing something wrong here?
Code:
"The Provisioner"
{
	"classes"
	{
		"engineer"		"1"
	}
	"baseclass"			"wearable"
	"baseindex"			"642" //cozy camper
	"nobots"			"0"
	"quality"			"6"
	"logname"			"dispenser_backpack"
	"description"		"<trimmed so my post isn't 50 feet wide>"
	"cw3_attributes"
	{
		"mod is worn dispenser"
		{
			"plugin"	"muddysattribs"
			"value"		"1"
		}
		"is_passive_weapon"
		{
			"plugin"	"tf2attributes"
			"value"		"1"
		}
		"engy dispenser radius increased"
		{
			"plugin"	"tf2attributes"
			"value"		"2.15"
		}
		"health from healers reduced"
		{
			"plugin"	"tf2attributes"
			"value"		"0.3"
		}
		"move speed penalty"
		{
			"plugin"	"tf2attributes"
			"value"		"0.90"
		}
	}
}
__________________
SirBlockles is offline
Send a message via Skype™ to SirBlockles
nosoop
Veteran Member
Join Date: Aug 2014
Old 07-08-2020 , 01:39   Re: [TF2] Custom Weapons 3 (Beta 2)
Reply With Quote #252

Quote:
Originally Posted by SirBlockles View Post
I wrote a custom wearable dispenser weapon with its own custom attribute, and it all works fine on that front, but... The default attributes refuse to work.
The CW3 plugin interface has issues applying attributes to non-weapon entities. Had to make a note of that for Custom Attributes myself.

Not sure since actually using CW3 is out of my expertise, but you may need to do one of the following:
  • Use the "attributes" section instead of "cw3_attributes". Internally CW3 determines the entity to apply the attribute to using GetPlayerWeaponSlot, which doesn't work on non-weapon entities (the Buff Banner counts as a weapon). CW2-style attributes operate on entities directly.
  • Use wearable_razorback for the item. I'm less certain about this one, but I'd reason it to be due to wearables normally occupying non-weapon slots.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
nosoop is online now
SirBlockles
Junior Member
Join Date: Mar 2017
Location: /home/muddy
Old 07-08-2020 , 15:33   Re: [TF2] Custom Weapons 3 (Beta 2)
Reply With Quote #253

Quote:
Originally Posted by nosoop View Post
The CW3 plugin interface has issues applying attributes to non-weapon entities. Had to make a note of that for Custom Attributes myself.

Not sure since actually using CW3 is out of my expertise, but you may need to do one of the following:
-snip-
I tried these out - using attributes over cw3_attributes didn't seem to help, and wearable_razorback is considered a null item.

HOWEVER, I did find a solution, at least in my specific use case (writing here in case anyone else wants a passive worn item):

Make the item a builder, and DO NOT include the weapon_is_passive attribute. If you keep the passive attribute, it switches the player from his primary to his melee constantly (since tf_weapon_builder is the weapon for the engy toolbox/spy sapper and proabably thinks you just built something), but this is not a problem if the weapon isn't passive.

As a result from using this, if the player tries using the weapon in this slot, the viewmodel will flash invisible for like a single game frame and his weapon won't change, and in third person their arms will twitch as they try to pull out a toolbox for a split second, but I've found that this effect is completely clientside and doesn't even show for anyone else. Also, when hauling an already-deployed building (but interestingly, not while placing one from scratch), the toolbox viewmodel is invisible, but not the building's blueprint.

The only downside aside from the minor visual bugs, is that a weapon equipped in this fashion eats mousewheel scrolls to switch weapon, meaning you have to scroll hard enough to "push past it." But, for people who use the keyboard to swap weapons, this shouldn't be a huge issue.

This method works for all classes except the Spy, who believes the weapon to be a Sapper.
__________________

Last edited by SirBlockles; 07-08-2020 at 15:33.
SirBlockles is offline
Send a message via Skype™ to SirBlockles
nosoop
Veteran Member
Join Date: Aug 2014
Old 07-09-2020 , 07:35   Re: [TF2] Custom Weapons 3 (Beta 2)
Reply With Quote #254

Quote:
Originally Posted by SirBlockles View Post
I tried these out - using attributes over cw3_attributes didn't seem to help, and wearable_razorback is considered a null item.
On further inspection it doesn't look like CW3 handles wearable_razorback correctly (it only has specific cases for wearable and wearable_demoshield). That would explain the null item issue; CW3 is rather dated.

Using the attributes section name with the wearable baseclass works for me on CW3, though, or at least I'm seeing the move speed penalty and no secondary weapon is showing up in the weapon buckets. Here's the config for reference.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
nosoop is online now
Old Bill
Junior Member
Join Date: Jun 2020
Old 07-16-2020 , 08:08   Re: [TF2] Custom Weapons 3 (Beta 2)
Reply With Quote #255

is there a way to use a game existing model but override its textures for a custom weapon? like make an Australium weapon instead of making the client redownload the model again just override the textures with the custom ones instead.
Old Bill is offline
Old Bill
Junior Member
Join Date: Jun 2020
Old 08-01-2020 , 10:29   Re: [TF2] Custom Weapons 3 (Beta 2)
Reply With Quote #256

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

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 Today , 09:00   Re: [TF2] Custom Weapons 3 (Beta 2)
Reply With Quote #258

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; Today at 09:05.
Old Bill 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 16:52.


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