Larian Banner
Previous Thread
Next Thread
Print Thread
#613663 17/09/17 05:52 PM
Joined: Aug 2017
Y
Yuhnis Offline OP
journeyman
OP Offline
journeyman
Y
Joined: Aug 2017
As you mentioned I opened a new topic smile ,

on event check if it is in inventory then remove it
but --) if check doesn't find it even if its in inventory.

// to check item is in inventory ?

ItemIsInCharacterInventory(60180909-ee47-4d1c-b81c-e43bd8fdce1e,__ME)

// remove from inventory ?

CharacterRemoveFromInventory(__Me,60180909-ee47-4d1c-b81c-e43bd8fdce1e,1)

Thanks and Best regards;


Edited by Yuhnis (Today at 01:39 PM)
_________________________

Last edited by Yuhnis; 17/09/17 06:00 PM.
Joined: Mar 2016
Location: Belgium
T
addict
Offline
addict
T
Joined: Mar 2016
Location: Belgium
Hi Yuhnis!

Is that UUID in fact the UUID of an item, and not of a root template or so? If so, does prefixing it with "ITEM:" help? You can also try using the autocompletion feature of the editor so it adds ItemName_GUID to your script code. But note that autocompletion may only work if the name starts with "S_".

The "S_" prefix refers to "Script" and is a Larian convention for all items that are referred to script. It's to prevent level decorators from accidentally removing items that are used in script. This convention is somewhat enforced by the editor by e.g. only providing auto-completion for names that start with "S_". I still have to find a good place on the wiki to mention this.

Joined: Aug 2017
Y
Yuhnis Offline OP
journeyman
OP Offline
journeyman
Y
Joined: Aug 2017
Hi Tinkerer ,

Thanks for good work and reply on everyone , Keep up the good work smile

This is object code where I also tested to spawn some items with success. ITEM: "" prefixing couldn't return the object with same object code.

But like you said there should be a S_ code for some or all dynamic inventory items which are guarded by Larian scripting.

Also are we sure every item has a starting an S_ prefix to use in inventory scripting ?

i knew goal story scripts and other char & item scripts used in the whole game nice and amazing scripting done smile . If it works with S_ stuff which also i will try but like removing amount of items still need a working full prefix table.

Thanks and Best Regards;

Last edited by Yuhnis; 17/09/17 07:48 PM.
Joined: Mar 2016
Location: Belgium
T
addict
Offline
addict
T
Joined: Mar 2016
Location: Belgium
Originally Posted by Yuhnis
Hi Tinkerer ,

Thanks for good work and reply on everyone , Keep up the good work smile

Thanks, and you're welcome!

Quote

This is object code where I also tested to spawn some items with success. ITEM: "" prefixing couldn't return the object with same object code.

Okay.

Quote

But like you said there should be a S_ code for some or all dynamic inventory items maybe.

The S_ prefix is only to get code-completion to work. Even without that prefix, you can still access items from script.

Quote

I thought memory of the object id in inventory is not same as in the object file ?

It's true that this can get lost, but only if the item is stackable (like a potion), and if you already had such an item in your inventory.

Quote

Also are we sure every item has a starting an S_ prefix to use in inventory scripting ?

I'm not sure what exactly you mean here. As mentioned above: it is not necessary that the name of every item used in scripting starts with an S_. It only makes things easier, because then autocompletion can find them.

Joined: Aug 2017
Y
Yuhnis Offline OP
journeyman
OP Offline
journeyman
Y
Joined: Aug 2017
Hey Tinkerer,

Quote:
Also are we sure every item has a starting an S_ prefix to use in inventory scripting ?
-----------------------------------------------------------------------------------------------
I didn't understand that too smile (Late time writing failure)

I had the GOG version of game so doesn't have the beatiful editor tool right now but waiting soon for the release exactly the auto completion stuff.

As You mentioned How about stacking items like potions & scrolls to be removed ? That's why maybe i cannot remove from inventory or find it because i exactly test the script code on stacking ones smile
Any idea how to get a solution for that kind of items ?


Last edited by Yuhnis; 17/09/17 08:03 PM.
Joined: Mar 2016
Location: Belgium
T
addict
Offline
addict
T
Joined: Mar 2016
Location: Belgium
You can check whether the character has an item with the correct template in its inventory. Unfortunately, while this is a simple count in story/osiris (CharacterGetItemTemplateCount), in behaviour script it's a bit more complex:
* if you know the item has a certain tag or stats, you can use ItemGetFromInventory()
* otherwise, use IterateItemsInInventory() and then in the iteration event call ItemGetTemplate() and compare the result to the root template of the item you are looking for.

Joined: Aug 2017
Y
Yuhnis Offline OP
journeyman
OP Offline
journeyman
Y
Joined: Aug 2017
Originally Posted by Tinkerer
You can check whether the character has an item with the correct template in its inventory. Unfortunately, while this is a simple count in story/osiris (CharacterGetItemTemplateCount), in behaviour script it's a bit more complex:
* if you know the item has a certain tag or stats, you can use ItemGetFromInventory()
* otherwise, use IterateItemsInInventory() and then in the iteration event call ItemGetTemplate() and compare the result to the root template of the item you are looking for.


Thanks Tinkerer ;

Behavior script worked fine smile


Moderated by  Larian_KVN 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.5