TTLG|Thief|Bioshock|System Shock|Deus Ex|Mobile
Results 1 to 24 of 24

Thread: Thief Gold Inventroy Carry Over

  1. #1
    Member
    Registered: Oct 2012
    Location: Minnesota

    Thief Gold Inventroy Carry Over

    Does anyone know if it's possible in Thief Gold to carry over Garrett's inventory from one level to the next, or does that only work in Thief II? I'm working on a pair of Thief Gold fan missions and it would be serendipity if that were possible.

  2. #2
    Member
    Registered: Aug 2007
    Location: LosAngeles: Between Amusements

  3. #3
    Member
    Registered: Oct 2012
    Location: Minnesota
    I set it all up, but when I load a savegame or complete either level, that level crashes. When I remove tnhScript, the levels work fine.

  4. #4
    Member
    Registered: Jan 2001
    Location: Formby, NW England
    tnhScript only works with Thief 2, and it seems the NewDark patch hasn't stopped T1 being too different for some things.

  5. #5
    Zombified
    Registered: Sep 2004
    you definitely still need a T1/TG version of a script for T1/TG, even when running under NewDark.

  6. #6
    Member
    Registered: Oct 2012
    Location: Minnesota
    Thanks guys. I'll forgo the carry-over and figure something else out.

  7. #7
    Member
    Registered: Feb 2016
    How much work would it be (if it's even possible) to create a Thief Gold compatible InvCarryOver script? I kind of need it for my 20AC entry.

  8. #8
    Desperately Dodgy Moderator
    Registered: Nov 2001
    Location: Fields of bluegrass
    My entry is also two missions which happen in direct sequence, so I could also use a TG version of this script.

  9. #9
    ZylonBane
    Registered: Sep 2000
    Location: ZylonBane
    Does anyone know how the old carryover script works? Using only the script services, it doesn't seem like it would be possible to pack up an exact copy of every object in the player's inventory. Does it just recreate every object from its archetype?

  10. #10
    Member
    Registered: Feb 2016
    Quote Originally Posted by ZylonBane View Post
    Does anyone know how the old carryover script works? Using only the script services, it doesn't seem like it would be possible to pack up an exact copy of every object in the player's inventory. Does it just recreate every object from its archetype?
    http://dromed.whoopdedo.org/tnhscript/invcarryover
    http://dromed.whoopdedo.org/tnhscript/invloadup
    I don't know much about scripts but based on these pages it creates a quest variable for each item to be carried over and recreates each one from its archetype.

  11. #11
    Desperately Dodgy Moderator
    Registered: Nov 2001
    Location: Fields of bluegrass
    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.

  12. #12
    Member
    Registered: Feb 2016
    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.

  13. #13
    Desperately Dodgy Moderator
    Registered: Nov 2001
    Location: Fields of bluegrass
    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.

  14. #14
    ZylonBane
    Registered: Sep 2000
    Location: ZylonBane
    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.

  15. #15
    Member
    Registered: Feb 2016
    I did a little test and can confirm that TrapCampaignQVar works in Thief 1 and that the qvars it creates persist between missions.

  16. #16
    Member
    Registered: Feb 2016
    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?)

  17. #17
    Member
    Registered: Jan 2001
    Location: Formby, NW England
    A squirrel script can read any property value.
    local count = Property.Get(self, "stackcount");
    Quest.Set("VarName", count, eQuestDataType.kQuestDataCampaign);

  18. #18
    Member
    Registered: Feb 2016
    Quote Originally Posted by R Soul View Post
    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.

  19. #19
    Member
    Registered: Feb 2016
    Here it is: 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);
    			}
    		}
    	}
    }
    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.
    Last edited by vegetables; 12th Feb 2018 at 20:18. Reason: updated to 1.2 (Thank R Soul)

  20. #20
    Member
    Registered: Jan 2001
    Location: Formby, NW England
    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).
    Last edited by R Soul; 11th Feb 2018 at 17:30.

  21. #21
    Member
    Registered: Feb 2016
    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.

  22. #22
    Member
    Registered: Jan 2001
    Location: Formby, NW England
    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");			
    		}
    	}
    }

  23. #23
    Member
    Registered: Mar 2001
    Location: Ireland
    It is possible in C++ scripts, via script interfaces, but I believe you cannot use those in Squirrel scripts.

  24. #24
    Member
    Registered: Feb 2016
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •