Jump to content
The Dark Mod Forums

Recommended Posts

Posted

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.

Posted

@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.

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

Posted

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

Posted

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.

Posted

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

Posted

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.

Posted

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? :)

Posted

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.

Posted
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"

 

Posted

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".

Posted

@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.

Posted (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 by Fieldmedic
Posted
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.

Posted
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 

 

  • Thanks 1
Posted

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.

Posted
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?

Posted
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.

Posted
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.

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

    • JackFarmer

      "The Year of the Rat." 
      😄

      Al Stewart must be proud of you!
      Happy testing!
      @MirceaKitsune
      · 1 reply
    • datiswous

      I posted about it before, but I think the default tdm logo video looks outdated. For a (i.m.o.) better looking version, you can download the pk4 attached to this post and plonk it in your tdm root folder. Every mission that starts with the tdm logo then starts with the better looking one. Try for example mission COS1 Pearls and Swine.
      tdm_logo_video.pk4
      · 2 replies
    • JackFarmer

      Kill the bots! (see the "Who is online" bar)
      · 3 replies
    • STiFU

      I finished DOOM - The Dark Ages the other day. It is a decent shooter, but not as great as its predecessors, especially because of the soundtrack.
      · 5 replies
    • JackFarmer

      What do you know about a 40 degree day?
      @demagogue
      · 4 replies
×
×
  • Create New...