Question Regarding Adding Purchasable DLC Lore to Stores

A place to post your add ons and ideas for them

Moderator: Moderator

Post Reply
Message
Author
deus-misereatur
Low Yeek
Posts: 7
Joined: Fri Jul 09, 2021 2:25 am

Question Regarding Adding Purchasable DLC Lore to Stores

#1 Post by deus-misereatur »

Hi! Not sure if this is the right place to post this but here goes:

So I've been making a personal addon to add more purchasable lore to shops. Thus far, I've been using Forbidden Cults as a guide, as they added the Fay Willows books to both the Elvala and ZIgur libraries. This has resulted in me managing to add the lore I wanted purchasable to the Last Hope library, including Forbidden Cults lore like the "Mightier than Gods" and "Researcher Dremnot's Demystification of the Gods" series.

The problem arises when I want to do the same for the Kroshkkur library (in fact, my original intention was to only have the said two series I mentioned above available here and not anywhere else). I am simply unable to do so, as I'm guessing I'm not referencing the correct 'define_as' values of the said lore. I've already added the new lore objects to the "/data-cults/zones/town-kroshkkur/objects.lua" but the Kroshkkur library simply refuses to recognize the 'define_as' value I've given it.

For reference:
In my kroshkkur.lua file which is to be loaded when data.file == "/data-cults/zones/town-kroshkkur/objects.lua" via Entity:loadList, I have the following:

for i = 4, 9 do
local l = mod.class.interface.PartyLore.lore_defs["cults-godslayers-"..i]
newEntity{ base = "BASE_LORE",
define_as = "GODSLAYER_RESEARCH"..i,
subtype = "kroshkkur", unique=true, no_unique_lore=true, not_in_stores=false,
name = l.name, lore="cults-godslayers-"..i,
rarity = false,
encumberance = 0,
cost = 90,
}
end

In my addons_cult.lua which is to be loaded when data.file == "/data-cults/general/stores/cults.lua", also via Entity:loadList:

if loading_list.KROSHKKUR_LIBRARY then
table.insert(loading_list.KROSHKKUR_LIBRARY.store.fixed, {id=true, "GODSLAYER_RESEARCH4"})
table.insert(loading_list.KROSHKKUR_LIBRARY.store.fixed, {id=true, "GODSLAYER_RESEARCH5"})
table.insert(loading_list.KROSHKKUR_LIBRARY.store.fixed, {id=true, "GODSLAYER_RESEARCH6"})
table.insert(loading_list.KROSHKKUR_LIBRARY.store.fixed, {id=true, "GODSLAYER_RESEARCH7"})
table.insert(loading_list.KROSHKKUR_LIBRARY.store.fixed, {id=true, "GODSLAYER_RESEARCH8"})
table.insert(loading_list.KROSHKKUR_LIBRARY.store.fixed, {id=true, "GODSLAYER_RESEARCH9"})
end

This does not work for the Kroshkkur library and results in the library being filled with random objects drawn from, I believe, /data/general/objects/objects-maj-eyal.lua.

Can someone more knowledgeable in the ways of modding ToME4 point out exactly what I seem to be getting wrong?

Thanks a ton in advance!

Shad3
Higher
Posts: 54
Joined: Thu Jan 13, 2022 3:45 am

Re: Question Regarding Adding Purchasable DLC Lore to Stores

#2 Post by Shad3 »

From Elvala's store, the fixed Table reads like so:

Code: Select all

fixed = {
	{id=true, defined="SPELLBLAZE_NOTE1"},
	{id=true, defined="SPELLBLAZE_NOTE2"},
	{id=true, defined="SPELLBLAZE_NOTE3"},
	{id=true, defined="SPELLBLAZE_NOTE4"},
	{id=true, defined="SPELLBLAZE_NOTE5"},
	{id=true, defined="SPELLBLAZE_NOTE6"},
	{id=true, defined="SPELLBLAZE_NOTE7"},
	{id=true, defined="SPELLBLAZE_NOTE8"},
}
So rather than

Code: Select all

{id=true, "GODSLAYER_RESEARCH4"}
it should be

Code: Select all

{id=true, defined="GODSLAYER_RESEARCH4"}
Also, the insertion can be done inside 1 if statement.

Mirroring the item definition, like this:

Code: Select all

if loading_list.KROSHKKUR_LIBRARY then
	for i=5,9 do
		table.insert(loading_list.KROSHKKUR_LIBRARY.store.fixed, {id=true, "GODSLAYER_RESEARCH"..i})
	end
end

deus-misereatur
Low Yeek
Posts: 7
Joined: Fri Jul 09, 2021 2:25 am

Re: Question Regarding Adding Purchasable DLC Lore to Stores

#3 Post by deus-misereatur »

Holy cow! I can't believe I didn't see it! I spent the whole day yesterday tinkering about and yet I missed a whole "defined=" term (even after describing it in my forum post and having a working copy for my Last Hope library, too). Sigh... Thank you very, very much!

As a side note, do you know what the following code snippet does?

Code: Select all

	Store:loadStores("/data-cults/general/stores/cults.lua")
	if Store.stores_def.ELVALA_LIBRARY then
		table.insert(Store.stores_def.ELVALA_LIBRARY.store.fixed, {id=true, defined="FAY_WILLOWS_BOOK1_CHAPTER1"})
							...
		table.insert(Store.stores_def.ELVALA_LIBRARY.store.fixed, {id=true, defined="FAY_WILLOWS_BOOK4_CHAPTER6"})
	end
	if Store.stores_def.ZIGUR_LIBRARY then
		table.insert(Store.stores_def.ZIGUR_LIBRARY.store.fixed, {id=true, defined="FAY_WILLOWS_BOOK2_CHAPTER1"})
							...
		table.insert(Store.stores_def.ZIGUR_LIBRARY.store.fixed, {id=true, defined="FAY_WILLOWS_BOOK3_CHAPTER6"})
	end
The stores being loaded in the loadStores statement are all just Forbidden Cult stores and the insertions to the Elvala and Zigur libraries should only happen with the Entity:loadList hook, right?

Again, thank you very much.

Shad3
Higher
Posts: 54
Joined: Thu Jan 13, 2022 3:45 am

Re: Question Regarding Adding Purchasable DLC Lore to Stores

#4 Post by Shad3 »

deus-misereatur wrote: Wed Jul 08, 2026 1:06 am

do you know what the following code snippet does?

Code: Select all

	Store:loadStores("/data-cults/general/stores/cults.lua")
	if Store.stores_def.ELVALA_LIBRARY then
		table.insert(Store.stores_def.ELVALA_LIBRARY.store.fixed, {id=true, defined="FAY_WILLOWS_BOOK1_CHAPTER1"})
							...
		table.insert(Store.stores_def.ELVALA_LIBRARY.store.fixed, {id=true, defined="FAY_WILLOWS_BOOK4_CHAPTER6"})
	end
	if Store.stores_def.ZIGUR_LIBRARY then
		table.insert(Store.stores_def.ZIGUR_LIBRARY.store.fixed, {id=true, defined="FAY_WILLOWS_BOOK2_CHAPTER1"})
							...
		table.insert(Store.stores_def.ZIGUR_LIBRARY.store.fixed, {id=true, defined="FAY_WILLOWS_BOOK3_CHAPTER6"})
	end
Ok, I'll try.
Basically, when the stores are loaded, they are put in mod.class.Store's stores_def. So it just finds them in that table and adds new entries.
It works either way, but suppose you want to add something specific in store after a quest for instance, this is how you'll do it.

Post Reply