• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

Some Help Understanding Cvars Please

Morkilimus

Refugee
I sincerely apologize if this has already been covered in this thread. I did some searching, but 424 pages is a lot of posts! XD

I am very intrigued by the possibilities that cvars provide, but I'm confused as to how to create a new cvar for a requirement check. Let's say you wanted to create an item set, where each of four pieces of clothing added .25 to a cvar value, and an effect proc'd when the value = 1 (so all four need to be worn). I understand how to add the buffs, set the requirement, and add particle effects, but how do you call on a cvar that doesn't exist?

Am I just not understanding how they're formed?

 
I was wondering the same thing. but i somewhere read that they are initialized at the first use or something like that...but this is not exact...it would be better if someone who knows told us.

I'll skip the A17.

...somewhere in .xml is written about this...in comments i seen it.

 
Last edited by a moderator:
From my understanding, when a cvar is referenced with a new value, it gets created.

Take a look at the A17b7patch cvar in the buffs.xml to see how it's set and referenced.

Code:
<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="$A17b7patch" operation="set" value="1"/>
I've done a fair amount of work with the cvars, but more with the SDX code than the XML properties.

 
So if I’m off to create a new cvar, I simply use the modifycvar action, ad if it doesn’t recognize the cvar as an existing one, it will create a new one? If that’s so, man that’s super easy, and really intuitive.

 
Yeah, the key is the operation="set". Not sure if "add" creates it if it doesn't exist; if it does, it probably initializes it to 0.

 
Back
Top