Garry's Mod

Garry's Mod

TFA Base
nnykez 2. dec. kl. 12:56
RPM / RPM_SEMI get reset during safety switch
I have an attachment that modifies RPM and RPM_Semi.

These values get reset when taking the gun on/off safety.

```
ATTACHMENT.WeaponTable = { -- The place where you change the stats (CACHED STATS ONLY!)
["Primary"] = {
["Automatic"] = true,
["RPM"] = function(wep, stat)
print(stat)
if stat > 550 then
return 500 -- Don't increase RPM if it's already high
end
return stat * 1.1 -- Increase RPM by 10%
end,
["RPM_Semi"] = function(wep, stat)
print(stat)
if stat > 550 then
return 500 -- Don't increase RPM if it's already high
end
return stat * 1.1 -- Increase RPM_Semi by 10%
end,
["Damage"] = function(wep, stat)
print(stat)
return stat * 0.9 -- Decrease damage by 10%
end,
}
}```
< >
Viser 1-6 af 6 kommentarer
YuRaNnNzZZ  [udvikler] 2. dec. kl. 13:01 
safety toggle is just a firemode change, it doesn't clear or change any stats, it shouldn't modify the rpm
nnykez 2. dec. kl. 13:08 
Oprindeligt skrevet af YuRaNnNzZZ:
safety toggle is just a firemode change, it doesn't clear or change any stats, it shouldn't modify the rpm

It looks like it sets it to Automatic = false and doesn't look at the cached stat when switching it back, only the stat the weapon was loaded with.

if self:IsSafety() then
self.Primary.Automatic = false
self.Primary_TFA.Automatic = false
else
self.Primary.Automatic = self:IsFireModeAutomatic()
self.Primary_TFA.Automatic = self.Primary.Automatic
end

common/utils.lua

Not sure if there is a way around this without modifying the base.
nnykez 2. dec. kl. 13:09 
In the attachment table I am setting ["Automatic"] = true btw
YuRaNnNzZZ  [udvikler] 2. dec. kl. 13:10 
Primary.Automatic is not a cached stat, you need to modify it in ATTACHMENT:Attach/Detach
nnykez 2. dec. kl. 13:21 
Oprindeligt skrevet af YuRaNnNzZZ:
Primary.Automatic is not a cached stat, you need to modify it in ATTACHMENT:Attach/Detach

Yeah I tried that. Sadly, safety sets it back to "false" and then does not use the value applied by the attachment (which would be true).
YuRaNnNzZZ  [udvikler] 3. dec. kl. 5:24 
well yes, you have to override the firemodes table too if you want to force automatic firemode
the firemodes table is cached
Sidst redigeret af YuRaNnNzZZ; 3. dec. kl. 5:25
< >
Viser 1-6 af 6 kommentarer
Per side: 1530 50