HMart Posted January 28, 2021 Report Share Posted January 28, 2021 Don't know anything about stim/response because I don't work with TDM engine, so the following may not work for you at all or TDM has something better, look at its wiki to be sure. Now I'm also, not really sure if the following suggestion is what you want but original idtech 4 projectiles add a https://modwiki.dhewm3.org/GetProjectileState_(script_event), see if it still works in TDM, one fast way to see if it probably does, is to see in the tdm_defs.script if the projectile state definitions are there, if they are then the GetProjectileState script func, probably works fine, and if it does, then by using those "enum" values, you can know the current state of the projectile and call a function, on any script_object script bound to the projectile, depending on its state, using https://modwiki.dhewm3.org/CallFunction_(script_event) or any TDM equivalent. Btw make sure to use a script_object script and "bind" it to the projectile, using spawnarg, key/val "scriptobject" "script_object_name", in the projectile definition file (if any), if not, CallFunction will not work or break, you can use https://modwiki.dhewm3.org/HasFunction_(script_event), to make sure the function exists in the entity. Quote Link to comment Share on other sites More sharing options...
Obsttorte Posted January 28, 2021 Report Share Posted January 28, 2021 @RedNoodles You can define custom stims and let the ai react to it by either adding a response to all ai's in your mission or by altering the scriptobject used by the ai, where you have to add a response in the init routine and define a script function with the respective actions to take place upon stim. Here you can find a similar setup: Here torch entities are stimming ai's to inform them they are there, and ai react if they are searching, but the basic functionality is similar to what you are aiming for. Quote FM's: Builder Roads, Old Habits, Old Habits Rebuild Mapping and Scripting: Apples and Peaches Sculptris Models and Tutorials: Obsttortes Models My wiki articles: Obstipedia Texture Blending in DR: DR ASE Blend Exporter Link to comment Share on other sites More sharing options...
Destined Posted January 28, 2021 Report Share Posted January 28, 2021 (edited) - did not see the page change, so my answer is irrelevant Edited January 28, 2021 by Destined Quote Link to comment Share on other sites More sharing options...
Geep Posted January 28, 2021 Report Share Posted January 28, 2021 I'm setting up a "do not kill civilians" objective, which is a bit hard to test quickly, so let me ask here if I'm doing it right. It's always kinda unclear what should be entered in the component subfields. In particular, should the "Kill target" be "Any AI of specified type" "is_civilian"? With Amount = 0? Here's all the details: Initial State INCOMPLETE Flags: Mandatory - TRUE (for the moment) Ongoing - TRUE Irreversible - FALSE Visible - FALSE (later TRUE) Component #1 ============ Component Type: Type AI is killed Flags: Satisfied at start - TRUE Irreversible - FALSE Boolean NOT - TRUE Player responsible - TRUE Kill target: Any AI of specified type : is_civilian Amount: 0 Quote Link to comment Share on other sites More sharing options...
Obsttorte Posted January 29, 2021 Report Share Posted January 29, 2021 https://wiki.thedarkmod.com/index.php?title=Objectives Quote FM's: Builder Roads, Old Habits, Old Habits Rebuild Mapping and Scripting: Apples and Peaches Sculptris Models and Tutorials: Obsttortes Models My wiki articles: Obstipedia Texture Blending in DR: DR ASE Blend Exporter Link to comment Share on other sites More sharing options...
Geep Posted January 30, 2021 Report Share Posted January 30, 2021 That's a pretty long, opaque article. I was hoping for a more focused suggestion. But what I gathered is: 1) "Any AI of specified type" is expecting a predefined enum, but where that is defined, I don't know. Searching the source code for "type" or SPEC_AI_TYPE wasn't fruitful. So I conclude this wiki comment can be answered in the negative: "Not sure if this is implemented yet" 2) I guess I could use the example "don't hurt AI" script, though it doesn't differentiate between player-caused and AI-caused hurt... probably won't be an issue in my case. 3) Evidently there's an "innocent" boolean I can set on each AI. Is that what the Objective Editor calls "Any AI with specified combat status"? If so, that would be my go-to solution, to decorate the 2 dozen AIs with innocent flags. Quote Link to comment Share on other sites More sharing options...
Geep Posted January 30, 2021 Report Share Posted January 30, 2021 Yup, (3) is working. Quote Link to comment Share on other sites More sharing options...
DeTeEff Posted February 4, 2021 Report Share Posted February 4, 2021 I want to control how the AI patrols via a randomizing script; The AI goes to say Corner 1 and that triggers a script that ADDS or CHANGES the targets on Corner 2. But I get stumped on the syntax for adding or changing the target spawnarg: When you change frobbability it looks like this $entity.setFrobable(1); so I thought it would be something like this $path_corner_2.addTarget(industry); or $path_corner_2.addTarget("industry"); or $path_corner_2.addTarget('industry'); but no, it doesn't work... Cheers Quote Link to comment Share on other sites More sharing options...
Dragofer Posted February 4, 2021 Report Share Posted February 4, 2021 A target is an entity, so if the targeted entity is called industry you'd use $path_corner_2.addTarget($industry); If you wanted to turn an entity name into a string you'd use $industry.getName(), but that would no longer point to a specific entity in the map, it'd just be a string of letters. Btw, for a string the syntax would be "industry". You might like to reference the new A to Z Scripting Guide on the wiki for this and more. Quote FM: One Step Too Far | FM: Down by the Riverside | FM: Perilous Refuge Co-FM: The Painter's Wife | Co-FM: Written in Stone Dragofer's Stuff | Dragofer's Scripting | A to Z Scripting Guide | Dark Ambient Music & Sound Repository Link to comment Share on other sites More sharing options...
DeTeEff Posted February 4, 2021 Report Share Posted February 4, 2021 Doesn't work that either...The guy just walk up to the path_corner (which is devoid of any targets) and stops. In case I didn't made myself entirely clear. I want to make the AI take different paths depending on a random number generated at map start. That number shall tell the path_node to get different targets. So I want to ADD a different target spawnarg depending on the rand number. if (rand == 0) { sys.print("\nGo to industry\n"); $path_corner_2.addTarget($industry); } if (rand == 1) { sys.print("\nGo to sidewalk\n"); $path_corner_2.addTarget($sidewalk); } BTW Ohh, has the scripting guides been updated/elaborated? Quote Link to comment Share on other sites More sharing options...
Destined Posted February 4, 2021 Report Share Posted February 4, 2021 This may seem like a stupid question, but do you call the script-function? If not, it would make sense that you don't add the target... I assume the sys.prints are to make sure that you do, but I just wanted to double check. This is something that could happen to me I just chekced the script reference page and I believe the correct way to write it would be something like sys.addTarget($path_corner_2, $industry). At least according to the wiki the entity, that the target should be added to, as well as the new target are defined inside the brackets: scriptEvent void addTarget(entity target); Add a target to this entity. target: the entity to add as target Spawnclasses responding to this event: idEntity) I chose sys as actor, as this seems the most likely to function as an actor, but I am not 100% sure, if this is correct. Quote Link to comment Share on other sites More sharing options...
DeTeEff Posted February 4, 2021 Report Share Posted February 4, 2021 12 minutes ago, Destined said: This may seem like a stupid question, but do you call the script-function? If not, it would make sense that you don't add the target... I assume the sys.prints are to make sure that you do, but I just wanted to double check. This is something that could happen to me I just chekced the script reference page and I believe the correct way to write it would be something like sys.addTarget($path_corner_2, $industry). At least according to the wiki the entity, that the target should be added to, as well as the new target are defined inside the brackets: scriptEvent void addTarget(entity target); Add a target to this entity. target: the entity to add as target Spawnclasses responding to this event: idEntity) I chose sys as actor, as this seems the most likely to function as an actor, but I am not 100% sure, if this is correct. Sorry, that doesn't work either; it says: "addTarget" is not callable as a 'sys' function" Quote Link to comment Share on other sites More sharing options...
Dragofer Posted February 4, 2021 Report Share Posted February 4, 2021 I'd try seeing what happens if you manually add industry as a target to path_corner_2, to rule out that it's a problem with the ingame entities. And yes kind of, that A to Z Scripting Guide is a new, multi-page series seeking to cover as much as possible about scripting in a single series. @Destined the entry says that spawnclass "idEntity" responds to this, so you need to call it on an entity, and then specify the entity that should be added in the brackets. There's also only space for a single entity variable with the name "target" in the brackets. You'd call the event on sys if the spawnclass "idThread" responded, instead of "idEntity". Quote FM: One Step Too Far | FM: Down by the Riverside | FM: Perilous Refuge Co-FM: The Painter's Wife | Co-FM: Written in Stone Dragofer's Stuff | Dragofer's Scripting | A to Z Scripting Guide | Dark Ambient Music & Sound Repository Link to comment Share on other sites More sharing options...
DeTeEff Posted February 4, 2021 Report Share Posted February 4, 2021 @Destined Hehe, yes I have made small console commands to make sure the script fires @Dragofer If I add the spawnarg "target industry" to the speciffic path_corner, the AI goes there, so there is no pathfinding error in the building part. Quote Link to comment Share on other sites More sharing options...
grayman Posted February 4, 2021 Report Share Posted February 4, 2021 Are you guys using the changetarget (sic) entity? The one that dynamically adds and subtracts targets? Quote Link to comment Share on other sites More sharing options...
DeTeEff Posted February 4, 2021 Report Share Posted February 4, 2021 @Grayman Didn't know that one... so nope, didn't use it...seems to be a better way. Thanks Quote Link to comment Share on other sites More sharing options...
DeTeEff Posted February 4, 2021 Report Share Posted February 4, 2021 (edited) I'm probably just dumb, but I can't get it to work...I've created the changetarget entity and named it change_it and on this entity I have added Target - path_corner_2 (there's a yellow line connecting them) and the spawnarg Add - industry Then I added this to the script sys.trigger($change_it); Have also tried a direct lever in game... EDIT Ahh, I added an initial target on path_corner_2. It didn't work unless I added a temporary target... Edited February 4, 2021 by Fieldmedic Quote Link to comment Share on other sites More sharing options...
Destined Posted February 4, 2021 Report Share Posted February 4, 2021 4 hours ago, Dragofer said: I'd try seeing what happens if you manually add industry as a target to path_corner_2, to rule out that it's a problem with the ingame entities. And yes kind of, that A to Z Scripting Guide is a new, multi-page series seeking to cover as much as possible about scripting in a single series. @Destined the entry says that spawnclass "idEntity" responds to this, so you need to call it on an entity, and then specify the entity that should be added in the brackets. There's also only space for a single entity variable with the name "target" in the brackets. You'd call the event on sys if the spawnclass "idThread" responded, instead of "idEntity". Ah, I misinterpreted that. I thought it meant "entity, target", not "target that is an entity". Sorry for the confusion. Quote Link to comment Share on other sites More sharing options...
madtaffer Posted February 7, 2021 Report Share Posted February 7, 2021 (edited) Can I organize 2 maps in DR like Collections in Blender which I can (un)hide? That would make easier to work in and focus on only 1 map or area. Edited February 7, 2021 by madtaffer Quote Link to comment Share on other sites More sharing options...
grayman Posted February 7, 2021 Report Share Posted February 7, 2021 1 minute ago, madtaffer said: Can I organize 2 maps in DR like Collections in Blender which I can (un)hide? That would make easier to work in and focus on only 1 map or area. Look for the topic “layers” in the wiki pages 1 Quote Link to comment Share on other sites More sharing options...
Frost_Salamander Posted February 14, 2021 Report Share Posted February 14, 2021 Anyone have a solution for this problem?: Because I'm using modules for walls, I have to monsterclip the hell out of each room, which means I can't place light switches in normal places like next to doors (cause AI always get caught in/near doorways without MC). I'm also finding that even without monsterclip, if the switch is placed on the module the AI won't go near it (along with other odd behaviour). I even tried the relight_position entity and it didn't help. Quote TDM Community Github: https://github.com/thedarkmodcommunity My fan missions: The Hare in the Snare, Part 1, In Plain Sight High Expectations Link to comment Share on other sites More sharing options...
JackFarmer Posted February 14, 2021 Report Share Posted February 14, 2021 9 hours ago, Frost_Salamander said: Anyone have a solution for this problem?: Because I'm using modules for walls, I have to monsterclip the hell out of each room, which means I can't place light switches in normal places like next to doors (cause AI always get caught in/near doorways without MC). I'm also finding that even without monsterclip, if the switch is placed on the module the AI won't go near it (along with other odd behaviour). I even tried the relight_position entity and it didn't help. Did you put brushes behind your modules? Quote Link to comment Share on other sites More sharing options...
Frost_Salamander Posted February 14, 2021 Report Share Posted February 14, 2021 33 minutes ago, JackFarmer said: Did you put brushes behind your modules? There is sealing geometry behind the wall modules if that's what you mean. Quote TDM Community Github: https://github.com/thedarkmodcommunity My fan missions: The Hare in the Snare, Part 1, In Plain Sight High Expectations Link to comment Share on other sites More sharing options...
Dragofer Posted February 14, 2021 Report Share Posted February 14, 2021 I'd make a simple brush-built test map containing only the lamp, switch and AI, to rule out that it's an issue with the lamp. Quote FM: One Step Too Far | FM: Down by the Riverside | FM: Perilous Refuge Co-FM: The Painter's Wife | Co-FM: Written in Stone Dragofer's Stuff | Dragofer's Scripting | A to Z Scripting Guide | Dark Ambient Music & Sound Repository Link to comment Share on other sites More sharing options...
Frost_Salamander Posted February 14, 2021 Report Share Posted February 14, 2021 2 minutes ago, Dragofer said: I'd make a simple brush-built test map containing only the lamp, switch and AI, to rule out that it's an issue with the lamp. Pretty sure the lamp is OK, if I drag the switch out to the middle of the room and leave it floating there, the AI uses it. Quote TDM Community Github: https://github.com/thedarkmodcommunity My fan missions: The Hare in the Snare, Part 1, In Plain Sight High Expectations Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.