Thomas Die Posted January 27, 2019 Share Posted January 27, 2019 local function plyerdeath(isnt) local owner = inst.follower.leader if owner:HasTag("playerghost") then inst.components.health:DoDelta(-400) end end i don't understand why this doesn't work , the point of this is that when the leader dies then they all die like maxwell's puppets if you have any insight that could help your welcome to share Link to comment Share on other sites More sharing options...
Ultroman Posted January 27, 2019 Share Posted January 27, 2019 (edited) Well, this is all wrong local function plyerdeath(isnt) but I'm guessing that's just typos. The best thing you can do here, is simply print what the state is, so you can see if your function is called at all, whether the follower still has a leader at this point, and whether that leader is a ghost or not. I would also check the leader's health-component to see what the current health is. The latter might be a better metric than checking for the ghost-tag, who knows? It depends on the exact time this function is called. IIRC there is some discrepancy between when the player died, becomes a ghost, and when his health is reset to maximum. I can't quite remember. Just use print-statements to print out what you want to know, and you can look at your logs afterwards to see what happened. print("currenthealth: "..owner.components.health.current) print("follower has leader: "..(inst.components.follower.leader ~= nil)) Things like that. Just remember to check if the components are there before trying to print from them, and if they aren't, print that the component isn't there, so you know what is going on. NOTE: Please use the <> button when putting code in your posts. Edited January 27, 2019 by Ultroman Link to comment Share on other sites More sharing options...
Thomas Die Posted January 27, 2019 Author Share Posted January 27, 2019 cool thnx btw isn't typo Link to comment Share on other sites More sharing options...
Ultroman Posted January 28, 2019 Share Posted January 28, 2019 17 hours ago, thomas4845 said: cool thnx btw isn't typo But your parameter is called "isnt" and you're trying to use it as "inst". Link to comment Share on other sites More sharing options...
Thomas Die Posted January 29, 2019 Author Share Posted January 29, 2019 Oh sorry thought you meant plyr death sorry 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