Jump to content
The Dark Mod Forums

Newbie DarkRadiant Questions


demagogue
 Share

Recommended Posts

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.

Link to comment
Share on other sites

@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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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"

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 Share


  • Recent Status Updates

    • Nort

      I want to be a fish, but I'm not a fish. My mom wants to be a fish too, and so she's killing herself eating plankton and sh***ng blood, and tells me to stop nagging her about taking her medication. I spent several hours today, just lying in bed, having anxiety over just existing, and not being a fish. You fish, you don't know how lucky you are. You can eat all the plankton you want. I tried eating plankton again yesterday, and I just got sick. I hate being a shark.
      · 0 replies
    • Nort

      I just gave myself vertigo. A pleasant kind of vertigo, like the world has been lifted off my shoulders. I'll explain:
      Yesterday I saw to my dismay, that I had made my entire map two - two - units too short on every level - that every set01 piece was sticking 2 units into the ceiling. That's basically 402 brushes that needs to be realigned (minus the ground floor brushes).
      I knew enough about selections to do all of that in a very tense five minutes, and it compiled without leaks. (Thank you so much, Dark Radiant devs, for making an editor with such care for precision that you can align hundreds of brushes perfectly at once (which is not something I can say for Valve's Hammer editor, which has some serious issues on that front, which actually made me just quit it in disgust).) However, the result is that the entire level has now been stretched a barely noticable 2 units, and it will take some getting used to psychologically.
      · 0 replies
    • Nort

      My workflow is basically running from a chain of disasters, eventually trying to seek shelter in former disasters. It's not ideal - it's just my life.
      When I abandoned my first map, it was out of a typical mental breakdown, and so I returned to find a skybox void where the kitchen door should have been (due to a misplaced visportal) and two overlapping brushes Z-fighting on the kitchen floor.
      I've now cleaned up the last bit of mess, by cleanly separating every floor into its own layer. Now I can finally work on each floor in peace.
      ...not that I really needed to. Once you get skilled enough, the orthographic messes, well, I'll let this video speak for itself:
       
      · 1 reply
    • Nort

      Beams, beams, beams...
      Support beams, and cross beams, and then beams to fixate the support beams to the cross beams. The more beams you have in a map, the better. There's walls, floors and ceilings, but the rest of the map is pretty much just beams. Beams makes a thief happy.
      · 0 replies
    • jaxa

      Embracer Group is Buying Square Enix Montréal, Eidos, and Crystal Dynamics for “Only” 300 Million USD: https://wccftech.com/embracer-group-square-enix-montreal-eidos-crystal-dynamics/
      · 1 reply
×
×
  • Create New...