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

Thread: AICurrentPatrol links

  1. #1
    Dóttirin klęšist oft móšur möttli
    Registered: Apr 2015

    AICurrentPatrol links

    Note that AICurrentPatrol links set on AIs on sim start are broken in NewDark 1.27. After testing some missions it's likely that only teleported objects are affected, but I'm not sure.
    This will break some existing FMs, we are trying to fix it.

    Solution for new FMs: Set AICurrentPatrol (if you need it) after the game starts, for instance in a conversation, in any case after teleportation.

  2. #2
    Desperately Dodgy Moderator
    Registered: Nov 2001
    Location: Bohn Museum
    Oh wow, that will likely break some of my missions. Thanks for catching it and for all of the fixing of FMs that you and fortuni do!

  3. #3
    Member
    Registered: Oct 2016
    Location: Appleton, WI
    Thanks for sharing. If I have any problems setting up anything in my missions as I design. I'll keep this in mind or see if anything might be conflicting.

  4. #4
    Dóttirin klęšist oft móšur möttli
    Registered: Apr 2015
    We have a squirrel fix for this issue. Jax will post it soon. It will be implemented in the next T2fix version.

  5. #5
    Member
    Registered: Mar 2015
    To elaborate, this issue is caused by T2's TrapTeleporter script rather than lying implicitly with NewDark 1.27. Thief 1 and Thief Gold are not affected. Upon being triggered, this script will remove all AICurrentPatrol links from objects along its ControlDevice links. This is rather odd considering this is an official script and has not changed since the game's release. It is most likely that NewDark 1.27 fixed an underlying issue that allowed a dormant line of code in this script to function whereas it had not before.

    With this in mind, I have put together a squirrel script that is identical in functionality to the original TrapTeleporter but does not implement the removal of AICurrentPatrol links on activate. It can be used as a complete replacement for the original script, provided it is given the appropriate loading priority.

    Code:
    class TrapTeleporter extends SqRootScript
    {
    
    	function Activate(on, sender)
    	{
    		if (on)
    		{
    			if (Link.AnyExist("ControlDevice", self))
    			{
    				local victim = LinkDest(Link.GetOne("ControlDevice", self));
    				if (Link.AnyExist("PlayerFactory", victim))
    				{
    					victim = Object.Named("Player");
    				}
    				Container.Remove(victim);
    				Object.Teleport(victim, vector(0,0,0), vector(0,0,0), self);
    				// NewDark 1.27 allows the code below to execute while it had not in prior versions
    				// Disable it because it now causes issues
    				//Link.DestroyMany("AICurrentPatrol", victim, AnyObject);
    			}
    		}
    	}  
    
    	function HandleMessage(sender)
    	{
    		local flags = 0;
    		local invert = false
    		local activated = false;
    		if (Property.Possessed(self, "TrapFlags"))
    		{
    			flags = Property.Get(self, "TrapFlags");
    		}
    		invert = flags & TRAPF_INVERT;
    		if (!Locked.IsLocked(self) && sender != self)
    		{
    			if (!(flags & TRAPF_NOON))
    			{
    				Activate(!invert, sender);
    				activated = true;
    			}
    		}
    		if (activated && flags & TRAPF_ONCE)
    		{
    			Property.SetSimple(self, "Locked", true);
    		}
    	}
    
    	function OnMessage()
    	{
    		if (MessageIs("TurnOn"))
    		{
    			HandleMessage(message().from);
    		}
    	}
    
    	function OnTimer()
    	{
    		if (message().name == "TurnOn")
    		{
    			HandleMessage(message().from);
    		}
    	}
    
    }
    Despite the fact that this script actually removes functionality, it does return TrapTeleporter to its original, expected behavior. As Unna has said, the plan is to include this with the next version of T2Fix, meaning if either T2Fix is used or this fixed script is installed manually, players will not have to worry about broken missions as a result of this and mission authors need not concern themselves with changed behavior.
    Last edited by Jax64; 17th Aug 2019 at 13:30. Reason: updated script

  6. #6
    Desperately Dodgy Moderator
    Registered: Nov 2001
    Location: Bohn Museum
    Thanks everyone for your work on this. I would still advise authors moving forward to be wary of this, since plenty of players will not be using T2Fix and thus will not have this fox in place to work around the issue. I for one will begin dynamically adding the links via a conversation on sim start or something similar.

  7. #7
    Isn't this likely something that will just get fixed in the next version of ND?

  8. #8
    Dóttirin klęšist oft móšur möttli
    Registered: Apr 2015
    We don't know. The issue was caused by ND 1.27, all previous versions including OldDark 1.18 didn't remove the links.

  9. #9
    Member
    Registered: Mar 2015
    While it is possible, especially if this gets attention, I do not consider it particularly likely since NewDark has not previously made it a focus to fix scripts. The code in TrapTeleporter to remove these links has existed since the game was released, but it only seems to be properly executed with NewDark 1.27.

  10. #10
    Member
    Registered: Sep 2003
    Location: Cambridgeshire UK
    So how do I get this to work? So far I've tried two things with no luck:

    1. I've copied the code from the Under Templehill thread into a new file T2Fix127\FMs\Templehill\miss20.mis.dml.

    2. I've taken Jax's code from the thread here and copied that into T2Fix127\T2FMDML\TrapTeleporter.dml.

    If there are instructions how to install dmls they are well hidden!

  11. #11
    Desperately Dodgy Moderator
    Registered: Nov 2001
    Location: Bohn Museum
    The code here is not a DML, it's a Squirrel script, so try saving it as a .nut file and see if it works. It should effectively replace the TrapTeleporter script.

  12. #12
    Dóttirin klęšist oft móšur möttli
    Registered: Apr 2015
    In this case, it's not a dml, but a squirrel script.
    You already installed T2fix. This will load squirrel script. Good.


    First, you need to find a folder "sq_scripts" in game root folder/OSM. Create it there if it doesn't already exist.
    You can also create this folder in the root folder.


    Then copy the code and paste it in a txt file. Save it in the sq_scripts folder as "teleport.nut" (or just create a txt file first and rename it later). The file extension has to be "nut", but not txt or whatever.

    The FM has to be restarted then.
    Last edited by Unna Oertdottir; 14th Aug 2019 at 10:13.

  13. #13
    Member
    Registered: Sep 2003
    Location: Cambridgeshire UK
    Many thanks both. It works! (I'm ashamed to admit that I needed Unna's longer instructions .)

    I think we need a link to instructions for this sort of thing in the FM forum (or if they are there already make it clear where to find them). Otherwise the fixes that you good people post in there are wasted on the majority.

  14. #14
    Desperately Dodgy Moderator
    Registered: Nov 2001
    Location: Bohn Museum
    Well for the majority, this and similar fixes will be integrated into T2Fix so they only need to worry about running that.

  15. #15
    Dóttirin klęšist oft móšur möttli
    Registered: Apr 2015
    Note that Jax has just updated the code. Whoever downloaded it needs to replace the other nut.

  16. #16
    Member
    Registered: May 2002
    Location: Texas
    Quote Originally Posted by Yandros View Post
    Thanks everyone for your work on this. I would still advise authors moving forward to be wary of this, since plenty of players will not be using T2Fix and thus will not have this fox in place to work around the issue. I for one will begin dynamically adding the links via a conversation on sim start or something similar.
    Sorry to resurrect this thread, but I have discovered something. Whenever an AI is teleported in from solid space, the AICurrentPatrol link is changed to the nearest TrolPt, so to make an AI go to a specific TrolPt, create one right next to the TeleportTrap and then AIPatrol link the new TrolPt to the desired TrolPt. I started looking at one my old missions that has this problem and forgot that there was a fix in T2Fix. Since AI with M-DoesPatrol or Patrol: Does Patrol: True added it isn't necessary to add an AICurrentPatrol link to the AI in dromed. The AI simply starts with the nearest TrolPt.

Posting Permissions

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