Page 1 of 1
Using a variable to get player
Posted: Thu Jun 18, 2020 10:18 pm
by nathanj
Hey, Tony
I'm trying to get UCC attributes for my player using variables.
I'm able to assign the player's dynamically on start using
Code: Select all
DialogueLua.SetVariable("PlayerName", newPlayer.NickName);
But what I'm stuck on is using that value trying to retrieve the player's attributes, such as
Code: Select all
Variable["Health"] = uccGetAttribute([var=PlayerName], "Health");
I've also tried
Code: Select all
Variable["Health"] = uccGetAttribute("[var=PlayerName]", "Health");
, but that didn't work. You mind pointing out how I can do this?
Thank you,
Nathan
Re: Using a variable to get player
Posted: Thu Jun 18, 2020 10:48 pm
by nathanj
Got it,
Code: Select all
Variable["Health"] = uccGetAttribute(Variable["PlayerName"], "Health");
sorry for the forum noise
Nathan
LOVE THIS ASSET
Re: Using a variable to get player
Posted: Thu Jun 18, 2020 11:10 pm
by Tony Li
Thanks!
Re: Using a variable to get player
Posted: Fri Jun 26, 2020 1:28 am
by nathanj
Hey again,
You mind checking that the Set Variable is working?
I am using
Code: Select all
uccSetAttribute(Variable["PlayerName"], "Health", 50)
but it's not working.
I am using
Code: Select all
Variable["Health"] = uccGetAttribute(Variable["PlayerName"], "Health");
sucessfully, so I'm a little confused why set it not.
Thanks again.
Nathan
Re: Using a variable to get player
Posted: Fri Jun 26, 2020 10:06 am
by Tony Li
uccSetVariable() checks out.
Is there maybe a typo in your Script? Or is Variable["PlayerName"] not set yet at the point when the Script runs?
Re: Using a variable to get player
Posted: Fri Jun 26, 2020 4:35 pm
by nathanj
Ah,sorry, thanks for checking, it was my bad.
I had the line in the Sequener field, not in the Script field.
Sorry, been too long since I used DS
Thanks again, and apologies for the silly question
Re: Using a variable to get player
Posted: Fri Jun 26, 2020 4:44 pm
by Tony Li
No problem! Glad you got it sorted.
Re: Using a variable to get player
Posted: Tue Jul 25, 2023 2:37 am
by Aliyaaii
Tony Li wrote: ↑Fri Jun 26, 2020 10:06 am
uccSetVariable() checks out.
Is there maybe a typo in your Script? Or is Variable["PlayerName"] not set yet at the point when the Script runs?
Hi guys
It appears that uccSetVariable() function is functioning correctly without any issues.
free fire name