Jump to content

How do I set Max health/stamina to a CVar?


calaverinha

Recommended Posts

In this case here, for a buff:

 

<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="blockperc" operation="set" value="@ ? "/>

<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="blockperc" operation="divide" value="10"/>
<passive_effect name="HealthMaxBlockage" operation="base_add" value="@blockperc"/>

 

What should I use? I want my buff to reserve 10% of my max health.

Link to comment
Share on other sites


				<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="TotalHealth" operation="set" value="200"/>
				<passive_effect name="HealthMax" operation="base_set" value="@TotalHealth"/>

I set a cvar to a number, then use that passive to set the health to that cvar, then i can do math to that cvar and it writes that final number to maxhealth. You'd have to have a health cvar, a block percent cvar, then also a block amount cvar, and do math between the two and write the final back to the health cvar.

Something like this, with each name as a it's own cvar:

Totalhealth  = 100
BlockPerc = .1
Totalhealth x BlockPerc = TotalBlock
Totalhealth - TotalBlock = FinalNumber
Totalhealth = FinalNumber

Could be another easier way, but my tired brain isn't working 100% tonight, so this is what i got. lol

Link to comment
Share on other sites

<buff name="get_max_life" hidden="true">
	<duration value="1"/>
	<stack_type value="replace"/>
		<effect_group>
			<triggered_effect trigger="onSelfBuffUpdate" action="ModifyCVar" cvar="TotalStat" operation="set" value="100"/>
			<triggered_effect trigger="onSelfBuffUpdate" action="ModifyCVar" cvar="TotalStat" operation="add" value="@$LastPlayerLevel">
				<requirement name="PlayerLevel" operation="LTE" value="100"/></triggered_effect>
		</effect_group>
		<effect_group>
			<triggered_effect trigger="onSelfBuffUpdate" action="ModifyCVar" cvar="TotalStat" operation="set" value="200">
				<requirement name="PlayerLevel" operation="GT" value="100"/></triggered_effect>
     	</effect_group>
</buff>

This worked. Now I can work on some life % over time buffs.

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
×
×
  • Create New...