Garry's Mod

Garry's Mod

[TTT/2] Hot Potato!
 Este tópico foi afixado, então deve ser importante
SkyDivingL  [desenvolvedor(a)] 29/jan./2021 às 11:48
Errors thread
Let me know if and how the add-on is ruining your day and I'll try to fix it.
< >
Exibindo comentários 115 de 20
[★SG★] Guushi 21/fev./2021 às 16:32 
Players found an issue. If you are holding a Detectives weapon or equipment and a traitor gives you the potato, the weapon or equipment overrides the potato as long as you are holding the weapon/equipment.
[★SG★] Guushi 21/fev./2021 às 16:33 
I'm assuming the outcome is the same if you are a Traitor and ur holding a T weapon.
SkyDivingL  [desenvolvedor(a)] 22/fev./2021 às 8:03 
Escrito originalmente por ★SG★ Guushi:
Players found an issue. If you are holding a Detectives weapon or equipment and a traitor gives you the potato, the weapon or equipment overrides the potato as long as you are holding the weapon/equipment.


Escrito originalmente por ★SG★ Guushi:
I'm assuming the outcome is the same if you are a Traitor and ur holding a T weapon.

Hey, thanks for letting me know. I confirmed this was the case and updated the add-on. Please let me know if the issue pops up again or other issues come up.
The Stig 23/mai./2021 às 22:21 
@SkyDivingL I got these two errors:

[[TTT/2] Hot Potato!] gamemodes/terrortown/entities/weapons/weapon_ttt_hotpotato.lua:145: attempt to call method 'Detonate' (a nil value)
1. fn - gamemodes/terrortown/entities/weapons/weapon_ttt_hotpotato.lua:145
2. unknown - lua/ulib/shared/hook.lua:109
3. FireBullets - [C]:-1
4. ShootBullet - gamemodes/terrortown/entities/weapons/weapon_tttbase.lua:328
5. unknown - lua/weapons/weapon_stenmk3/shared.lua:75

[[TTT/2] Hot Potato!] gamemodes/terrortown/entities/weapons/weapon_ttt_hotpotato.lua:151: attempt to call method 'Detonate' (a nil value)
1. unknown - gamemodes/terrortown/entities/weapons/weapon_ttt_hotpotato.lua:151

I highly suspect it is because we were holding our guns for some reason and not the hot potato when we were given it, so the "GetActiveWeapon()" call was pulling the gun we were holding and not the hot potato, hence the 'Detonate' function didn't exist.

Maybe try using 'self:Detonate(ply)' instead of calling GetActiveWeapon()?
And adding a timer.Simple to ply:SelectWeapon( "weapon_ttt_hotpotato" ) so they equip it after a delay?

Also, the speed boost convar didn't seem to do anything.
Última edição por The Stig; 23/mai./2021 às 22:23
SkyDivingL  [desenvolvedor(a)] 24/mai./2021 às 5:25 
Escrito originalmente por The Stig:
@SkyDivingL I got these two errors:

[[TTT/2] Hot Potato!] gamemodes/terrortown/entities/weapons/weapon_ttt_hotpotato.lua:145: attempt to call method 'Detonate' (a nil value)
1. fn - gamemodes/terrortown/entities/weapons/weapon_ttt_hotpotato.lua:145
2. unknown - lua/ulib/shared/hook.lua:109
3. FireBullets - [C]:-1
4. ShootBullet - gamemodes/terrortown/entities/weapons/weapon_tttbase.lua:328
5. unknown - lua/weapons/weapon_stenmk3/shared.lua:75

[[TTT/2] Hot Potato!] gamemodes/terrortown/entities/weapons/weapon_ttt_hotpotato.lua:151: attempt to call method 'Detonate' (a nil value)
1. unknown - gamemodes/terrortown/entities/weapons/weapon_ttt_hotpotato.lua:151

I highly suspect it is because we were holding our guns for some reason and not the hot potato when we were given it, so the "GetActiveWeapon()" call was pulling the gun we were holding and not the hot potato, hence the 'Detonate' function didn't exist.

Maybe try using 'self:Detonate(ply)' instead of calling GetActiveWeapon()?
And adding a timer.Simple to ply:SelectWeapon( "weapon_ttt_hotpotato" ) so they equip it after a delay?

Also, the speed boost convar didn't seem to do anything.

Can you tell me anything that happened before the error occurred? From your description it sounds like you were holding a weapon and somebody gave you an activated hot potato, but that shouldn't cause any issues.

I'll look at the issue and also that of the convar.
The Stig 24/mai./2021 às 5:48 
Escrito originalmente por SkyDivingL:
From your description it sounds like you were holding a weapon and somebody gave you an activated hot potato, but that shouldn't cause any issues.

That is exactly what happened. I had to manually select the hot potato to hold it, ran out of time, but didn't explode and the second error happened.

The first error happened away from me so I didn't see what happened, but I copied it from the console anyway.
SkyDivingL  [desenvolvedor(a)] 24/mai./2021 às 8:23 
Escrito originalmente por The Stig:
Escrito originalmente por SkyDivingL:
From your description it sounds like you were holding a weapon and somebody gave you an activated hot potato, but that shouldn't cause any issues.

That is exactly what happened. I had to manually select the hot potato to hold it, ran out of time, but didn't explode and the second error happened.

The first error happened away from me so I didn't see what happened, but I copied it from the console anyway.

I'm investigating some causes for this error. I have managed to recreate it, and it looks like other addons interfered with the logic of the potato.

The potato works by removing the equipment 1 item (slot 7 typically, but irrelevant) and replacing it with the activated potato. It doesn't matter what weapon you're holding when this happens (with the exception of a potato that's already activated).

After that, the code assumes the player is still holding the potato. I've tried to prevent players from losing the potato: they can't drop it, they can't switch weapons, it blows up on death.

I forgot that some addons could strip weapons from a player, such as the Free Kill Gun Gifter. This weapon in particular removes the equipment 1 item, and if this is an activated potato, there is no way to access Detonate(). This recreates the issue you had.

I'll try and fix this issue for some addons I know (FKG gifter, handcuffs), but could you also tell me about any other addons you use that have similar effects? This allows me to make sure the fix works for these addons as well.

On the subject of the speed convar, I can't find any issues with it either. It is only applied to the player holding an activated potato. By default it's 1.2x boost and I observe this in testing, and I confirmed the convar works in general by setting it to 100x. Maybe 1.2x wasn't noticeable?
The Stig 24/mai./2021 às 10:17 
Escrito originalmente por SkyDivingL:
Escrito originalmente por The Stig:

That is exactly what happened. I had to manually select the hot potato to hold it, ran out of time, but didn't explode and the second error happened.

The first error happened away from me so I didn't see what happened, but I copied it from the console anyway.

I'm investigating some causes for this error. I have managed to recreate it, and it looks like other addons interfered with the logic of the potato.

The potato works by removing the equipment 1 item (slot 7 typically, but irrelevant) and replacing it with the activated potato. It doesn't matter what weapon you're holding when this happens (with the exception of a potato that's already activated).

After that, the code assumes the player is still holding the potato. I've tried to prevent players from losing the potato: they can't drop it, they can't switch weapons, it blows up on death.

I forgot that some addons could strip weapons from a player, such as the Free Kill Gun Gifter. This weapon in particular removes the equipment 1 item, and if this is an activated potato, there is no way to access Detonate(). This recreates the issue you had.

I'll try and fix this issue for some addons I know (FKG gifter, handcuffs), but could you also tell me about any other addons you use that have similar effects? This allows me to make sure the fix works for these addons as well.

On the subject of the speed convar, I can't find any issues with it either. It is only applied to the player holding an activated potato. By default it's 1.2x boost and I observe this in testing, and I confirmed the convar works in general by setting it to 100x. Maybe 1.2x wasn't noticeable?

Oh, the speed convar is only applied to a live potato? My fault then.
The hot potato never exploded when we used it around 10 times on different maps, we weren't using weapon-stripping weapons every time. But if it's working for you then there's something on my end that's interfering with it. Not sure when I can get around to testing.

As for addons I use that could strip weapons, here's some links:
https://steamcommunity.com/sharedfiles/filedetails/?id=2249861635
https://steamcommunity.com/sharedfiles/filedetails/?id=785294711
https://steamcommunity.com/sharedfiles/filedetails/?id=1821994534
https://steamcommunity.com/sharedfiles/filedetails/?id=1821993909

There's also the randomat, though that might be a bit much to make compatible:
https://steamcommunity.com/sharedfiles/filedetails/?id=2055805086
https://steamcommunity.com/sharedfiles/filedetails/?id=2428342861
https://steamcommunity.com/sharedfiles/filedetails/?id=2428350426

This mod might also interfere, putting it here just in case:
https://steamcommunity.com/sharedfiles/filedetails/?id=2451418207
The Stig 25/mai./2021 às 3:20 
@SkyDivingL I've found the problem: TFA Guns. From my testing, the hot potato failed to work every time a bot was holding a TFA gun, but worked fine otherwise.

What is a TFA Gun? Any weapon using TFA Base as a base for the weapon, for example these weapons: https://steamcommunity.com/sharedfiles/filedetails/?id=2451435560

I tested with the duel-wield shotguns (classname: c_reaper_nope) from the mod above, here's what I did to get the error:

Make someone hold out a TFA weapon, give them a hot potato, and the player will fail to switch from the TFA weapon to the hot potato, after they were supposed to explode, this error will occur:

[[TTT/2] Hot Potato!] gamemodes/terrortown/entities/weapons/weapon_ttt_hotpotato.lua:164: attempt to call method 'Detonate' (a nil value)
1. unknown - gamemodes/terrortown/entities/weapons/weapon_ttt_hotpotato.lua:164

Timer Failed! [Bot03_PotatoTooHot][@gamemodes/terrortown/entities/weapons/weapon_ttt_hotpotato.lua (line 162)]
SkyDivingL  [desenvolvedor(a)] 25/mai./2021 às 17:51 
Escrito originalmente por The Stig:
@SkyDivingL I've found the problem: TFA Guns. From my testing, the hot potato failed to work every time a bot was holding a TFA gun, but worked fine otherwise.

What is a TFA Gun? Any weapon using TFA Base as a base for the weapon, for example these weapons: https://steamcommunity.com/sharedfiles/filedetails/?id=2451435560

I tested with the duel-wield shotguns (classname: c_reaper_nope) from the mod above, here's what I did to get the error:

Make someone hold out a TFA weapon, give them a hot potato, and the player will fail to switch from the TFA weapon to the hot potato, after they were supposed to explode, this error will occur:

[[TTT/2] Hot Potato!] gamemodes/terrortown/entities/weapons/weapon_ttt_hotpotato.lua:164: attempt to call method 'Detonate' (a nil value)
1. unknown - gamemodes/terrortown/entities/weapons/weapon_ttt_hotpotato.lua:164

Timer Failed! [Bot03_PotatoTooHot][@gamemodes/terrortown/entities/weapons/weapon_ttt_hotpotato.lua (line 162)]
Thanks for getting it down to something very specific. I'll see if I can fix the issue with this information.
SkyDivingL  [desenvolvedor(a)] 26/mai./2021 às 11:47 
Escrito originalmente por The Stig:
@SkyDivingL I've found the problem: TFA Guns. From my testing, the hot potato failed to work every time a bot was holding a TFA gun, but worked fine otherwise.

You were right! If someone is holding one of your overwatch guns when given a potato, they switch to the potato but immediately switch back.

What I did to (hopefully) fix this is to strip all weapons from the target rather than just the equipment 1 item. This circumvents that weird non-switch issue.

I wish I could think of a more elegant solution to the problem, but I don't understand the weapon not properly switching in the first place, so this will have to do.

I've updated the addon. Let me know if it's still busted!
Malivil 26/mai./2021 às 13:51 
Does the player get their weapons back if they give the hot potato away?
SkyDivingL  [desenvolvedor(a)] 26/mai./2021 às 15:47 
Escrito originalmente por Malivil:
Does the player get their weapons back if they give the hot potato away?
If all works well, yes. Weapons are stripped but returned with the same ammo.
The Stig 26/mai./2021 às 20:12 
@SkyDivingL From my testing, it all works! Thanks so much for all that.
Malivil 27/mai./2021 às 4:40 
Escrito originalmente por SkyDivingL:
Escrito originalmente por Malivil:
Does the player get their weapons back if they give the hot potato away?
If all works well, yes. Weapons are stripped but returned with the same ammo.

That's awesome, good job =)
< >
Exibindo comentários 115 de 20
Por página: 1530 50