Thread Tools Display Modes
01/15/20, 11:48 AM   #1
ThoraldGM
 
ThoraldGM's Avatar
Join Date: Oct 2018
Posts: 3
Are collectibleIDs absolute or relative? (Turn drunk personality on/off)

Hello all. New to Lua, Papyrus (Fallout 4) background. Completed the notebook tutorial.

I'm creating a practice addon & would like to turn drunk personality on / off with buttons and slash commands. How do I find the collectibleID? Is the collectibleID global, or relative to position in table?

What if Player 1 has:
  • Assassin
  • Drunk
  • Jester
  • Zombie

But Player 2 has:
  • Assassin
  • Commander
  • Drunk
  • Jester
  • Zombie

Would the collectibleID change based on position in the table? (I'm familiar with array elements from elsewhere, but Lua's "everything is a table" is a WIP.)

Here's what I've dug up so far:

Lua Code:
  1. if not IsCollectibleActive(collectibleID) then
  2.      UseCollectible(collectibleID)

Source:
https://www.esoui.com/forums/showpos...41&postcount=7

Code:
COLLECTIBLE_CATEGORY_TYPE_PERSONALITY == 9
SI_COLLECTIBLECATEGORYTYPE9 == 1212
Sources:
https://wiki.esoui.com/Constant_Values
https://wiki.esoui.com/Constant_Values_SI*
https://www.esoui.com/downloads/info...elyEmotes.html

The LovelyEmotes addon queries all player personalities & lists them in a clickable table / window. Click on, click off. But it handles the data in a list format only, not individually targeted.

I just need the drunk personality collectibleID, and want to make sure that number doesn't change if player buys another personality.

Am I close to a solution?
  Reply With Quote
01/15/20, 12:35 PM   #2
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,566
Welcome to ESOUI!
You are on the right track. Generally speaking when something is called "id" in the api, it is global and won't ever* change. On the other hand when it is called "index" it is local for the current context and may change at any point in time.
In the case of collectibles you can check the list on the wiki to find the id you are looking for and then use that in your code.

*some things like ability ids have changed between major game updates, but that happens rarely
  Reply With Quote
01/15/20, 12:47 PM   #3
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Welcome

Check this to see how ZOS handles them:
https://www.esoui.com/downloads/info...ourcecode.html

Use the addon zgoo or torchbug to browse this instance:
ZO_COLLECTIBLE_DATA_MANAGER

And yes, if ZOS calls something ID it will not change (that soon). And if it is called index, it relative and can change from version to version.
  Reply With Quote
01/15/20, 12:58 PM   #4
ThoraldGM
 
ThoraldGM's Avatar
Join Date: Oct 2018
Posts: 3
Excellent. Thank you both.

Confirmed in real-time:

/script d(ZO_CachedStrFormat(SI_COLLECTIBLE_NAME_FORMATTER, GetCollectibleName(368)))
Returns: Drunk
I'll browse the game code too and set up my Agent Ransack for searches. Cheers!
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Are collectibleIDs absolute or relative? (Turn drunk personality on/off)

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off