RadiantRoma Posted March 10, 2017 Share Posted March 10, 2017 (edited) For the character I'm making (this is the last request, I swear!), to offset the speed bonus around trees, maybe being unaffected by the speed boost of roads (or maybe half the bonus?) would balance them out nicely. I found some variables like "self.fasteronroad" in components\locomotor.lua, but other than that I couldn't find a lot relating to the speed bonus. Any help will be greatly appreciated! Edited March 10, 2017 by Cherryzion Link to comment Share on other sites More sharing options...
CarlZalph Posted March 10, 2017 Share Posted March 10, 2017 @Romanful For your custom player have this in the master_postinit: local FasterOnRoad_old = inst.components.locomotor.FasterOnRoad inst.components.locomotor.FasterOnRoad = function(self, ...) self.fasteronroad = false return FasterOnRoad_old(self, ...) end Reason why I'm setting it constantly here is because if the player's state changes from something else (ghost/other mod/etc) then it might revert your edits, and it's much easier just keeping it set to false than having to bother with mod integration. I didn't quite test how this will affect client movement prediction when it's enabled, as I have it permanently disabled. Link to comment Share on other sites More sharing options...
RadiantRoma Posted March 10, 2017 Author Share Posted March 10, 2017 @CarlZalph It seems to work! Thanks! From how it looks, it disables the speed bonus altogether. Would it be possible to just reduce the bonus? Like I think roads increase speed by 50%, would it be possible to make it 25%? Link to comment Share on other sites More sharing options...
CarlZalph Posted March 10, 2017 Share Posted March 10, 2017 (edited) 6 minutes ago, Romanful said: Like I think roads increase speed by 50%, would it be possible to make it 25%? inst.components.locomotor.fastmultiplier = 0.5 I suppose this could also be a way to disable roads, by setting this to 1.0. (Though by doing this would also disable mounts getting speed bonuses) Edited March 10, 2017 by CarlZalph Link to comment Share on other sites More sharing options...
RadiantRoma Posted March 10, 2017 Author Share Posted March 10, 2017 15 minutes ago, CarlZalph said: inst.components.locomotor.fastmultiplier = 0.5 Would that only do it on roads, or for all fast multipliers (like the walking cane, or my custom tree speed bonus)? 17 minutes ago, CarlZalph said: (Though by doing this would also disable mounts getting speed All speed bonus? Or just speed bonus for roads? Because it would be sort of canon if the character wasn't good at riding animals either. Sorry for all the questions, just trying to be thorough! Link to comment Share on other sites More sharing options...
CarlZalph Posted March 10, 2017 Share Posted March 10, 2017 9 minutes ago, Romanful said: Would that only do it on roads, or for all fast multipliers (like the walking cane, or my custom tree speed bonus)? All speed bonus? Or just speed bonus for roads? Because it would be sort of canon if the character wasn't good at riding animals either. Sorry for all the questions, just trying to be thorough! Should only affect road bonus movement. Its only use is in the locomotor component itself: self.groundspeedmultiplier = self:FasterOnRoad() and ( (RoadManager ~= nil and RoadManager:IsOnRoad(x, 0, z)) or ground.Map:GetTileAtPoint(x, 0, z) == GROUND.ROAD ) and self.fastmultiplier or 1 Link to comment Share on other sites More sharing options...
RadiantRoma Posted March 10, 2017 Author Share Posted March 10, 2017 5 minutes ago, CarlZalph said: Should only affect road bonus movement. okay awesome. and i wouldn't need any of this, right? local FasterOnRoad_old = inst.components.locomotor.FasterOnRoad inst.components.locomotor.FasterOnRoad = function(self, ...) self.fasteronroad = false return FasterOnRoad_old(self, ...) end just inst.components.locomotor.fastmultiplier = 0.5 in master_postinit This is the last question, I swear! Thank you for all the help! Link to comment Share on other sites More sharing options...
CarlZalph Posted March 10, 2017 Share Posted March 10, 2017 7 minutes ago, Romanful said: okay awesome. and i wouldn't need any of this, right? local FasterOnRoad_old = inst.components.locomotor.FasterOnRoad inst.components.locomotor.FasterOnRoad = function(self, ...) self.fasteronroad = false return FasterOnRoad_old(self, ...) end just inst.components.locomotor.fastmultiplier = 0.5 in master_postinit This is the last question, I swear! Thank you for all the help! Yeah, that's to disable the non-mount bonuses. Just using the multiplier will affect both non-mount and mounted bonuses. Link to comment 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