Jump to content
The Dark Mod Forums

Recommended Posts

Posted

I wanted to keep some hostile thugs in an isolated box outside the map, but teleport them in after an objective is achieved and have them patrol the (previously safe) area. In basic terms, I can do that by triggering an atdm:teleport. The only problem with this is any props I attach via either bind or def_attach doesn't move with them.

I expected with with the bind method (in my case, a note attached to the belt) and compensated with another atdm:teleport to move it too, though it was difficult to place it exactly where I wanted. But I don't understand why the def_attach method doesn't move the object with them.

In particular, I wanted some of the thugs to be holding lanterns while they patrol. Adding the spawnargs to put lanterns in their hands results in the lanterns being left behind in their storage area when they teleport. Oddly, this doesn't seem to affect their weapons (which, afaik, are also given them via def_attach). Should I be using a different teleport method (ie. scripting) to make this work, or is there some other trick to it?

Thanks if anybody can help with this.

Posted (edited)

Well, maybe this script could help:

Although I read teleportation breaks patrol. I did read another solution somewhere for teleporting ai while patroling a while back. But I'm not sure it helps in this case.
 

@thebigh@JackFarmer

Edited by datiswous
  • Like 1
Posted

I have no idea if this can avoid your attachment issue, but in Heart of St Mattis I used the following script calls to teleport AI:

    $revenant10.setWorldOrigin(startBuilder10);
    $revenant10.addTarget($path_corner_bg1_10);
    sys.wait(1.0);
    $revenant10.restartPatrol();    

I think I had to do it this way to get patrolling/paths to work. You could try this and see if it helps with attachments?
 

  • Like 1
Posted

So far I've had no problems with patrols on teleported AI. For another area of the map, I had an AI with a target spawnarg for a path_corner inside the map while he was trapped in a box outside the map, unable to reach it. Post-teleport, he simply started following path nodes like expected. Maybe something under the hood changed in the most recent version, idk.

I'll have to play around with some of these scripts and see what happens. Although I was thinking about this from another perspective, does def_attach only work at map start, or is it possible to apply to an AI after spawn? I know some of the eating animations have food props temporarily jump into AIs hands for animations, maybe it's possible to simply attach the lanterns to the AI after teleporting them, and sidestep the whole problem?

Posted
17 minutes ago, grodenglaive said:

I bet that is the problem

Right now I'm just using spawnargs on the AI in the storage area outside the map, so they spawn with lanterns as normal/expected. The atdm:teleport just doesn't want to move them. If it were possible to add the lanterns post-teleport, that'd sidestep the issue. I just don't know if that's possible or not.

Posted (edited)
Maybe this would this do it? Seems like it would be pretty tedious if you had to do it for a bunch of AI though..

/**
* Attach an entity to the AI.
* Entity spawnArgs checked for attachments are:
* "origin", "angles", and "joint".
* These must be set prior to calling attach.
**/
scriptEvent void attach( entity ent);

https://wiki.thedarkmod.com/index.php?title=AI_Attachment_Ingame_Editing

 

Alternatively, it might be simpler to have the AI already in position, but hidden at map start ( $AIGuard.hide(); ).  Then show them when needed and trigger them to start their path.  

(edit) .hide() doesn't seem to work fort AI. You'd need to add a path_hide node to their route and path_waitfortrigger then path_show 

(edit again) actually path_hide / path_show and $AI.hide() / $AI.show() both work, but it depends on the AI type! 

 

 

Edited by grodenglaive
Posted
21 hours ago, grodenglaive said:

Alternatively, it might be simpler to have the AI already in position, but hidden at map start ( $AIGuard.hide(); ).  Then show them when needed and trigger them to start their path.  

(edit) .hide() doesn't seem to work fort AI. You'd need to add a path_hide node to their route and path_waitfortrigger then path_show 

The wiki mentions that path_hide doesn't work well with AI

https://wiki.thedarkmod.com/index.php?title=Path_Nodes#path_hide

Quote

Supposedly deactivates and stops rendering the AI. It turns out this doesn't work well with TDM...makes AI invisible but they still talk and occupy space

I guess I'll have to try with scripting and see if it works.

Posted
On 6/23/2026 at 11:50 AM, Jnon said:

def_attach only work at map start, or is it possible to apply to an AI after spawn

Well if it's applied as a spawnarg, then it's applied when the ai is spawned. Trying to change it later via a spwanarg doesn't work. At least that is how I understood it.

Posted
13 minutes ago, datiswous said:

Well if it's applied as a spawnarg, then it's applied when the ai is spawned. Trying to change it later via a spwanarg doesn't work. At least that is how I understood it.

Perhaps a better way to phrase the question is "can I attach props like lanterns and torches to AI in the same way def_attach allows post-spawn, or can it only be done at spawn via spawnargs?"

From what I know, bind only tethers props to an AI, but the def_attach method actually changes their behavior (ie, held torches and held up in an appropriate pose, etc). Based on what I've already done, I could theoretically just bind torches to their hands and use a different atdm:teleport to bring them along, but the torches would just be awkwardly glued to their hands and hanging at their sides, which is not ideal.

Posted
On 6/22/2026 at 2:53 PM, Jnon said:

I wanted to keep some hostile thugs in an isolated box outside the map, but teleport them in after an objective is achieved and have them patrol the (previously safe) area. In basic terms, I can do that by triggering an atdm:teleport. The only problem with this is any props I attach via either bind or def_attach doesn't move with them.

I did exactly this in One Step Too Far using def_attached props and a small script that activated teleportation entities:

void MenReturn()					//thugs return to their house on the beach
{
	sys.wait(10);
	sys.trigger($danger_ambient);
	$woodsman_teleport1.activate($Woodsman1);
	$woodsman_teleport2.activate($Woodsman2);
	$woodsman_teleport3.activate($Woodsman3);
	$woodsman_teleport4.activate($Woodsman4);
	sys.trigger($start_AI);
	$boat1.setOrigin('-8084 30528 -13452');
	$boat2.setOrigin('-8512.1 30535.5 -13453.4');
	sys.trigger($gold_bar_hint_speaker);

	$player1.replaceInvItem($BookFog,$null_entity); 	//BookFog is removed
	$player1.addInvItem($BookMen);				//player receives BookMen
	sys.trigger($BookMenAcquireSound);			//plays a sound when receiving the book
	$Window_Porch_Outside.Close();				//bugfix
	thread BookMenPost();

	sys.wait(50);
	$danger_ambient.fadeSound(SND_CHANNEL_ANY, -30, 20);
	sys.wait(20);
	sys.trigger($danger_ambient);
}

thugs.pfbx

def_attach, besides binding the prop at the correct position, angle and bindpoint defined in the prop definition, can also alter animations and various behind the scenes work to make the AI work well with that prop. I think it should also be possible to bind a prop entity after the map has started and achieve the same effect, but haven't tried and you would probably need a supporting script to calculate the correct position. If you bind a normal moveable entity or even a func_static it'll just be a visual model next to the AI, which is fine for keys but not for lamps etc.

Normally bound entities should follow the parent entity's position and rotation around exactly, including when it's teleported. If the teleport entity leaves bound entities behind it's a bug that should be reported - may be worth isolating that into a test map and filing an issue on the bugtracker. It's surprising to me since almost all AIs have def_attached props (i.e. weapons) and a lot of mappers have used the teleport entities before.

  • Like 1
Posted
31 minutes ago, Dragofer said:

Normally bound entities should follow the parent entity's position and rotation around exactly, including when it's teleported. If the teleport entity leaves bound entities behind it's a bug that should be reported - may be worth isolating that into a test map and filing an issue on the bugtracker

I suppose I'd better. I'll see if I can reproduce it first, then file a report once I have a test map for it.

Worth noting that weapons def_attach'd to AI as part of their default configuration survives teleportation intact, not sure if that's relevant.

Posted

I have to (rather sheepishly) admit that I can't reproduce this now. The last time I used def_attach to give lanterns to my teleporting thugs, the lanterns were definitely left behind, but this time I tried re-adding those spawnargs and now they teleport with the lanterns properly.

It's possible I'd misspelled the pos_attach spawnarg that didn't attach it properly? I'm not sure what happened, tbh.

At any rate, please disregard this... turns out it's a non-issue after all.

  • Like 2

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • jaxa

      Talk GabeCube:
      https://forums.thedarkmod.com/index.php?/topic/18055-2016-cpugpu-news/page/39/#findComment-508710
      · 1 reply
    • The Black Arrow

      Things have been so bad these days for me...
      Just a year ago, I've been feeling dizzy, I thought it was nothing, today's stress, that type of thing, went to sleep...Still dizzy! 9 more days dizzy, went to doctor (I would have gone on the first day if NOT for the long appointment time)
      Said it may be Neck Dizziness...I did exercises for 6 months, no changes.
      Went to a Physical Therapist, went to another, no changes.
      I've asked my doctor for a full check this time.
      I hated yesteryear so much due to personal reasons, this year might be the same.
      To be brutally honest, I'd rather have cancer or/and chronic pain than suffer dizziness any second longer, especially when nothing helps.
      Hard to enjoy Thief when you're dizzy so I was hoping this year, Winter will be best for me.
      · 7 replies
    • JackFarmer

      Hello mappers and taffers! 

      Are you still out there? It is so calm here these days and I am afraid this is no good sign.
      Proof me wrong, tell your best friend (=me), that you are still here and that you will not go away!
      · 5 replies
    • JackFarmer

      Happy Labour Day, my taffing taffers & hard working mapping friends!
      And remember the poor souls who, within the Inventors’ organization, labor under Jonus’s yoke to ensure the success of that very guild! Always remember the hard workers!
      · 2 replies
    • datiswous

      Is there a script command to make a screenshot?
      I just though it could be interesting to be able to create a screenshot at a certain point in time. Then use that screenshot possibly in a debrief.
      I guess the second question is: Can you use a (in-game made) screenshot in a (debrief) gui?
      · 1 reply
×
×
  • Create New...