Nerune Posted March 8, 2016 Share Posted March 8, 2016 I've tried following so many steps on this; And many other threads on coding the same thing. It's just that, it never works for me at all, no matter what I do, no matter on how many edits I make that it's supposed to "help" according to these threads. I even tried Wigfrid's battleborn code, yet it still doesn't work. I'm not a scripter at all though, I just need help just this once to make this character function without it crashing my game. If you can help, thank you I would really appreciate it. Link to comment https://forums.kleientertainment.com/forums/topic/65247-please-help-with-coding-a-kill-gives-sanity-script/ Share on other sites More sharing options...
Arkathorn Posted March 9, 2016 Share Posted March 9, 2016 (edited) This should work (Put it in your character's prefab file.): inst:ListenForEvent("killed",function(inst,data) inst.components.sanity:DoDelta(15) --Restores 15 sanity end) Edited March 9, 2016 by Arkathorn Link to comment https://forums.kleientertainment.com/forums/topic/65247-please-help-with-coding-a-kill-gives-sanity-script/#findComment-731781 Share on other sites More sharing options...
Mobbstar Posted March 9, 2016 Share Posted March 9, 2016 13 minutes ago, Arkathorn said: DoDelta(15) --Restores 50 sanity uh... I don't think this is quite correct. Link to comment https://forums.kleientertainment.com/forums/topic/65247-please-help-with-coding-a-kill-gives-sanity-script/#findComment-731791 Share on other sites More sharing options...
Nerune Posted March 9, 2016 Author Share Posted March 9, 2016 4 hours ago, Arkathorn said: This should work (Put it in your character's prefab file.): inst:ListenForEvent("killed",function(inst,data) inst.components.sanity:DoDelta(15) --Restores 15 sanity end) I have tried the code, it didn't work, it gave me this error: https://gyazo.com/ac8b8a7942fc88c34288fb3253298cbb Do you have to put it as a local function to define it like the rest of the inst strings? Link to comment https://forums.kleientertainment.com/forums/topic/65247-please-help-with-coding-a-kill-gives-sanity-script/#findComment-731885 Share on other sites More sharing options...
Mobbstar Posted March 9, 2016 Share Posted March 9, 2016 15 minutes ago, Nerune said: I have tried the code, it didn't work, it gave me this error: Do you have to put it as a local function to define it like the rest of the inst strings? No, you put it into the postinit function. inst.soundname = "winnie" --your code here inst.components.health:SetBlabla(150) Link to comment https://forums.kleientertainment.com/forums/topic/65247-please-help-with-coding-a-kill-gives-sanity-script/#findComment-731892 Share on other sites More sharing options...
Nerune Posted March 9, 2016 Author Share Posted March 9, 2016 11 minutes ago, Mobbstar said: No, you put it into the postinit function. inst.soundname = "winnie" --your code here inst.components.health:SetBlabla(150) Thank you so much, It works like a charm! Link to comment https://forums.kleientertainment.com/forums/topic/65247-please-help-with-coding-a-kill-gives-sanity-script/#findComment-731898 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