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

CVars in XUI windows





*suddenly unborrows*


 


I'm trying to display a CVar value in the text of a label. Is this possible?


 


Also, is it possible to give the player a buff when they destroy a certain block?








 




For those interested, it's not possible through xpath alone. To display your own dynamic values (the stuff surrounded with curly braces) in windows.xml, you need to modify the C# assembly. Look at the parent elements for the "controller" attribute, prefix that value with XUiC_ and you'll have the name of the class you'll need to modify. The method to modify is
GetBindingValue.

 


You could make your own subclass and assign it via the controller attribute, but that wouldn't play as nicely with other mods as creating a patch.


 


As for giving the player a buff after they destroy a block, this doesn't seem to be implemented as of 17.4. There seems to have been the notion of it in the xml and in the C#, but not an implementation. I've not had the chance to go through 18 just yet to see if that's changed.


 


I was able to accomplish what I needed by patching Block.OnBlockDestroyedBy and BlockLoot.OnBlockDestroyedBy.


 


*borrows, disappearing completely*








 
Last edited by a moderator:
Back
Top