Jump to content

MCM menu - GetActorValue returns 0.0000


slarur

Recommended Posts

Hello. Im having a problem with my MCM menu. I need to show the current Magicka and health regeneration, but i can't get it to work. It shows value 0.00000. Here is the script:

Scriptname Test_Script_MCM extends SKI_ConfigBase

Actor Property PlayerRef Auto

Event OnConfigInit()

	Pages = new string[2]
	Pages[0] = "Testpage 1"
	Pages[1] = "Testpage 2"

EndEvent

Event OnPageReset(string page)

		float playerHealthRegen = PlayerRef.GetAV("Healrate")
		float playerMagickaRegen = PlayerRef.GetAV("Magickarate")

	if(page == "Testpage 1")

		SetCursorFillMode(LEFT_TO_RIGHT)
		AddHeaderOption("Magicka/Health regen")
		AddEmptyOption()
		AddTextOption("Magicka regen", playerMagickaRegen)
		AddTextOption("Health regen", playerHealthRegen)

	elseif(page == "Testpage 2")
		
		SetCursorFillMode(LEFT_TO_RIGHT)
		AddHeaderOption("Test")
		AddEmptyOption()

	endIf
EndEvent

Thank you for any help!

Edited by slarur
Link to comment
Share on other sites

Do you have any error messages in your papyrus log with regards to the processing of the script?

 

And if you have compiled your script, please make sure that the post contains the correct contents. Without a designation (i.e. Float) for the variables playerHealthRegen and playerMagikaRegen, I don't see how you managed to compile the script as you have posted it.

Link to comment
Share on other sites

Do you have any error messages in your papyrus log with regards to the processing of the script?

 

And if you have compiled your script, please make sure that the post contains the correct contents. Without a designation (i.e. Float) for the variables playerHealthRegen and playerMagikaRegen, I don't see how you managed to compile the script as you have posted it.

Thank you for answer. Yes im so sorry. It was a test I tried because i noticed that AddTextOption takes a string as value, but this didnt work. The variables is floating number like you say. And i also checked in papyrus log which gives me lots of errors like this: Error: Cannot call GetAV() on a None object, aborting function call

Link to comment
Share on other sites

Cannot call GetAV() on a None object is telling you that the PlayerRef variable has no data assigned to it.

 

Based on your posted code this tells me that you did not assign the appropriate data to the PlayerRef property. If you have not, make sure that you have filled the property with the correct data. To do this, highlight the script on the quest, click the properties button, use the new window that appears to assign the correct data. If the variable name for the property is the same as the Editor ID of the desired object, you can simply press auto-fill. If however, you used a generic variable name, you will need to select the property and use the data fields that appear on the right hand side of the window to enter the desired object.

Link to comment
Share on other sites

Cannot call GetAV() on a None object is telling you that the PlayerRef variable has no data assigned to it.

 

Based on your posted code this tells me that you did not assign the appropriate data to the PlayerRef property. If you have not, make sure that you have filled the property with the correct data. To do this, highlight the script on the quest, click the properties button, use the new window that appears to assign the correct data. If the variable name for the property is the same as the Editor ID of the desired object, you can simply press auto-fill. If however, you used a generic variable name, you will need to select the property and use the data fields that appear on the right hand side of the window to enter the desired object.

That was it! Thank you so much :D

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...