Chesed Posted October 23 Share Posted October 23 (edited) I’m making a custom boomerang for a friend’s character mod. The idea is that the boomerang is unbreakable, but is cursed and is stuck in the inventory of their mod character. So far I have it so the boomerang can't be stored or stolen, and is kept on death. They also catch the boomerang after taking damage if it hits them on the return. Since the boomerang is a throwable weapon I’m having difficulty getting it to stay bound to the character’s inventory. These are the main issues: If the mod character gets hit by the boomerang and dies, the boomerang hovers in midair permanently since the dying/dead character can’t catch it. Preferably I want it to either sneak into their inventory or delete itself so I can create a new one when the character respawns without it. Whatever is easiest. (I just don’t know how to get it to detect that it has killed its owner so it can do this.) Fixed! The boomerang can be dropped. I found an old thread detailing how to make an item undroppable using AddComponentPostInit to check for a tag before dropping the item, but this causes a crash when the boomerang is thrown. I just want the boomerang to give itself back to you if you try to put it down. Fixed! Again, the boomerang has infinite durability, so workarounds involving deleting the boomerang and giving the character a new one are fine. I am already looking at the code of Lucy and Cursed Monkey Trinkets to try and figure something out, but I feel like there's a simpler way to do this. I've attached the boomerang itself in case people want to look at it, but it's kind of a, unfinished mess of me figuring stuff out on the fly and troubleshooting. Sorry. wulfen_boomerang.lua Edited October 29 by Chesed Solved Link to comment Share on other sites More sharing options...
Haruhi Kawaii Posted October 24 Share Posted October 24 21 hours ago, Chesed said: I’m making a custom boomerang for a friend’s character mod. The idea is that the boomerang is unbreakable, but is cursed and is stuck in the inventory of their mod character. So far I have it so the boomerang can't be stored or stolen, and is kept on death. They also catch the boomerang after taking damage if it hits them on the return. Since the boomerang is a throwable weapon I’m having difficulty getting it to stay bound to the character’s inventory. These are the main issues: If the mod character gets hit by the boomerang and dies, the boomerang hovers in midair permanently since the dying/dead character can’t catch it. Preferably I want it to either sneak into their inventory or delete itself so I can create a new one when the character respawns without it. Whatever is easiest. (I just don’t know how to get it to detect that it has killed its owner so it can do this.) The boomerang can be dropped. I found an old thread detailing how to make an item undroppable using AddComponentPostInit to check for a tag before dropping the item, but this causes a crash when the boomerang is thrown. I just want the boomerang to give itself back to you if you try to put it down. Again, the boomerang has infinite durability, so workarounds involving deleting the boomerang and giving the character a new one are fine. I am already looking at the code of Lucy and Cursed Monkey Trinkets to try and figure something out, but I feel like there's a simpler way to do this. I've attached the boomerang itself in case people want to look at it, but it's kind of a, unfinished mess of me figuring stuff out on the fly and troubleshooting. Sorry. wulfen_boomerang.lua 5.67 kB · 1 download local boomerang = nil local function deathbyboomerang(inst, data) local afflicter = data and data.afflicter if afflicter and afflicter:IsValid() and afflicter == boomerang then afflicter:Remove() end end local function OnEquip(inst, owner) owner.AnimState:OverrideSymbol("swap_object", "swap_wulfen_boomerang", "swap_wulfen_boomerang") boomerang = inst owner.AnimState:Show("ARM_carry") owner.AnimState:Hide("ARM_normal") owner:ListenForEvent("death", deathbyboomerang) end It doesn't look perfect but maybe it will work 1 Link to comment Share on other sites More sharing options...
Chesed Posted October 24 Author Share Posted October 24 8 hours ago, Haruhi Kawaii said: local boomerang = nil local function deathbyboomerang(inst, data) local afflicter = data and data.afflicter if afflicter and afflicter:IsValid() and afflicter == boomerang then afflicter:Remove() end end local function OnEquip(inst, owner) owner.AnimState:OverrideSymbol("swap_object", "swap_wulfen_boomerang", "swap_wulfen_boomerang") boomerang = inst owner.AnimState:Show("ARM_carry") owner.AnimState:Hide("ARM_normal") owner:ListenForEvent("death", deathbyboomerang) end It doesn't look perfect but maybe it will work This works perfectly to solve my first issue, thank you! Link to comment Share on other sites More sharing options...
Haruhi Kawaii Posted October 27 Share Posted October 27 On 10/25/2023 at 1:24 AM, Chesed said: This works perfectly to solve my first issue, thank you! local oldDROP = ACTIONS.DROP.fn ACTIONS.DROP.fn = function(act) if act.invobject ~= nil and act.invobject.components.equippable ~= nil and act.invobject:HasTag("thrown") then return nil else return oldDROP(act) end end This will probably work, I found it from another mod but I'm not sure what the effects will be 1 Link to comment Share on other sites More sharing options...
Chesed Posted October 29 Author Share Posted October 29 (edited) On 10/27/2023 at 10:36 AM, Haruhi Kawaii said: local oldDROP = ACTIONS.DROP.fn ACTIONS.DROP.fn = function(act) if act.invobject ~= nil and act.invobject.components.equippable ~= nil and act.invobject:HasTag("thrown") then return nil else return oldDROP(act) end end This will probably work, I found it from another mod but I'm not sure what the effects will be This one works without crashing when the item is thrown. Thank you so much! I think I've ironed out the remaining things (e.g. respawning the item) by myself, so my issue is solved now. Thank you again for the help. Edited October 29 by Chesed 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