Yandros on 30/1/2018 at 02:16
If TrapCampaignQVar works in T1, then it would stand to reason you could use it to achieve the same result as InvCarryOver. Or write a squirrel script that did it the same way.
vegetables on 30/1/2018 at 15:26
Hmm, assuming that works, it should be possible to increment a qvar for each archetype every time it's picked up and decrement it when it's consumed. I'm not sure how you would create the appropriate stack based on the qvar though, other than haveing a separate TrigQvar trap for every possible stack count of every possible item, which seems pretty inefficient.
Yandros on 30/1/2018 at 17:52
I was thinking more along the lines of when the first mission ends, you store the quantities of archetypes that you want to persist, like arrows and the like. Then in mission 2 you would read from the campaign qvars and create instances, set stack count and have the player contain them. That sounds trivial but it would be really tricky to do in practice, which is why I thought a squirrel script, or compiled script, would be better. Also, this is all dependent on whether or not TrapCampaignQVar even works in T1, which may not be the case.
ZylonBane on 4/2/2018 at 21:17
I'm curious how InvLoadUp knows which qvars to load, since AFAIK the script services don't provide any way to directly access the list of qvar names. Perhaps it uses one of the dread internal engine functions.
vegetables on 8/2/2018 at 20:20
I did a little test and can confirm that TrapCampaignQVar works in Thief 1 and that the qvars it creates persist between missions.
vegetables on 10/2/2018 at 21:21
I think I've almost got a working demo. The only thing I'm not sure how to do is convert the quantities of objects into qvars at the end of the first mission. Is there a way to use the value of a property in place of a parameter (like how you can use the value of a quest variable?)
R Soul on 10/2/2018 at 21:47
A squirrel script can read any property value.
local count = Property.Get(self, "stackcount");
Quest.Set("VarName", count, eQuestDataType.kQuestDataCampaign);
vegetables on 11/2/2018 at 05:19
Quote Posted by R Soul
A squirrel script can read any property value.
local count = Property.Get(self, "stackcount");
Quest.Set("VarName", count, eQuestDataType.kQuestDataCampaign);
Thank you! I now have a working demo, I'll upload it at some point tomorrow.
vegetables on 11/2/2018 at 18:51
Here it is: (
https://www.dropbox.com/s/d8kulp8rullvn5e/T1CarryOverDemo12.zip?dl=1) T1 CarryOver Demo v1.2
The contents of SqCarryOver.nut:
Code:
class CarryOver extends SqRootScript
{
function OnSim()
{
if(!message().starting)
{
if(Link.GetOne("Contains", "Player", self))
{
local count = Property.Get(self, "stackcount");
local qname = Property.Get(self, "gamename");
if(Object.HasMetaProperty(self, "ArrowIsHoly"))
{
Quest.Set("name_water", count, eQuestDataType.kQuestDataCampaign);
}
else
{
Quest.Set(qname, count, eQuestDataType.kQuestDataCampaign);
}
}
}
}
}
class CarriedOver extends SqRootScript
{
function OnSim()
{
if(message().starting)
{
local qname = Property.Get(self, "gamename");
if(Quest.Exists(qname))
{
local count = Quest.Get(qname);
Property.SetSimple(self, "stackcount", count);
Link.Create("Contains", "Player", self);
Quest.Delete(qname);
}
}
}
}
(
https://pastebin.com/raw/xPJWN9C4) Usage instructions (Also included in demo zip)
I was having some issues getting holy water arrows to convert into normal water arrows but everything seems to be working properly now.
R Soul on 11/2/2018 at 20:17
That looks good, but you don't need the EndStim setup. All objects get a Sim message at the start, but also at the end.
A script can catch the end like this:
Code:
function OnSim()
{
if(
!message().starting) // mission ending
{
local count...
local qname...
etc...
}
}
Similarly, you don't need to use an 'on' lever for the next mission. The Sim message can trigger it.
edit:
If stack count has to be > 0, unique objects won't carry over (the value is 0 if the property doesn't exist).