vegetables on 11/2/2018 at 21:36
I thought about using Sim but I wasn't sure if it was reliable. Thanks again, that makes things much easier. I'll update the demo.
R Soul on 11/2/2018 at 22:20
Happy to provide advice.
I've been looking though the docs but I can't see if there's a way to loop through qvars, but if that was possible, it would make the loadup easier because the user wouldn't have to anticipate what the player could end the first mission with.
For general interest, this will store the player's contained objects as quest vars, with the stack counts being the values:
Code:
class COver extends SqRootScript
{
function OnSim()
{
if(!message().starting) //mission ends
{
foreach (ln in Link.GetAll("Contains", "Player"))
{
local destConcreteID = LinkDest(ln);
local count = Property.Get(destConcreteID, "stackcount");
local archID = Object.Archetype(destConcreteID);
Quest.Set("Arch_" + archID, count, eQuestDataType.kQuestDataCampaign);
}
print("Storing Inventory");
}
}
}
Nameless Voice on 11/2/2018 at 22:42
It is possible in C++ scripts, via script interfaces, but I believe you cannot use those in Squirrel scripts.
vegetables on 13/2/2018 at 00:27
One more update. The script now works with objects that have no stackcount set (or have their stackcount set to 0) including junk items. It also deletes its qvars when giving items to the player so it should work across campaigns that are more than two missions long.