Jump to content

Recommended Posts

Topic posted by Vdragoonen

Need help with 'onhealthchange' function and more

Error.jpg

Vdragoonen

          I have a feeling that my current predicament has a simple solution, but any help you can give would be appreciated. Currently, I am helping a friend of mine create a character. He is working on the art and I am working on the coding. This particular character is simple as what he does is the character gains a damage buff when the character health is low. The character's name has yet to be decided by my friend. What I had decided to do was created an "onhealthchange" function that I tried to base of Wolfgang's prefab file. This character does not change max health, hunger, or look. The only thing that occurs is a change in the variable (viewable in the esctemplate.lua) that I defined as "damage_mult". The "damage_mult" variable is equal to the "TUNING.ESCTEMPLATE_ATTACKMULT_NORMAL" which is what the "inst.components.combat.damagemultiplier" is equal to. The problem that I am currently facing (viewable in the Error.jpg) is that on line 41 of my esctemplate.lua prefab file it tells me that  'then' is expected near '='. As stated before I had based this mostly off the Wolfgang prefab file and from what I can tell this shouldn't be a problem. I am not sure where to go next to solve this problem so any help you can give would be greatly appreciated. Also just to note if I am doing this in an inefficient manner and there is a better way of going about this feel free to instruct me as to how it can be done. Additionally, such that I won't have to flood the forum with multiple topics if you have any advice pertaining as to how I could create a listener for when either the "damage_mult", "TUNING.ESCTEMPLATE_ ATTACKMULT_NORMAL", or "inst.components.combat.damagemultiplier" changes. Using this listener I want the character to make various statements and activate a sound cue for when he goes to various levels of damage multiplier power. Whichever one you recommend the listener to listen for is irrelevant, but I would prefer whichever one is the easiest one to code. One last request I have is if you know how to put a specific blueprint in a character's starting inventory then an explanation would be nice. If you don't have the time to explain it to me, but happen to know a mod that operates very similar to my description, feel free to tell me the name of the mod so I can download it on steam. Again, thanks to anyone who takes the time to read this whether or not you are able to help and thanks to everyone who comments below on how I might resolve this problem.

                                                                                                                                                                                                          Many thanks,                                                                                                                                                                                                                                    Vdragoonen

esctemplate.lua

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...