Augustusc Posted May 31, 2017 Share Posted May 31, 2017 Hello! I need help adding this code to a custom item for my character. the code is as follows (thanks DarkXero) local pos = inst:GetPosition() local ents = TheSim:FindEntities(pos.x, pos.y, pos.z, 10, {"playerghost"}) for i, v in ipairs(ents) do v:PushEvent("respawnfromghost") end My problem is i don't know where to add it in the item. The item is a pan flute, but its a copy so it doesnt interfere with the original panflute. I want to remove the sleeping effect and replace it with this one. Link to comment Share on other sites More sharing options...
alainmcd Posted May 31, 2017 Share Posted May 31, 2017 If you're using the panflute as a template, you don't need to call TheSim:FindEntities, that's already taken care of by the instrument component. Instead, replace your HearPanFlute with this function: local function HearPanFlute(inst, musician, instrument) if (inst:HasTag("playerghost")) then inst:PushEvent("respawnfromghost") end end Untested, but it should work. Link to comment Share on other sites More sharing options...
Augustusc Posted June 1, 2017 Author Share Posted June 1, 2017 Works flawlessly! Thank you so much! 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