Jump to content

Need Script Help/Advice (ESC Template)

Recommended Posts

Hello! I am working on a character mod with the Extended Character Sample Template and I was wondering if it was possible to give a character a perk to be healed by a certain item. Like if a character is healed by gold and they have gold in their inventory/backpack, it would make their health slowly rise until it reached max, kinda like how jellybeans work when you eat them, except you would just hold onto them. Is this possible and if so, how would one input that? This is my first mod and I'm making it as a gift for someone lol, so I'm not very good at scripts and what not. 

Link to comment
Share on other sites

Create a new component. In its update function you have a timer governing the interval at which the character gets healed. Every time the time interval is reached, reset it, and then you go through his inventory (and backpack? Depending on the item, also his equipment slots?), searching for the items. Stop when you reach an item that heals him, or count up all the items if you want to heal more per item. Then access the health-component, and call health:DoDelta with the change you want to apply (and the other parameters).

If you don't know how to program, it's not going to be easy. You should take some LUA tutorials, and look at other character mods doing a similar thing. Here's a crash course.

Edited by Ultroman
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...