PocketPossum Posted January 28 Share Posted January 28 Hi! for a mod character I'm working on, one of her craftable weapons is a single use syringe, that's supposed to drop a food item after it breaks. It breaks after hitting an enemy once. Is there a way to make it so rather than just deleting the item when its broken, it spawns another item first? Either in inventory, or on the ground. Thank you for any help. Link to comment https://forums.kleientertainment.com/forums/topic/169653-how-would-i-make-an-item-dropget-replaced-with-a-different-on-breaking/ Share on other sites More sharing options...
Meepenator Posted January 28 Share Posted January 28 spear1.lua used a spear for example but everything you need is here, it'll spawn whatever prefab you replace it with at the owner's feet and die in 1 use. Link to comment https://forums.kleientertainment.com/forums/topic/169653-how-would-i-make-an-item-dropget-replaced-with-a-different-on-breaking/#findComment-1850154 Share on other sites More sharing options...
PocketPossum Posted January 28 Author Share Posted January 28 9 minutes ago, Meepenator said: spear1.lua used a spear for example but everything you need is here, it'll spawn whatever prefab you replace it with at the owner's feet and die in 1 use. Thank you so much for that. Link to comment https://forums.kleientertainment.com/forums/topic/169653-how-would-i-make-an-item-dropget-replaced-with-a-different-on-breaking/#findComment-1850155 Share on other sites More sharing options...
Meepenator Posted January 28 Share Posted January 28 One small thing I didn't put though is what enemy. No matter what it hits it'll always spawn the thing i.e spiders, walls, lure plants doesn't matter, but idk if you care about that lol 10 minutes ago, PocketPossum said: Thank you so much for that. Link to comment https://forums.kleientertainment.com/forums/topic/169653-how-would-i-make-an-item-dropget-replaced-with-a-different-on-breaking/#findComment-1850156 Share on other sites More sharing options...
PocketPossum Posted January 28 Author Share Posted January 28 19 minutes ago, Meepenator said: One small thing I didn't put though is what enemy. No matter what it hits it'll always spawn the thing i.e spiders, walls, lure plants doesn't matter, but idk if you care about that lol Uh, my only preference is like, having it drop specific items if it hits players instead of enemies. Which, if I wanna do that, would it be something like this? local function onattack_spear1(inst, owner, target) if target:HasTag ("valkyrie") then local spearspawn = SpawnPrefab("wathgrithr_blood") --spawn whatever item you want here! if spearspawn ~= nil then spearspawn.Transform:SetPosition(owner.Transform:GetWorldPosition()) end elseif target:HasTag ("pyromaniac") then local spearspawn = SpawnPrefab("willow_blood") --spawn whatever item you want here! if spearspawn ~= nil then spearspawn.Transform:SetPosition(owner.Transform:GetWorldPosition()) end else local spearspawn = SpawnPrefab("spear") --spawn whatever item you want here! if spearspawn ~= nil then spearspawn.Transform:SetPosition(owner.Transform:GetWorldPosition()) end end end Link to comment https://forums.kleientertainment.com/forums/topic/169653-how-would-i-make-an-item-dropget-replaced-with-a-different-on-breaking/#findComment-1850158 Share on other sites More sharing options...
Meepenator Posted January 28 Share Posted January 28 I'm fairly certain that should work, but I'd say try it out on a pvp server and just spawn in bots if you're not sure. Link to comment https://forums.kleientertainment.com/forums/topic/169653-how-would-i-make-an-item-dropget-replaced-with-a-different-on-breaking/#findComment-1850161 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