News:

SMFNew Installed

+-+-

User+-

Welcome, Guest.
Please login or register.
 
 
 

Login with your social network

Forgot your password?

Site Stats+-

Members
Total Members: 728
Latest: Cho
New This Month: 0
New This Week: 0
New Today: 0
Stats
Total Posts: 10932
Total Topics: 795
Most Online Today: 389
Most Online Ever: 854
(September 18, 2024, 07:49:37 am)
Users Online
Members: 0
Guests: 53
Total: 53

Author Topic: HP Stat Watchers?  (Read 2569 times)

0 Members and 1 Guest are viewing this topic.

HP Stat Watchers?
« on: »
I've been trying to get a mechanic to work and I just can't seem to get it to register any type of hp?

Basically, I want this weapon to fire a projectile at 100% life, and not otherwise. I used the rifle as a reference and created my item, the skill, the particle, the missile, yadda yadda.

End result, I cannot seem to get a statwatcher to work for HP, Max HP, or HP PCT

Is there a way to get it to actually watch hp percentage?

Share on Bluesky Share on Facebook


Re: HP Stat Watchers?
« Reply #1 on: »
The stat you want is "HP %"
Make sure to declare the stat as a predefined int before you use it, since it's not included in vanilla TL2.

Re: HP Stat Watchers?
« Reply #2 on: »
Worked a beauty, thanks mate!

Are there any other really useful stats like this that I should know about, and is there a way I could explore them on my own?

Again, thanks a bunch! :D

Re: HP Stat Watchers?
« Reply #3 on: »
The stat you want is "HP %"
Make sure to declare the stat as a predefined int before you use it, since it's not included in vanilla TL2.

Mind me asking why there's a need to do that? The HP % stat is a static stat already in the game, you can evaluate it with a stat evaluator?

Re: HP Stat Watchers?
« Reply #4 on: »
Pretty sure it's not defined in vanilla TL2. At least it's not in my MEDIA/STATS/ directory.

Re: HP Stat Watchers?
« Reply #5 on: »
Are there any other really useful stats like this that I should know about, and is there a way I could explore them on my own?

docs.runicgames.com

Re: HP Stat Watchers?
« Reply #6 on: »
Well I'll be damned, never realised the need to (re)declare static stats already known by the game. This could explain why I never got perks to trigger with the PLAYERSTAT task... I always suspected there was a connection between perks and stat watchers.

Re: HP Stat Watchers?
« Reply #7 on: »
Yep, you need a declaration in MEDIA/STATS/ to associate a hardcoded variable in the executable with a stat object in the statwatcher system. Vanilla TL2 only declares a fraction of the accessible hardcoded variables (list), so you need to declare the others if you want to use them.

Three more notes that may be of interest:
1. The connection between a hardcoded variable and a stat object is one-way. You can read the hardcoded variable via the stat object, but you cannot change its value.

2. The a stat object is, in C parlance, volatile. Its value can change nonprogrammatically, in the middle of a function. If you need a guarantee that the value will be consistent over multiple reads, then you need to copy the value to a custom stat once at the start of your function and read from that.

3. Some of the issues with floats not working well with statwatchers can be overcome by declaring the stat object as a predefined int. The program seems to handle casting the float to int just fine in this context.

 

Recent Topics+-