LlamaDom Posted June 28, 2021 Share Posted June 28, 2021 Im trying to find a way to make it so if my custom item drops,the item is removed. Im honestly just trying to find a work around for when a custom item is dropped into water, it get removed, but i think the above way may give me hints as to how to do that. Link to comment https://forums.kleientertainment.com/forums/topic/131332-make-custom-item-dissapearbe-removed-on-drop/ Share on other sites More sharing options...
CarlZalph Posted June 28, 2021 Share Posted June 28, 2021 If you want, then you can flag your item to be able to float on the water if you don't want it to get removed by water. 2 Link to comment https://forums.kleientertainment.com/forums/topic/131332-make-custom-item-dissapearbe-removed-on-drop/#findComment-1474357 Share on other sites More sharing options...
LlamaDom Posted June 29, 2021 Author Share Posted June 29, 2021 3 hours ago, CarlZalph said: If you want, then you can flag your item to be able to float on the water if you don't want it to get removed by water. What do you mean by flag? like by adding MakeInventoryFloatable(inst, "idle_water", "idle") ? What do you mean by flag exactly? Link to comment https://forums.kleientertainment.com/forums/topic/131332-make-custom-item-dissapearbe-removed-on-drop/#findComment-1474421 Share on other sites More sharing options...
CarlZalph Posted June 29, 2021 Share Posted June 29, 2021 4 hours ago, LlamaDom said: What do you mean by flag? like by adding MakeInventoryFloatable(inst, "idle_water", "idle") ? What do you mean by flag exactly? Yeah that function wrapper there would do it. In programming, to flag something means to mark or denote. In this case it's noting to the other subsystems that the item should float rather than get swallowed up in the water through the means of a component. In other instances it may just be a boolean value being stored somewhere, or a bitmask getting a bit flipped. You can find that function's definition in scripts/standardcomponents.lua: function MakeInventoryFloatable(inst, size, offset, scale, swap_bank, float_index, swap_data) inst:AddComponent("floater") inst.components.floater:SetSize(size or "small") if offset ~= nil then inst.components.floater:SetVerticalOffset(offset) end if scale ~= nil then inst.components.floater:SetScale(scale) end if swap_bank then inst.components.floater:SetBankSwapOnFloat(swap_bank, float_index, swap_data) end end To make it more customized, you could look into the floater component itself to see if there's not more things you'd want to setup. But all of this is to try to confront the problem head on rather than making a workaround. From your first post it implies that having an item sink is undesirable as it kills off the entity and makes it irretrievable. Link to comment https://forums.kleientertainment.com/forums/topic/131332-make-custom-item-dissapearbe-removed-on-drop/#findComment-1474468 Share on other sites More sharing options...
LlamaDom Posted June 29, 2021 Author Share Posted June 29, 2021 2 hours ago, CarlZalph said: Yeah that function wrapper there would do it. In programming, to flag something means to mark or denote. In this case it's noting to the other subsystems that the item should float rather than get swallowed up in the water through the means of a component. In other instances it may just be a boolean value being stored somewhere, or a bitmask getting a bit flipped. You can find that function's definition in scripts/standardcomponents.lua: function MakeInventoryFloatable(inst, size, offset, scale, swap_bank, float_index, swap_data) inst:AddComponent("floater") inst.components.floater:SetSize(size or "small") if offset ~= nil then inst.components.floater:SetVerticalOffset(offset) end if scale ~= nil then inst.components.floater:SetScale(scale) end if swap_bank then inst.components.floater:SetBankSwapOnFloat(swap_bank, float_index, swap_data) end end To make it more customized, you could look into the floater component itself to see if there's not more things you'd want to setup. But all of this is to try to confront the problem head on rather than making a workaround. From your first post it implies that having an item sink is undesirable as it kills off the entity and makes it irretrievable. I would actually prefer for the item to sink rather than float! I thought it just might be easier to make it float rather than sink is all. Link to comment https://forums.kleientertainment.com/forums/topic/131332-make-custom-item-dissapearbe-removed-on-drop/#findComment-1474494 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