I’m using the default script for Aquire item: the thing where you write i_tagname_aq you know. My question is, is there a stock script (or what do you call it?) for when aquiring let’s say, a feather, an axe and a leaf, three different items, and then the script does a journal entry? I’ve tried thinking about how this could be done but this is above my scripting ability. I’ve also checked with the script editor but I was none the wiser.
In my module I would like it if the PC has collected three different things there is an automatic journal entry. Could this be done?
Just set logic flags in OnAquireItem scripts for each of these items and check these flags in each of these scripts.
Example:
void main()
{
object oItem1 = GetModuleItemAcquired();
object oGetter = GetModuleItemAcquiredBy();
object oPC = GetOwnedCharacter(GetFactionLeader(GetFirstPC()));
if(!GetFactionEqual(oPC,oGetter))
return;
if(IsItemMarkedAsDone(oItem1))
return;
MarkItemAsDone(oItem1);
SetGlobalInt("bFoundItem1",TRUE); // SetGlobalInt("bFoundItem2",TRUE) for the second item and so on.
if (GetGlobalInt("bFoundItem1") && GetGlobalInt("bFoundItem2") && GetGlobalInt("bFoundItem3"))
AddJournalQuestEntry("yourquestname",journalentry#,oPC,TRUE,FALSE,TRUE);
}
2 Likes
Thank you! That worked great!
BTW, you can slightly optimize the script above to use only one global variable if you don’t care about which item was found:
int i = GetGlobalInt("nItemsCollected") + 1;
SetGlobalInt("nItemsCollected", i);
if (i == 3)
AddJournalQuestEntry("yourquestname",journalentry#,oPC,TRUE,FALSE,TRUE);
This modification is useful if you have more than 3 items.
And if all items are located in the same module, it’s better to use a local variable. For example:
int i = GetLocalInt(GetModule(), "nItemsCollected") + 1;
SetLocalInt(GetModule(), "nItemsCollected", i);
if (i == 3)
AddJournalQuestEntry("yourquestname",journalentry#,oPC,TRUE,FALSE,TRUE);
1 Like