DirtyDan Posted May 11, 2014 Share Posted May 11, 2014 So I'm trying to make it so that when I use my custom item, it changes my character's build and stats, and also resets itself after 2 minutes back to the original stats and build. My custom item is currently a reskinned Healing salve, but I have no idea how to make it reset after 2 minutes after using it. Link to comment https://forums.kleientertainment.com/forums/topic/36317-need-a-little-coding-help/ Share on other sites More sharing options...
DevilXD Posted May 11, 2014 Share Posted May 11, 2014 Try: inst:DoTaskInTime(120, reset_function)... Link to comment https://forums.kleientertainment.com/forums/topic/36317-need-a-little-coding-help/#findComment-478421 Share on other sites More sharing options...
DevilXD Posted May 11, 2014 Share Posted May 11, 2014 It makes a task, that will call reset_function after 120 seconds (2 minutes)... reset_function receives inst as a first argument...PS.: Sorry for double post... Link to comment https://forums.kleientertainment.com/forums/topic/36317-need-a-little-coding-help/#findComment-478424 Share on other sites More sharing options...
DirtyDan Posted May 11, 2014 Author Share Posted May 11, 2014 It makes a task, that will call reset_function after 120 seconds (2 minutes)... reset_function receives inst as a first argument...PS.: Sorry for double post...I will try this, thanks so much Link to comment https://forums.kleientertainment.com/forums/topic/36317-need-a-little-coding-help/#findComment-478436 Share on other sites More sharing options...
DirtyDan Posted May 12, 2014 Author Share Posted May 12, 2014 How do I call the onuse function I have so I can change the stats and build in the first place? Link to comment https://forums.kleientertainment.com/forums/topic/36317-need-a-little-coding-help/#findComment-478576 Share on other sites More sharing options...
DevilXD Posted May 12, 2014 Share Posted May 12, 2014 Use useableitem component:inst:AddComponent("useableitem")inst.components.useableitem:SetOnUseFn(onuse_function) Link to comment https://forums.kleientertainment.com/forums/topic/36317-need-a-little-coding-help/#findComment-478658 Share on other sites More sharing options...
DirtyDan Posted May 12, 2014 Author Share Posted May 12, 2014 (edited) Use useableitem component:inst:AddComponent("useableitem")inst.components.useableitem:SetOnUseFn(onuse_function)I actually got it working by making it a Edible item, since it is a potion. I got it to go to the initial stat changes and build change, but now It won't revert after 2 mins with DoTaskInTime. EDIT: I found the problem. Ty very much. Edited May 12, 2014 by DirtyDan Link to comment https://forums.kleientertainment.com/forums/topic/36317-need-a-little-coding-help/#findComment-478661 Share on other sites More sharing options...
DevilXD Posted May 12, 2014 Share Posted May 12, 2014 You're welcome Link to comment https://forums.kleientertainment.com/forums/topic/36317-need-a-little-coding-help/#findComment-478679 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