uccRemoveItem issue

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

uccRemoveItem issue

Post by nathanj »

Hi Tony,

I'm stumpped on something at the moment and hoping you might be able to point out what i'm missing.

I'm working with DS and UCC with your integration (UCC 2.2.4 and DS 2.2.9).

I'm having an issue removing items. I can use the uccAddItem("","stone",1) fine but uccRemoveItem("","stone",1) does not work.
I was wondering if this has to do with the fact that I have different item categories (food, raw material, weapon, medicine).

Any ideas of what could be happening?

If, on the off chance, you still have that project from when you were testing the UI panels for UCC PUN, you could add this to test, I get the same results. In it Private Hart runs a LUA command that should remove the player's knife, but it does not work.

https://drive.google.com/file/d/16eKig1 ... sp=sharing

Thanks again,
Nathan
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: uccRemoveItem issue

Post by Tony Li »

Hi Nathan,

Sorry, I no longer have that project.

Does your character have more than one ItemCollection? I may need to update uccRemoveItem() to allow you to specify an ItemCollection and/or search all ItemsCollections on the character.
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Re: uccRemoveItem issue

Post by nathanj »

Hi Tony, yes, The character has 4 item collections, I'm suspecting that that is the case as I noticed that there is an

Code: Select all

ItemCollection itemCollection;
in the UCCLUA script but no way to access it from the command.
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: uccRemoveItem issue

Post by Tony Li »

Hi Nathan,

I'll update the Lua functions. To prevent breaking existing projects, uccRemoveItem will have the same parameters, but you'll be able to optionally specify an item collection at the end of the character name, such as:

Code: Select all

uccRemoveItem("Vendor.SecretStash", "Extra Good Sword", 1);
to remove the item from the Vendor character's SecretStash collection. Or:

Code: Select all

uccRemoveItem(".Backpack", "Torch", 1);
to remove a torch from the player's Backpack collection.

If you don't specify an item collection, it will remove the first item it finds in any of the character's item collections.
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Re: uccRemoveItem issue

Post by nathanj »

Wow, that's awesome! thanks Tony

Any chance you be able to send me the script whenever you're done? No rush, but I'm working towards a deliverable in two weeks and trying to get as many things off my list when I can.

Thanks again,
Nathan
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: uccRemoveItem issue

Post by Tony Li »

Yes. I'll try to get it done by the end of tomorrow at the latest.
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Re: uccRemoveItem issue

Post by nathanj »

No need to rush on it, but when you get it done that would be awesome.

Thanks again!
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: uccRemoveItem issue

Post by Tony Li »

User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Re: uccRemoveItem issue

Post by nathanj »

Hey Tony,

I forgot to follow up with this. I'm still having an issue with my scene, I thought it was working but upon testing yesterday I realised it is not. The good news is that it is not your code, I have recreated a duplicate of the DS/UCC demo scene and tried all possibilities and the remove item always works as expected. So my apologies for making you edit the code because of my error.

The bad news is that in my scene where everything looks identical, it is not working. Because I am using PUN I have to assign the player's name dynamically when they are instantiated. However, again, I made a dupe of the UCC demo scene with PUN and everything works.

In this image, you can see a

Code: Select all

[var=PlayerName]
and this works, when the player speaks to the npc, the player's name is displayed correctly in the text. However, the

Code: Select all

uccRemoveItem(Variable["PlayerName"], "Fig", 3);
is not working.

Image
Can you think of any reason why the Text varible "PlayerName" would work in some cases but with the uccRemoveItem "variable["PlayerName"] would not work? I'm really stumped on this one.

Thanks as always,
Nathan
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: uccRemoveItem issue

Post by Tony Li »

Hi Nathan,

In the Console, do you see a message like this?

Dialogue System: Can't find Ultimate Character Locomotion GameObject named <PlayerName>

If so, then it's not finding the player.

If you don't see the message, then it's finding the player but the remove operation isn't working.
Post Reply