Product Chat / Health

Author
Message
Rector
5
Years of Service
User Offline
Joined: 11th May 2019
Location: Manchester
Posted: 30th Dec 2021 17:02
Is there a way to make any object give you more health if picked up?

For instance a plate, cup, flowers etc?

I have tried replacing the script with the health LUA but no joy. All it does is give me negative energy?
Processor i9-9900k CPU@ 3.60GHZ
Ram 32GB
Windows 10 64bit
GeForce RTX 2060
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 30th Dec 2021 17:52
There are settings in the .fpe file that are needed.

Compare the .fpe file from one of the health collectables to a model you are trying to use to see what is missing.
Been there, done that, got all the T-Shirts!
PM
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 30th Dec 2021 18:00 Edited at: 30th Dec 2021 18:28
The health.lua isn't really the best script for health in games. It seems they keep reverting the changes we sent them too over github years ago. Likely due to new DLCs making those changes. I remember fixing that one myself a while back so that it doesn't go into negatives or above maximum. But looks like its reverted back to being a buggy mess. Technically you should be able to set the value of health within the editor and not with opening up either Lua files or FPE files. Unfortunately this is not the case with this stock script.

Anywho, the health.lua script currently uses AddPlayerHealth(e) command which references the FPE file of the health item entity. The line that says "quantity = 10" for example. If you are using a custom entity, it wont give any health and may instead hurt the player because its trying to locate the value of quantity and because this line doesn't exist, it doesn't have a value of 0 even instead its nil, so it hurts the player instead.

For example take a look at the medkit entity FPE file in entitybank\Collectables\medkit.fpi , it has a quality value of 250 and there heals the player by 250.

If you are using a custom entity as a health object, edit that objects FPE file and add a quantity line. For example:
quantity = 10

It will then heal the player when you collect it.

EDIT: as Amen just said, compare your entities FPE file with the stock ones, like the medkit or chips for example
Store Assets - Store Link
Free Assets - Resource Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960

Login to post a reply

Server time is: 2024-10-18 06:33:41
Your offset time is: 2024-10-18 06:33:41