Zackreaver Posted March 27, 2015 Share Posted March 27, 2015 (edited) So I have a bit of a conundrum. My character has a perk where equipping certain weapons gives a damage bonus and equipping other's gives a penalty. Now here's the issue, boomerangs calculate their damage when they hit their target. My character is built to have a weakness with boomerangs dealing half their damage, however if my character switches to a weapon with a damage multiplier bonus WHILE THE BOOMERANG IS IN TRANSIT, the boomerang inflicts bonus damage instead of reduced damage. Other ranged weapons like the blow dart probably also have this issue,but the projectile moves fast enough that it shouldn't be exploitable, so only the boomerang would require a fix. My solution for this will be to prevent adjusting of my characters damage multiplier until after the boomerang has either connected with it's target or stopped moving, afterwards I will have it run the function that adjusts my characters damage rechecking the weapon. My problem, I don't know a good way of checking for an in motion boomerang. Thankfully I know enough now that I can figure out how to do such a thing, (Thanks to the awesome forum people) but I''m already thinking of several different ways to go about it when there's probably a best way to do it. My current plan is to give my character a tag when the boomerang is thrown, and remove the tag when the boomerang hits the target, as well as issuing the damage adjustment function. An issue that came up from that plan is when a player throws 2 or more boomerangs at once >.<. I could always check for the tag and add a different tag as well, maybe even a count in the event someones running a slow boomerang mod that makes boomerangs travel very slowly so they can throw a million of them at once 0.0; good lord the possibilities. Funny enough, this issue can actually happen with wolfgang as he works the same way, if you throw a boomerang as wolfgang in wimpy form, then immediately eat something into mighty form before the boomerang connects, it will deal your current forms damage regardless of your state when you threw it. Though it's not really an issue for wolfgang, since his damage is controlled by hunger, not currently equipped weapon so it's really just a feature not an exploit. I also have a plan of adjusting the damage of the weapons directly instead of using damage multiplier, but that might not fix the issue for the boomerang as it would still need to revert it's damage when other players use it. I can keep thinking of a number of different workarounds but I'm not sure which is the best one. Edited March 27, 2015 by Zackreaver Link to comment https://forums.kleientertainment.com/forums/topic/52401-character-perk-detecting-in-motion-boomerang/ Share on other sites More sharing options...
DarkXero Posted March 27, 2015 Share Posted March 27, 2015 (edited) AddComponentPostInit("combat", function(self) local old = self.CalcDamage function self:CalcDamage(target, weapon, multiplier) if self.inst.prefab == "weirdo" and weapon.prefab == "boomerang" then multiplier = 0.5 end return old(self, target, weapon, multiplier) endend)multiplier overrules self.damagemultiplier. Edited March 27, 2015 by DarkXero Link to comment https://forums.kleientertainment.com/forums/topic/52401-character-perk-detecting-in-motion-boomerang/#findComment-625340 Share on other sites More sharing options...
Zackreaver Posted March 27, 2015 Author Share Posted March 27, 2015 @DarkXero,Hey, my character isn't a weirdo! But I am definitely grateful However, I think the RoG beta may have changed things but I don't think it overrules damage multiplier if self.damagemultiplier then multiplier = multiplier * self.damagemultiplier endIt looks like they merge together instead. But I can still work off of multiplier better though, since this way it won't care whats equipped. I'll just adjust my script to not use damagemultiplier Link to comment https://forums.kleientertainment.com/forums/topic/52401-character-perk-detecting-in-motion-boomerang/#findComment-625446 Share on other sites More sharing options...
DarkXero Posted March 28, 2015 Share Posted March 28, 2015 @Zackreaver, yeah, I go back and forth with the RoG beta and modding. In DST without RoG, it's:multiplier = multiplier or self.damagemultiplier or 1Some people prefer to mod for the stable branch, others RoG, others both. You could do:if self.damagemultiplier then multiplier = 0.5 / self.damagemultiplierendto nullify. But it would be simpler to just do:local wepmult = { boomerang = 0.5, hambat = 2, nightsword = 0.1}if self.inst.prefab == "weirdo" then multiplier = wepmult[weapon.prefab] or 1end Link to comment https://forums.kleientertainment.com/forums/topic/52401-character-perk-detecting-in-motion-boomerang/#findComment-625482 Share on other sites More sharing options...
Zackreaver Posted March 28, 2015 Author Share Posted March 28, 2015 Some people prefer to mod for the stable branch, others RoG, others both. It's both for me. But I got it working great now, switched my code around to use multiplication of the weapon inflicting the damage as opposed to my characters damage multiplication. Link to comment https://forums.kleientertainment.com/forums/topic/52401-character-perk-detecting-in-motion-boomerang/#findComment-625625 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