Jump to content

[SOLVED] Question


Recommended Posts

Hello, sorry but I really need to know the answer to this question...

So, what's the difference between "inst.components.health.absorb = .25" & "inst.components.health:SetAbsorptionAmount(0.25)"?

 

Edited by SuperDavid
Link to comment
Share on other sites

@SuperDavid There's no difference, because the implementation of classes they have for the game doesn't support private instance variables (in a language/environment that does, things like self.absorb would only be accessible from inside the class, not by things outside; the function they provide to set absorb is a carryover from that style of programming, which is sometimes considered more "proper").

Link to comment
Share on other sites

use the function, if there is one.

Cause e.g my mod also changes this value.
And to be compatible to other mods that change this value, I "Listen" to the function "SetAbsorptionAmount".
If you change this helath.absorb directly during a running game, you mod won't be compatible to my mod.
http://steamcommunity.com/sharedfiles/filedetails/?id=738448215

if you also changing this value during a running game, you should be very careful and make sure, that you can remove this bonus properly without removing boni from other mods.
If you just give your character a permanent absorb bonus, then there is no need to be careful I think.

Edited by Serpens
Link to comment
Share on other sites

The difference is that the setter function form can be extended with sanity checks, for example. Or it can be used to notify another object (e.g., a replica) that a change has taken place.

So it is preferable to use the setter function form.

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
 Share

×
  • Create New...