Lokoluna Posted November 7, 2016 Share Posted November 7, 2016 I'm not familiar with making something auto do something that's intended to do with said input by oneself, I took a mod from the workshop that "auto catches" the said boomerang, but it fails to ever work. How would I go about starting to make it so the boomerang when in my characters proximity will be auto caught? Link to comment https://forums.kleientertainment.com/forums/topic/71508-mod-boomerang-auto-catch/ Share on other sites More sharing options...
Serpens Posted November 8, 2016 Share Posted November 8, 2016 I have this auto catch mod and it does work:http://steamcommunity.com/sharedfiles/filedetails/?id=371920345 I took a quick look at the code some months ago and I think it was very comlicated, especially for a beginner. I think I, not expert, not beginner, would take hours to make such a mod. Link to comment https://forums.kleientertainment.com/forums/topic/71508-mod-boomerang-auto-catch/#findComment-834815 Share on other sites More sharing options...
. . . Posted November 8, 2016 Share Posted November 8, 2016 AddPrefabPostInit("boomerang", -- Put your catchable prefab here or just keep it boomerang if u want boomerang auto-catch function(inst) if(inst.components and inst.components.projectile) then local hit_old = inst.components.projectile.Hit or function(...) end inst.components.projectile.Hit = function(inst, target, ...) local owner = inst.owner if(target and owner and owner==target and owner.prefab=="YOUR CHARACTER NAME HERE") then if(owner.sg) then owner.sg:GoToState("catch") end inst:Catch(owner) else hit_old(inst, target, ...) end end local onthrown_old = inst.components.projectile.onthrown or function(...) end inst.components.projectile.onthrown = function(inst, owner, target, ...) if(owner and owner.prefab=="YOUR CHARACTER NAME HERE") then end onthrown_old(inst, owner, target, ...) end end end ) You'd put this code in your modmain.lua, credit to CarlZalph. Link to comment https://forums.kleientertainment.com/forums/topic/71508-mod-boomerang-auto-catch/#findComment-834817 Share on other sites More sharing options...
CarlZalph Posted November 8, 2016 Share Posted November 8, 2016 It wouldn't need the second portion, seeming as there aren't any edits for when it is thrown. AddPrefabPostInit("boomerang", function(inst) if(inst.components and inst.components.projectile) then local hit_old = inst.components.projectile.Hit or function(...) end inst.components.projectile.Hit = function(inst, target, ...) local owner = inst.owner if(target and owner and owner==target and owner.prefab=="wilson") then if(owner.sg) then owner.sg:GoToState("catch") end inst:Catch(owner) else hit_old(inst, target, ...) end end end end ) Link to comment https://forums.kleientertainment.com/forums/topic/71508-mod-boomerang-auto-catch/#findComment-834822 Share on other sites More sharing options...
Lokoluna Posted November 8, 2016 Author Share Posted November 8, 2016 (edited) 2 hours ago, CarlZalph said: It wouldn't need the second portion, seeming as there aren't any edits for when it is thrown. AddPrefabPostInit("boomerang", function(inst) if(inst.components and inst.components.projectile) then local hit_old = inst.components.projectile.Hit or function(...) end inst.components.projectile.Hit = function(inst, target, ...) local owner = inst.owner if(target and owner and owner==target and owner.prefab=="wilson") then if(owner.sg) then owner.sg:GoToState("catch") end inst:Catch(owner) else hit_old(inst, target, ...) end end end end ) Works like a charm, thank you both! But.. is there a way to remove the small "stun" when you catch it? Also if there's a way to increase the range too. IF not that's perfectly fine, would just make this far more enjoyable if i could get that down. Edited November 8, 2016 by Lokoluna Link to comment https://forums.kleientertainment.com/forums/topic/71508-mod-boomerang-auto-catch/#findComment-834857 Share on other sites More sharing options...
CarlZalph Posted November 8, 2016 Share Posted November 8, 2016 1 hour ago, Lokoluna said: Works like a charm, thank you both! But.. is there a way to remove the small "stun" when you catch it? Also if there's a way to increase the range too. IF not that's perfectly fine, would just make this far more enjoyable if i could get that down. By removing the portion about going to the state "catch" it should also stop the animation/stun you're feeling. Link to comment https://forums.kleientertainment.com/forums/topic/71508-mod-boomerang-auto-catch/#findComment-834888 Share on other sites More sharing options...
Lokoluna Posted November 8, 2016 Author Share Posted November 8, 2016 8 minutes ago, CarlZalph said: By removing the portion about going to the state "catch" it should also stop the animation/stun you're feeling. Thanks a million. I appreciate your time and effort. Works perfectly now Link to comment https://forums.kleientertainment.com/forums/topic/71508-mod-boomerang-auto-catch/#findComment-834895 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