View Issue Details

IDProjectCategoryView StatusLast Update
0005319The Dark ModCodingpublic10.07.2022 10:10
ReporterDragofer Assigned ToObsttorte  
PrioritynormalSeveritynormalReproducibilityalways
Status resolvedResolutionfixed 
Product VersionTDM 2.08 
Target VersionTDM 2.11Fixed in VersionTDM 2.11 
Summary0005319: Trigger_multiple stops working if AI stops moving
DescriptionAs discovered by VanishedOne (https://forums.thedarkmod.com/index.php?/topic/20475-dragofers-scripting/), trigger_multiple brushes only get activated by moving AIs.

When an AI walks through a trigger_multiple brush, the trigger_multiple brush regularly triggers its targets. If the AI stops inside the brush, the trigger_multiple stops triggering. This is different for the player: for the player, it doesn't matter whether he's moving, the trigger_multiple always works.
Steps To ReproduceI've attached a test FM (map name: test.map) with the player and a neutral AI standing on 2 different boats. The AI walks into a trigger_multiple brush, activating a presence lamp. When he waits (path_wait), the lamp switches off. When he starts moving out of the trigger_multiple brush, the lamp switches on again until he's left the brush.
Additional InformationThe current implementation of my Lost-City style presence lamps (see linked thread) relies on trigger_multiple brushes, so currently they don't work with AIs.
TagsNo tags attached.

Activities

Dragofer

Dragofer

03.08.2020 13:56

developer  

trigger_multiple.pk4 (236,716 bytes)
nbohr1more

nbohr1more

29.12.2020 03:50

developer   ~0013305

Do we know if there are any missions that rely on this buggy behavior?
It is a little risky to modify this in the middle of 2.09 beta.
Dragofer

Dragofer

29.12.2020 09:01

developer   ~0013306

Last edited: 29.12.2020 10:28

If the FM database could be searched for any missions that contain entities with certain combinations of spawnargs, then it could maybe be narrowed down enough for a mapper to manually check the missions whether they need the curent buggy behaviour.

Any of these values for "classname": "trigger_entityname", "trigger_facing", "trigger_multiple", "trigger_presize"
+ "anyTouch" "1"

Any of these values for "classname" might also be interesting on their own, regardless of combination: "trigger_inactivity", "trigger_random"
nbohr1more

nbohr1more

02.01.2021 18:19

developer   ~0013347

Maps that use "trigger_multiple (thus far):

NHAT (anoott)
Winter Harvest
Business as Usual
Patently Dangerous
"Prologue"
Tears of St Lucia

(Strangely, I got 2 different results when grepping my Dev and Beta fms folders... )
Dragofer

Dragofer

02.01.2021 20:50

developer   ~0013349

Thanks, though there are also variants of trigger_multiple (see previous post) that would be good to check for since they may share code.
Obsttorte

Obsttorte

12.06.2022 04:32

developer   ~0014867

In idAI::Anim_Move I've found this at line 6046:

const idVec3& org = physicsObj.GetOrigin();
if (oldorigin != org) {
    TouchTriggers();
}

So it appears this is no bug but the way it was originally intented (probably a leftover from Doom 3). I test what happens if I change this.
Obsttorte

Obsttorte

12.06.2022 05:40

developer   ~0014868

Yep, that's it. Without hte condition the trigger behaves as desired.
Discussed also here: https://forums.thedarkmod.com/index.php?/topic/20475-dragofers-scripting/&_fromLogin=1
Frost_Salamander

Frost_Salamander

12.06.2022 12:17

reporter   ~0014873

Could it be that both scenarios are valid, and the mapper could choose the desired behavior with a spawnarg?

I was just working on something that was using a trigger multiple. I wanted something to trigger a sound when you walked through it. It worked great, except if you stopped in the middle of it then the sound kept repeating. It was one of those non-solid, translucent 'drapes' that you place over a doorway and I wanted it to make a 'whoosh' sound when you walked through it. So in this case, I wanted it to only work when the player first touches it. It was very thin as well (as was the trigger), so it only made sense to trigger once per 'touch'.
Obsttorte

Obsttorte

12.06.2022 14:21

developer   ~0014877

Note though that for the player a continuos triggering is the default behaviour, so changing that would also potentially break existing mission. I could add such a spawnarg and set it so that the default spawnargs are different for ai and player, but that is as unintuitive as the current setup.

Something like you mention would btw. still be possible, as functions called by triggers passes their activator. So you could track how long ago an entity has triggered the respective trigger the last time to get the desired effect. Triggers are imho not really meant for complex setups, though, that's what stims&response and scripts are meant for.
Frost_Salamander

Frost_Salamander

12.06.2022 14:51

reporter   ~0014878

Hmm ok - maybe just checking if the player is moving (or not moving in this case) in the script would be enough. I'll try that - thanks.

I realise my comment doesn't really help with fixing the original issue - I just wanted to see if both scenarios could be supported in any upcoming fix...
Obsttorte

Obsttorte

12.06.2022 19:15

developer   ~0014883

"Maps that use "trigger_multiple (thus far):

NHAT (anoott)
Winter Harvest
Business as Usual
Patently Dangerous
"Prologue"
Tears of St Lucia"

I've checked those maps and the triggers do only respond to the player. The only trigger I found that responds to ai is in "A New Job" and it is a trigger_once_entityname to teleport an ai.

Commited with rev. 9932.

Sidenote: I don't think we need to add additional spawnargs etc. to the triggers as suggested by Frost_Salamander. Triggers can already call scripts and those can check whether whatever additional condition is met.
VanishedOne

VanishedOne

12.06.2022 21:24

reporter   ~0014888

trigger_once uses the same spawnclass so perhaps it should be checked as well?
VanishedOne

VanishedOne

12.06.2022 21:27

reporter   ~0014889

Never mind, I see you did check for trigger_once_entityname. Sorry, please ignore.
stgatilov

stgatilov

13.06.2022 05:57

administrator   ~0014890

I checked: the condition was in the original commit in 2004.

Possible issues could be 1) breaking existing map, and 2) bad performance.
But both points look very unlikely to me.

Issue History

Date Modified Username Field Change
03.08.2020 13:56 Dragofer New Issue
03.08.2020 13:56 Dragofer File Added: trigger_multiple.pk4
29.12.2020 03:50 nbohr1more Note Added: 0013305
29.12.2020 09:01 Dragofer Note Added: 0013306
29.12.2020 09:02 Dragofer Note Edited: 0013306
29.12.2020 10:27 Dragofer Note View State: 0013306: private
29.12.2020 10:28 Dragofer Note Edited: 0013306
29.12.2020 10:28 Dragofer Note View State: 0013306: public
02.01.2021 18:19 nbohr1more Note Added: 0013347
02.01.2021 20:50 Dragofer Note Added: 0013349
04.01.2021 20:23 Dragofer Target Version TDM 2.09 => TDM 2.10
21.12.2021 15:06 Dragofer Target Version TDM 2.10 => TDM 2.11
12.06.2022 04:32 Obsttorte Note Added: 0014867
12.06.2022 05:40 Obsttorte Assigned To => Obsttorte
12.06.2022 05:40 Obsttorte Status new => assigned
12.06.2022 05:40 Obsttorte Status assigned => feedback
12.06.2022 05:40 Obsttorte Note Added: 0014868
12.06.2022 12:17 Frost_Salamander Note Added: 0014873
12.06.2022 14:21 Obsttorte Note Added: 0014877
12.06.2022 14:51 Frost_Salamander Note Added: 0014878
12.06.2022 19:15 Obsttorte Status feedback => resolved
12.06.2022 19:15 Obsttorte Resolution open => fixed
12.06.2022 19:15 Obsttorte Fixed in Version => TDM 2.11
12.06.2022 19:15 Obsttorte Note Added: 0014883
12.06.2022 21:24 VanishedOne Note Added: 0014888
12.06.2022 21:27 VanishedOne Note Added: 0014889
13.06.2022 05:57 stgatilov Note Added: 0014890
10.07.2022 10:10 Dragofer Category Script/Def => Coding