AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved (TF2) Need minor assistance on how to remove an attribute on player death (https://forums.alliedmods.net/showthread.php?t=332984)

That Annoying Guide 06-12-2021 16:41

(TF2) Need minor assistance on how to remove an attribute on player death
 
2 Attachment(s)
So recently I've been editing the GiveBotsMoreComestics and GiveBotsMoreWeapons plugins by PC Gamer
https://forums.alliedmods.net/showthread.php?t=329042 https://forums.alliedmods.net/showthread.php?p=2728899
I'm posting this both as a way for her to help me out here or maybe someone else also knows what to do. Anyways I'm working on adding spell effects to the plugins through tf2 attributes and I've been able to get them to work, but they don't appear to be getting cleared on death or when cosmetics/weapons get rerandomized by touching a resupply locker as the plugin works. This has basically been my first real attempt at working on these kinds of plugins so I got no idea where to go next as a way to get the attributes removed on death or rerandomized. any assistance would be appreciated. Thanks in advance I'll also upload the plugin source so you can check it out. Also if someone knows how to get the voice changing spell effects to be in the list as well that would be cool (I couldn't find the ID for them in item_games.txt)

PC Gamer 06-13-2021 14:21

Re: (TF2) Need minor assistance on how to remove an attribute on player death
 
2 Attachment(s)
A few tips... In this case your goal is to have the spell effect removed when a weapon is discarded. In that case you can apply the spell effect to the weapon. When the weapon is removed so is the spell.

I changed the code a bit to apply the spell after the weapon is created. I also fixed a logic bug with giving the spell.

Example of bug: Original code applied spell if any of these were true:
1. got a 1 in random 10 chance AND flamthrower was equipped... OR
2. strange/renamed flamethrower was equipped... OR
3. backburner was equipped... OR
4. degreaser was equipped... OR
etc.

In the example above, every flamethrower except stock flamethrower would always receive the spell. The stock flamethrower would only receive the spell if a 1 in 10 random chance occurred.

The new logic first checks if a 1 in 10 chance occurred. If it doesn't the code bypasses this section. If it does it then checks to see if the weapon is one of flamethrower types listed. If so, the spell is applied to the weapon.

I hope this helps...

That Annoying Guide 06-13-2021 20:32

Re: (TF2) Need minor assistance on how to remove an attribute on player death
 
Quote:

Originally Posted by PC Gamer (Post 2749644)
A few tips... In this case your goal is to have the spell effect removed when a weapon is discarded. In that case you can apply the spell effect to the weapon. When the weapon is removed so is the spell.

I changed the code a bit to apply the spell after the weapon is created. I also fixed a logic bug with giving the spell.

Example of bug: Original code applied spell if any of these were true:
1. got a 1 in random 10 chance AND flamthrower was equipped... OR
2. strange/renamed flamethrower was equipped... OR
3. backburner was equipped... OR
4. degreaser was equipped... OR
etc.

In the example above, every flamethrower except stock flamethrower would always receive the spell. The stock flamethrower would only receive the spell if a 1 in 10 random chance occurred.

The new logic first checks if a 1 in 10 chance occurred. If it doesn't the code bypasses this section. If it does it then checks to see if the weapon is one of flamethrower types listed. If so, the spell is applied to the weapon.

I hope this helps...

Ah, that does explain them almost always showing up when I was testing the base I created. Many thanks for the help as this was exactly was I was looking for.:) Edit: working well so far on my server only thing I note is when I tried to add the flaming feet stuff back in the 1 in 10 chance worked, but they don't seem to go away on death or switch. I can live with that, but it would be nice to know if there is a way to fix that.

PC Gamer 06-14-2021 00:09

Re: (TF2) Need minor assistance on how to remove an attribute on player death
 
You can also use this list to find other attributes: http://www.tf2tools.net/utilities/schema-attributes

In that list you'll see two attributes related to voices; 1006 (SPELL: Halloween voice modulation) and 2048 (voice pitch scale)

The attribute 'SPELL: Halloween voice modulation' gives you the deep sounding voice. I believe the values for that are 1.0 or 0.0 for either on or off.

The attribute 'voice pitch scale' changes the pitch of your voice where it can sound more feminine or more masculine. A value of 1.0 is normal. Values lower than 1.0 (such as 0.9, 0.8, 0.7, etc.) make the pitch higher. Values higher than 1.0 (such as 1.1, 1.2, 1.3, etc.) make the pitch lower. Feel free to experiment.

PC Gamer 06-14-2021 03:39

Re: (TF2) Need minor assistance on how to remove an attribute on player death
 
Quote:

Originally Posted by That Annoying Guide (Post 2749663)
when I tried to add the flaming feet stuff back in they don't seem to go away on death or switch.

If you are talking about the cosmetics plugin did you apply the attribute to the hat instead of the client?

That Annoying Guide 06-14-2021 09:04

Re: (TF2) Need minor assistance on how to remove an attribute on player death
 
Ah. No, I didn't at first, but now I see that the paints are applying to the hats so I should just change client to hat in each one. I also added voice modulation and I'll see if this all works and consider the attribute list I could technically apply stat changing effects to hats and weapons then? That sounds pretty cool and I might give that a try in the future. Thanks for all the help it's been greatly appreciated on my fun little server for friends. Edit: everything is working just how I was hoping it was going to work. Mega thanks for all this and I'm also gonna update my plugins on each of your other page's comment sections so others can use them if they wish.


All times are GMT -4. The time now is 01:26.

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