Scripts / Help with healing NPC script idea

Author
Message
Pink Panther
14
Years of Service
User Offline
Joined: 1st Feb 2010
Location:
Posted: 6th Feb 2019 16:46
Thought it would be nice to be able to walk up to an "injured" character and "heal" them with a key press. I am terrible at scripting but am trying to learn and have been studying scripts and working on this for a while. It kind of works but not really. The "injured" character does respond to the key press and is "healed" by standing, but there are problems. It only works on one character and I would like to place the script on multiple characters. ( I am sure that is a simple fix but I can't seem to figure it out). Also, I would like the "healed" animation to be the character standing in the idle animation rather than the gun drawn pose.
Of course it would be great if the player had to use med kits that were saved to heal the NPC, but that is way out of my league for now.
I am hoping the great scripters on this forum could help me sort this out and maybe even clean it up and make it better!




Thanks in advance
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 6th Feb 2019 18:54 Edited at: 6th Feb 2019 19:00
looks fine except you don't have any way to reset the "pressed" input so i assume that is why it only works once.
as for the animations, not sure what frames they are but you change the animation frames within the input part to the desired animation?
i.e. SetAnimationFrames(5090,5099)
to SetAnimationFrames(?,?)

i think you also want to wrap the prompt in only the injured state so it only shows before you heal the character



for checking a stored medkit, yes that is a bit more complicated but still only really 1 more variable depending on how you have the medkits stored on the player in the other script..
so if you had a variable that counts up as you collect medkits (say g_Medkits) your script could look something like this



then you need a script on the medkit collectable that has a line like


note: untested and written entirely in the reply box so might be mistakes but looks ok to me
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Pink Panther
14
Years of Service
User Offline
Joined: 1st Feb 2010
Location:
Posted: 6th Feb 2019 21:34 Edited at: 6th Feb 2019 21:39
Thank you smallg for the fast reply ! It works! I tweaked my animation choices so they look better, and I changed the input key to " H" for heal. The only thing I haven't quite got to work is the med kit collection and use. Thank you again! Below is my updated version. If you can add to it to make it better that would be great too!



PM
Pink Panther
14
Years of Service
User Offline
Joined: 1st Feb 2010
Location:
Posted: 6th Feb 2019 21:36 Edited at: 6th Feb 2019 21:41
Sorry. Don't know why I didn't get the code snippet to work that time. Never mind...got it
PM

Login to post a reply

Server time is: 2024-12-22 14:17:54
Your offset time is: 2024-12-22 14:17:54