Using a variable to get player

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Using a variable to get player

Post 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
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Re: Using a variable to get player

Post by nathanj »

Got it,

Code: Select all

Variable["Health"] = uccGetAttribute(Variable["PlayerName"], "Health");
sorry for the forum noise :?

Nathan

LOVE THIS ASSET
User avatar
Tony Li
Posts: 22119
Joined: Thu Jul 18, 2013 1:27 pm

Re: Using a variable to get player

Post by Tony Li »

Thanks! :-)
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Re: Using a variable to get player

Post 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
User avatar
Tony Li
Posts: 22119
Joined: Thu Jul 18, 2013 1:27 pm

Re: Using a variable to get player

Post 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?
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Re: Using a variable to get player

Post 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 :roll:
Last edited by nathanj on Fri Jun 26, 2020 5:00 pm, edited 1 time in total.
User avatar
Tony Li
Posts: 22119
Joined: Thu Jul 18, 2013 1:27 pm

Re: Using a variable to get player

Post by Tony Li »

No problem! Glad you got it sorted.
Aliyaaii
Posts: 1
Joined: Sun Jul 23, 2023 10:45 am

Re: Using a variable to get player

Post 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
Post Reply