Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.

New to the forum? Say hello in this topic! Also make sure to read the rules.

Add IObject.SetMaxHealth()

Give us your input on how we may improve the ScriptAPI in the game in future versions.
Forum rules
By using the forum you agree to the following rules.
Post Reply
NearHuscarl
Superfighter
Superfighter
Posts: 97
Joined: Thu Feb 07, 2019 4:36 am

Add IObject.SetMaxHealth()

Post by NearHuscarl » Thu Mar 05, 2020 3:22 pm

It would be nice if you can override the default max health of an IObject similar to IPlayer
0 x
Image

User avatar
JakSparro98
Superfighter
Superfighter
Posts: 530
Joined: Fri Jul 15, 2016 7:56 pm
Started SFD: PreAlpha 1.0.5
Location: Rome, Italy
Gender:
Age: 25

Post by JakSparro98 » Fri Mar 06, 2020 12:30 am

Changing players health is possible only by using modifiers, there is no such a similar system for simple objects (yet), the only workaround used so far consists in listening for health difference over time and applying some extra health to simulate some sort of extension for that latter.
0 x

NearHuscarl
Superfighter
Superfighter
Posts: 97
Joined: Thu Feb 07, 2019 4:36 am

Post by NearHuscarl » Fri Mar 06, 2020 3:34 am

It's not working very well for very low health objects that have like 1-5hp. Because on every OnDamage call, I likely have to recreate a new object and in my case, I have to remove and readd all of the target objects that associate with a marker even if only one of them need to be readded or thing will break down.

Another side effects is that some objects when badly damage will be removed and another destroyed version of it will be created (Rug00A and Rug00A_D). I cannot find a good solution to detect and remove those objects and already given up.

I think IObject.SetMaxHealth() is a much easier solution if the devs can add it. I don't think it will need fancy modifiers since it's not a complex object like IPlayer. Simply expose a set property for us to modify the max health is enough.
0 x
Image

User avatar
JakSparro98
Superfighter
Superfighter
Posts: 530
Joined: Fri Jul 15, 2016 7:56 pm
Started SFD: PreAlpha 1.0.5
Location: Rome, Italy
Gender:
Age: 25

Post by JakSparro98 » Fri Mar 06, 2020 9:29 pm

Refactoring a game feature is not a trivial task, especially when talking about online multiplayer games, more than ever the devs are now focused on experimenting a new title and I assume they are far from altering the health system, honestly I would be very glad to be wrong but it appears to me to be very unlikely to be done in short time (if ever).
0 x

User avatar
Gurt
Lead Programmer
Lead Programmer
Posts: 1884
Joined: Sun Feb 28, 2016 3:22 pm
Title: Lead programmer
Started SFD: Made it!
Location: Sweden
Gender:
Age: 34

Post by Gurt » Sun Mar 22, 2020 1:19 pm

Can you please elaborate more on what you're trying to achieve?
We can't change the max health of objects due to optimizations and assumetions in underlaying network traffic code. Every bit counts there.
Do you want to change an object (for example a crate) to become undestructable like concrete? Some objects in SFD are supposed to behave in certain ways (like explosive barrels will always explode from projectiles) and changing this behavior can cause confusion on the end player - thinking it might be a bug in the game itself.
0 x
Gurt

NearHuscarl
Superfighter
Superfighter
Posts: 97
Joined: Thu Feb 07, 2019 4:36 am

Post by NearHuscarl » Sun Mar 22, 2020 6:19 pm

Ah I see, so it's not as simple as I thought. In my case I have a sentry gun that's made of smaller components:

Image

As you can see, the body is made of several debris objects which have very low hp. But I want a much higher health for some of the turret components. I currently have this component class, right now its only purpose is to recreate the same object when the real health reaches 0 until the much higher virtual health reaches 0 too.

Before that I have the assumption that when the IObject's health is 0, it will be removed in the future, but after setting IObject health back to non-zero value in the OnDamage callback, it will halt the object removal too. So my problem is partly solved now.

btw I have a small suggestion. I'd like to know if the object is indestructable. Currently I have a helper method to let you know that by simply compare the max health to 1. But having an official way to know would be nicer. Something like IObject.IsIndestructible?
0 x
Image

Post Reply