View Single Post
That Annoying Guide
Member
Join Date: Aug 2019
Location: Dream Land
Old 06-13-2021 , 20:32   Re: (TF2) Need minor assistance on how to remove an attribute on player death
Reply With Quote #3

Quote:
Originally Posted by PC Gamer View Post
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.

Last edited by That Annoying Guide; 06-13-2021 at 22:47.
That Annoying Guide is offline