mouse Posted March 11, 2014 Share Posted March 11, 2014 (edited) I recently implemented the Kritzkrieg from TF2 into DS and everything seems to be working just fine except for it's effect on ranged weapons.If you're unfamiliar: The Kritzkrieg is a healing weapon for The Medic from Team Fortress 2. As The Medic heals people on his team his "Ubercharge"(the Kritzkrieg's charge meter) fills up. When it reaches 100%, The Medic can use his Ubercharge and give guaranteed critical hits(base weapon damage x 3) to the person he's healing for a short period of time.I've obviously made it so the user will get the guaranteed critical hits in Don't Starve and it works great with melee weapons but not with ranged. For example, the blowdart still reports that it's damage is 3 x normal but it's still taking the same amount of blowdarts to kill things. Is there a different damage variable for projectiles than blahblah.components.weapons.damage? I was digging around in components.projectile. but couldn't find anything damage related.My disorganized but functional Kritzkrieg uber block:local function kritzuber(player) local GetPlayer = GLOBAL.GetPlayer local weapondam = GetPlayer().components.inventory.equipslots.hands.components.weapon.damage GetPlayer().iskkubered = 0 player:DoPeriodicTask(.5, function(inst) if GetPlayer().components.inventory.equipslots.hands and GetPlayer().components.inventory.equipslots.hands.components and GetPlayer().components.inventory.equipslots.hands.components.weapon and GetPlayer().components.inventory.equipslots.hands.components.weapon.damage then if GetPlayer().iskkubered == 0 then if GetPlayer().components.inventory.equipslots.hands.components.weapon.damage == GetPlayer().components.inventory.equipslots.hands.components.weapon.kritzdamage then GetPlayer().components.inventory.equipslots.hands.components.weapon.damage = GetPlayer().components.inventory.equipslots.hands.components.weapon.kkbasedamage end weapondam = GetPlayer().components.inventory.equipslots.hands.components.weapon.damage GetPlayer().components.inventory.equipslots.hands.components.weapon.kkbasedamage = weapondam GetPlayer().components.inventory.equipslots.hands.components.weapon.kritzdamage = weapondam * 3 GetPlayer().components.inventory.equipslots.hands.components.weapon.damage = GetPlayer().components.inventory.equipslots.hands.components.weapon.kkbasedamage end if GetPlayer().iskkubered == 1 then if GetPlayer().components.inventory.equipslots.hands.components.weapon.kritzdamage and GetPlayer().components.inventory.equipslots.hands.components.weapon.kkbasedamage then GetPlayer().components.inventory.equipslots.hands.components.weapon.damage = GetPlayer().components.inventory.equipslots.hands.components.weapon.kritzdamage else weapondam = GetPlayer().components.inventory.equipslots.hands.components.weapon.damage GetPlayer().components.inventory.equipslots.hands.components.weapon.kkbasedamage = weapondam GetPlayer().components.inventory.equipslots.hands.components.weapon.kritzdamage = weapondam * 3 GetPlayer().components.inventory.equipslots.hands.components.weapon.damage = GetPlayer().components.inventory.equipslots.hands.components.weapon.kkbasedamage end end end end)endAddSimPostInit(kritzuber) Edited March 11, 2014 by mouse Link to comment https://forums.kleientertainment.com/forums/topic/32639-problem-editing-projectile-damage-variables/ Share on other sites More sharing options...
mouse Posted March 13, 2014 Author Share Posted March 13, 2014 I'm shamelessly bumping AND I'm going to further explain this issue so you can see this issue for yourself. Run the game, load a save and open the console. Type: DebugSpawn("blowdart_pipe")until you have 6, 9, or some other amount divisible by 3. Equip it and type: print(GetPlayer().components.inventory.equipslots.hands.components.weapon.damage)This command prints the damage of whatever weapon you're currently holding. Remember it's value. Then spawn a baby beefalo via: DebugSpawn("babybeefalo")Count the number of blow darts it takes to kill it. It should take 3. Then open the console and type: GetPlayer().components.inventory.equipslots.hands.components.weapon.damage = 300Print it's value again to make sure it has changed, which it will: print(GetPlayer().components.inventory.equipslots.hands.components.weapon.damage)Spawn another beefalo baby then count the number of blow darts it takes to kill it. You'll notice it still takes 3 when it should only take 1 or 2 max. This is the problem I'm having. Changing that value makes no difference, even though the blow pipe prefab assigns it's default damage to that variable. Unless I'm wrong, the projectile component doesn't seem to hold any damage variables so what's going on here? Does anyone have any insight into this? Link to comment https://forums.kleientertainment.com/forums/topic/32639-problem-editing-projectile-damage-variables/#findComment-430870 Share on other sites More sharing options...
squeek Posted March 13, 2014 Share Posted March 13, 2014 (edited) Use this to debug it:Â -- in modmainlocal require = GLOBAL.requirelocal Combat = require "components/combat"local Combat_CalcDamage_base = Combat.CalcDamagefunction Combat:CalcDamage(target, weapon, multiplier) local damage = Combat_CalcDamage_base(self, target, weapon, multiplier) print(tostring(self.inst).." trying to do "..tostring(damage).." damage to "..tostring(target).." with "..tostring(weapon).." (multiplier: "..tostring(multiplier)..")") return damageend Edited March 13, 2014 by squeek Link to comment https://forums.kleientertainment.com/forums/topic/32639-problem-editing-projectile-damage-variables/#findComment-430927 Share on other sites More sharing options...
mouse Posted March 13, 2014 Author Share Posted March 13, 2014 Use this to debug it:-- in modmainlocal require = GLOBAL.requirelocal Combat = require "components/combat"local Combat_CalcDamage_base = Combat.CalcDamagefunction Combat:CalcDamage(target, weapon, multiplier) local damage = Combat_CalcDamage_base(self, target, weapon, multiplier) print(tostring(self.inst).." trying to do "..tostring(damage).." damage to "..tostring(target).." with "..tostring(weapon).." (multiplier: "..tostring(multiplier)..")") return damageendI like how you shoehorned that into the combat component without any postinits. I didn't know you could do it that way. I'll have to remember that. But that doesn't tell me anything new since I've already got a variety of prints reporting the same values. And the thing is I know everything is working right because all of the melee weapons report the right base damage x3 values. The multiplier just isn't being applied to ranged weapons for some reason and that's what I'm trying to figure out.However, I see now the combat component has a damagemultiplier variable. But blow darts don't use the combat component and since a lot of people would probably use blow darts as a template for their ranged weapon mods, it does little good to add the component to blow darts. Know what I mean? Link to comment https://forums.kleientertainment.com/forums/topic/32639-problem-editing-projectile-damage-variables/#findComment-431029 Share on other sites More sharing options...
squeek Posted March 13, 2014 Share Posted March 13, 2014 I like how you shoehorned that into the combat component without any postinits.The technique is explained here. But blow darts don't use the combat component and since a lot of people would probably use blow darts as a template for their ranged weapon mods, it does little good to add the component to blow darts. Know what I mean?If you follow the projectile/weapon component code, you'll find that the damage is actually done using the attacker's combat component, and all weapon-based damage goes through that Combat:CalcDamage function. The code I posted should print to the console information about all damage done, printing the final damage that will be used to modify the health of the target. If you modify the blowdarts damage using GetPlayer().components.inventory.equipslots.hands.components.weapon.damage = 300and then attack a baby beefalo, what does the console say (with the code I posted running)? Link to comment https://forums.kleientertainment.com/forums/topic/32639-problem-editing-projectile-damage-variables/#findComment-431039 Share on other sites More sharing options...
mouse Posted March 13, 2014 Author Share Posted March 13, 2014 The technique is explained here. If you follow the projectile/weapon component code, you'll find that the damage is actually done using the attacker's combat component, and all weapon-based damage goes through that Combat:CalcDamage function. The code I posted should print to the console information about all damage done, printing the final damage that will be used to modify the health of the target. If you modify the blowdarts damage usingGetPlayer().components.inventory.equipslots.hands.components.weapon.damage = 300and then attack a baby beefalo, what does the console say (with the code I posted running)? Ohhh I didn't think about using the player's combat component. I also didn't know the damage multiplier variable existed. I wish I had known that sooner. It would have made all of this much easier. Link to comment https://forums.kleientertainment.com/forums/topic/32639-problem-editing-projectile-damage-variables/#findComment-431061 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now