[Resolved] Access to Skill's Local variables in RPGUI in c#

(Thomas Mallen) #1

Hi. Before all and because is my first post here : Thanks to you @leslie for your awesome asset, and thanks to you @itsmars for your tuts. You’re really awesome guys.

So, I have a question.
I have a local variable on my skill (ManaCost btw), but in rpgui i cannot access it in rpgui in c#. I try since one hour without success. ()

if (slotType == ActionSlots.SlotType.Skill)
					// I use GetEquippedNfo to get reference to the definition
					Skill sk = Player.Instance.actionSlots.GetEquippedNfo(slotIdx) as Skill;
					if (sk != null)
                        plyVar v2 = sk.GetComponent<plyBlox>().GetLocalVariable("ManaCost");
                        Debug.Log(v2.ToString()); // RETURN NULL
                        Debug.Log(sk.blox.GetLocalVarValue("ManaCost")); // RETURN NULL

Thanks everybody.

(Thomas Mallen) #2

Auto-answer : sk.blox.GetLocalVariable(“ManaCost”).ToString()

(Leslie Young) #3

You should not use GetEquippedNfo since that returns the “prefab” of the Skill/ Item in that slot.

The GetEquipped function will give you a reference to the Skill objects that exists in the scene (which is a child object of the player object). You will see all the player objects if you expand the Player object in hierarchy.

Well, I guess it does not matter if the runtime variable data (mana cost) will not change.