Jump to content
The Dark Mod Forums

Newbie DarkRadiant Questions


Recommended Posts

@MirceaKitsune

With a button you can also trigger scripts to run. $NPC_Name.kill();  should go in a script. In fact it's very simple, and can get very complicated. When you make a switch, instead of targeting a light ( ctrl+k), you can trigger a "atdm:target_callscriptfunction" (rightclick (with nothing selected) and choose Create entity -> Targets -> atdm:target_callscriptfunction. You'll get a yellow cube. Select the switch, then the yellow cube and press ctrl+k.

 

Then select only the  yellow cube. In the entity inspector you add a new "spawnarg" by typing in the first box: call and in the second box: kill, like this: kill.jpg

Then you have to open notepad and type the following, where $Target_1 $Target_ etc (you can add more targets ofc.) are the names of the AI that should die, with $ in front of it ($gatekeeper, $guard2, $whatever ... ).

void kill() //this could also be: void DropDead() if you set the spawnarg "call" to "DropDead"
{
$Target_1.kill();
$Target_2.kill();
$Target_3.kill();
}

Then save it with the same name as your map as a .script file; yourmap.script.

That .script file must now be put in the same directory as where your .map file is, and it should work.

Springheels method is easier for this case, especially when you bind the damage brush to the AI ... but with a little knowledge of scripting you can do a whole lot of epic stuff : )

Edited by STRUNK
Link to post
Share on other sites
  • Replies 10k
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

So I have this gigantic scorpion, it is made out of pendulums bound together. I had an idea about dragging whole thing through a piled up crates (pretending to be stone blocks in a wall), but it looks

I'm just going to make the lute player an undead immortal skeleton called Ralph who is eternally bound to play his lute in the tavern, the residents are used to him now so they just happily co-exist a

Thanks for the advice about the tent, guys. Finally got around to (mostly) fixing it; shadows were indeed the problem.    

Posted Images

30 minutes ago, grayman said:

In your objective, fill in this field:

Never worked with objectives, so I don't even know where to find (fill in) that : D 

The script I understand.

Edited by STRUNK
Link to post
Share on other sites
1 hour ago, STRUNK said:

Never worked with objectives, so I don't even know where to find (fill in) that : D 

The script I understand.

What's happening in the game at the moment you want to kill this NPC?

Are you trying to get it to happen in the background, or is the player going to perform some action?

Link to post
Share on other sites

Thanks for the suggestions! I'm trying the script method but for some reason it doesn't want to work. If the map is mymap.map I named the script mymap.script, placing it in the maps directory next to the map file. The atdm:target_callscriptfunction is triggered by a trigger_relay, which I know works as I have it turn off some lights which happens successfully, the arrow from it to the script trigger also visible. It contains "call: kill" with the contents of the script being:

void main()
{

}

void kill()
{
	$atdm_ai_townsfolk_commoner_1.kill();
	$atdm_ai_guard_female_rogue_1.kill();
	$atdm_ai_townsfolk_wench_armed_1.kill();
}

What am I doing wrong?

Link to post
Share on other sites

Got it to work! The issue was that I was calling my function "kill" which was already a defined function, renaming it solved the problem and got the NPC's to die accordingly.

One more question for the night: Where in the entities is the gramophone located? I was looking for the disc player I noticed a lot of missions have, but couldn't find it anywhere.

  • Like 2
Link to post
Share on other sites
12 hours ago, MirceaKitsune said:

I'm hoping this can be achieved without pinning the death on the player too, so it doesn't appear as damage dealt in the stats at the end of the game while also not failing "don't kill anyone" objectives which are meant to fail only if the player attacks that AI normally.

I am pretty sure that the script with the "kill" option will trigger the "don't kill anyone" objective, because this only checks if the AI dies, not by whose hand. This is why it might be better to go with the "become ragdoll" route.

Link to post
Share on other sites
9 hours ago, STRUNK said:

Never worked with objectives, so I don't even know where to find (fill in) that : D 

The script I understand.

Under the "Map" tab you have the "Objectives" button that opens the objectives editor (Wiki page about it). With this, you dont't have to write the objectives by hand. When you create an objective that way, you have a couple of fields where you can call scripts or activate targets upon completion or failure of the respective objectives.

 

Link to post
Share on other sites
8 hours ago, grayman said:

What's happening in the game at the moment you want to kill this NPC?

Are you trying to get it to happen in the background, or is the player going to perform some action?

It should happen when an objective is completed.

Link to post
Share on other sites

@Destined

Thanx for the wiki link, I got it figured out. There is a checkbox "Player responsible", and when that is checked for the "do NOT kill"Component, the mission only fails when the player kills an AI, not when AI is killed by a script.

@grayman

I got it working.

@MirceaKitsune

I made a little map with the things you want to happen, and added a little something to the script to have the AI not drop dead all at once, but with a little time in between. Be shure to also read the wiki page about Objectives that Destined linked to to understand what is going on in the Map -> Objectives  (editor). Note that the yellow cube is a "atdm:target_addobjectives" and the (renamed) "kill" script is not called by a (simular looking) "atdm:target_callscriptfunction" but from the Objective(s) "Steal the Trophy".

Put the map and the script in the folder where your own map and script is, so you can check it out and run it like your own map.

Objectives.mapObjectives.script  VIDEO Objectives

For the gramophone: Create model -> darkmod/musical/grammo3.ase. If you want music to come out of it when frobbed, add 2 spawnargs in the Entity editor (of the gramophone) : frobable:1 and frob_action_script:frob_trigger

Now Create speaker (like you create an entity or a model etc) and choose: The Dark Mod 2.0 (Standalone)/sfx/world/musical/frob_instrument_victrola , and click ok.

Then, in the speakers Entity editor add a new spawnarg: s_waitfortrigger:1 (otherwise it starts playing at game/map start).

Now simply select the grammo, then the speaker and press ctrl+k so the speaker is triggerd when the grammo gets frobbed.

You can set the reach of the sound comming from the speaker by dragging in or out the cricle(sphere) around it (a bit like how you can do with lights). Also read https://wiki.thedarkmod.com/index.php?title=Setting_Up_Speakers for more about working with speakers. 

I also made a more complex map with the gramophone and playing music is now an objective to complete the mission, adding yet an other way to complete objectives : 

 Objectives2.scriptObjectives2.map Video Objectives2

 

Edited by STRUNK
Link to post
Share on other sites
1 hour ago, STRUNK said:

@Destined

Thanx for the wiki link, I got it figured out. There is a checkbox "Player responsible", and when that is checked for the "do NOT kill"Component, the mission only fails when the player kills an AI, not when AI is killed by a script.

 

For the gramophone: Create model -> darkmod/musical/grammo3.ase. If you want music to come out of it when frobbed, add 2 spawnargs in the Entity editor (of the gramophone) : frobable:1 and frob_action_script:PlayMusic

To your script (you already have) add the following:


void PlayMusic()
{
sys.trigger($Music);
}

Now Create speaker (like you create an entity or a model etc) and choose: The Dark Mod 2.0 (Standalone)/sfx/world/musical/frob_instrument_victrola , and click ok.

Then, in the speakers Entity editor  change the speakers name to Music, so the script can trigger it, and add a new spawnarg: s_waitfortrigger:1 (otherwise it starts playing at game/map start).

You can set the reach of the sound comming from the speaker by dragging in or out the cricle(sphere) around it (a bit like how you can do with lights). Also read https://wiki.thedarkmod.com/index.php?title=Setting_Up_Speakers for more about working with speakers.

 

I missed that checkbox. Good to know!

For the gramophone: If I remember correctly you don't need a script. I think you can directly target the speaker with the gramophone and it should switch its on/off state as soon as the gramophone is frobbed. So just use the gramophone, give it the spawnarg frobable: 1, target: speakername and the speaker s_waitofrtrigger: 1. I am not 100% sure that it works, but it would be much easier and avoids having to use another script.

Link to post
Share on other sites

Maybe it needs a trigger entity in between. I think there is a difference between targeting and triggering. But it is quite some time since I last worked with speakers... The trigger (or trigger array) could then also target an objective change entity.

If you are used to scripts, they are easier, but if you want to avoid them, there are also other ways in many cases. Not for everything, of course, but you can do a lot of stuff even without scripts.

  • Thanks 1
Link to post
Share on other sites

@Destined

I tried again with the grammo, but nothing happens, even with a trigger in between. I guess a model on it's own doesn't have anything in it to define what happens when frobbed, so a frob_action_script should be added. I also tried frob_action_script:frob_door , that is already in the game itself, so doesn't have to be scripted separately, but that doesn't work. But I found a post regarding this:

That way it works without having to write your own script : )

Thanks .. I have put the simple/obvious method in to the post/tutorial.

Edited by STRUNK
  • Like 1
Link to post
Share on other sites

Got the desired effect with the gramophone, thanks. As a note I also had to add s_looping 1 otherwise it only plays once... s_maxdistance is useful to adjust how loud it is and where you hear it from.

Another quickie in the meantime: Now that TDM has OpenEAX and sound effects work for us Linux users too, I'm thinking of using that in my FM for a hallway. How do I enable audio echoes for a large chamber?

Link to post
Share on other sites
23 minutes ago, MirceaKitsune said:

Got the desired effect with the gramophone, thanks. As a note I also had to add s_looping 1 otherwise it only plays once... s_maxdistance is useful to adjust how loud it is and where you hear it from.

Another quickie in the meantime: Now that TDM has OpenEAX and sound effects work for us Linux users too, I'm thinking of using that in my FM for a hallway. How do I enable audio echoes for a large chamber?

See:

https://wiki.thedarkmod.com/index.php?title=Setting_Reverb_Data_of_Rooms_(EAX)

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to post
Share on other sites
8 minutes ago, nbohr1more said:

Thanks, will try it now.

Also a really basic question... one I'm ashamed to ask but for some reason I really can't find the solution: How do I properly flatten the texture on a patch?! I tried Natural and Normalize in the Surface Inspector but none of the options there are managing to fix this.

Screenshot_20201023_210339.thumb.png.992ce4e4340365d4cf4740f0c9b88ad5.png

Link to post
Share on other sites
13 minutes ago, STRUNK said:

@MirceaKitsune

I don't understand what you mean. You have a patch that is half a sphere and want to have that rug fitting the patch, or do you want a straigt flat rug/carpet?

I want the texture to be flat and not distorted, as if the surface of a common brush was textured with it. I know it's possible and did it before but for some reason I can no longer find the button for it.

Link to post
Share on other sites
2 minutes ago, STRUNK said:

Aha : )

When I make a spere patch and then apply a texture it seems ok.

Sphere.jpg

The texture is bending toward the edges like in my example. That's okay in some cases but in mine I need to make the texture flat as if on an ordinary surface. I'm sure there is an option for that but where?

Link to post
Share on other sites
1 hour ago, MirceaKitsune said:

The texture is bending toward the edges like in my example. That's okay in some cases but in mine I need to make the texture flat as if on an ordinary surface. I'm sure there is an option for that but where?

You can try to copy the shader of another surface and paste it onto your patch. If I remember correctly this had worked for some arches I made.

Link to post
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.


×
×
  • Create New...