Jump to content
The Dark Mod Forums

Newbie DarkRadiant Questions


demagogue

Recommended Posts

29 minutes ago, Geep said:

Maybe that can be faked somehow. Create an AI that looks like a guard, but is really a civilian, and swap that character in to replace a real guard when the skeleton appears?

Would be a rather ugly hack. Perhaps I'll suggest this on the tracker, if the feature is considered useful enough to bother it shouldn't be hard. Surprised no one's thought of it yet: Most undead FM's seem to take place in an universe where zombies and skeletons are known to exist... but imagine a more "grounded" one where it's so rare it's still considered fairytales by the people, then skeletons appear on the streets and guards are so scared by the unusual they drop their weapons and run instead of doing their job and attacking.

  • Like 1
Link to comment
Share on other sites

On 5/12/2023 at 9:16 PM, OrbWeaver said:

You need to install the darkradiant-plugins-darkmod package.

Ah, I see! Thank you, I just installed that package and now all of the missing menu items are where they should be.

  • Like 1
Link to comment
Share on other sites

I've got a window (func_static made of textures/darkmod/glass/clear_warp). Just on the other side of it is a frobable object. The player can see it and frob it. I want to prevent frobing through the glass window. Other than lowering the frob distance, is there a way to stop frobing through the window? I tried adding a tdm_nodrawsolid_glass func_static 'over' the window, and made it frobable (to catch the frob first), but that didn't work, I could still frob the object on the other side.

Link to comment
Share on other sites

4 minutes ago, joebarnin said:

I've got a window (func_static made of textures/darkmod/glass/clear_warp). Just on the other side of it is a frobable object. The player can see it and frob it. I want to prevent frobing through the glass window. Other than lowering the frob distance, is there a way to stop frobing through the window? I tried adding a tdm_nodrawsolid_glass func_static 'over' the window, and made it frobable (to catch the frob first), but that didn't work, I could still frob the object on the other side.

I had this in In Plain Sight. I used a location script to only make the item frobable when the player entered the room (and turn it off when exiting).

  • Thanks 1
Link to comment
Share on other sites

31 minutes ago, DeTeEff said:

Tiniest question...how do I kill the player via script if

$player1.kill();

doesn't work?

I have tested and yes, the script fires as it should...

 

 

https://github.com/thedarkmodcommunity/scripts/blob/main/player/kill_player.script

  • Like 1
Link to comment
Share on other sites

On 5/21/2023 at 11:21 AM, DeTeEff said:

Tiniest question...how do I kill the player via script if

$player1.kill();

doesn't work?

I've changed the example code in wiki entries "Scripting basics" and "My first map script" to use what @Frost_Salamander indicated:

$player1.setHealth(0); // kill the player

instead of

$player1.kill();

  • Like 3
Link to comment
Share on other sites

I've created a very simple tutorial on my Wiki home page on how to create a material/texture from an online source (e.g. textures.com) using GIMP.  This is something I didn't know how to do and wished that it existed when I started.  Yes, there are some existing Wiki pages that kind of describe how to do this, but they are wildly out of date with respect to the tools used and are full of gaps to the uninitiated.  What I've pieced together mainly came from existing Wiki sources, but updated with the current version of GIMP.

I obviously realise that to a lot of people here this is 101 level stuff, but for myself and other complete n00bs that want to build something, basic tutorials like this are invaluable. 

It's using GIMP just because it's free and does most things a n00b will want to do, especially when it comes to dealing with older file formats that TDM requires.

Anyways, the point of this post is I would like to ask if anyone who DOES know what they are doing could cast their eye over the tutorial and point out any gaffes or downright incorrect/misleading information. Not so much in the proofreading sense or GIMP-specific things (although that would be welcome too), but more around the images/properties themselves.  I've labelled some sections with (ADVICE NEEDED) for stuff that I really don't understand very well but the whole thing is fair game.  The tutorial is very short, and if anything is glaringly wrong it should be easy to spot by knowledgeable people.

The main things I don't understand are the image properties when exporting - there are a million options and I don't know what most of them do.  I've looked some of them up, but I don't necessarily know what's best for TDM. All I know is that what I've written seems to work.

Perhaps if this gets into a state that makes sense we can add it to the main Wiki and clean up some of the existing sections on this.

Link here: https://wiki.thedarkmod.com/index.php?title=User:Frost_Salamander#Creating_a_material_using_existing_images_(e.g._from_textures.com)_using_GIMP  

Edited by Frost_Salamander
  • Like 3
Link to comment
Share on other sites

Once more something I'm not planning on using right away but was thinking of for an idea I had: Is it possible to have a random value that can be used on maps but global to a campaign so that it's the same on every map? This would be nice so whenever you start a campaign, you can have some things be unique each time.

Example: Let's say you have an important character in your campaign, you'll meet this AI on multiple maps. You want to do something special and have the character be either male or female as a 50/50 change. The random choice would be saved when the campaign is started: On maps featuring them you define both the male and female version, but hide both and use a teleport target to only move one to the world area, with the hypothetical entity responsible for checking the random value triggering one teleporter if "chance < 0.5" and the other if "chance >= 0.5".

Link to comment
Share on other sites

There's some scripting features that allow campaign-persistent variables to be stored: see the wiki

 

Right at the very beginning of the first mission you'd call a function that looks something like this:

void setup_campaign_vars() {
    float coinflip;
    coinflip = sys.random(2);
    if(coinflip<1) sys.setPersistantArg("person_is_male", "1");
            else sys.setPersistantArg("person_is_male", "0");
    return;
}

In that map or any later map in the campaign you can look up the persistent variable with

float person_is_male = sys.getPersistantFloat("person_is_male");
  • Thanks 2

My missions:           Stand-alone                                                      Duncan Lynch series                              

                                      Down and Out on Newford Road              the Factory Heist

                                                                                                  A House Call

                                                                                                  The House of deLisle                                                                                                  

                              

Link to comment
Share on other sites

31 minutes ago, thebigh said:

There's some scripting features that allow campaign-persistent variables to be stored: see the wiki

 

Right at the very beginning of the first mission you'd call a function that looks something like this:

void setup_campaign_vars() {
    float coinflip;
    coinflip = sys.random(2);
    if(coinflip<1) sys.setPersistantArg("person_is_male", "1");
            else sys.setPersistantArg("person_is_male", "0");
    return;
}

In that map or any later map in the campaign you can look up the persistent variable with

float person_is_male = sys.getPersistantFloat("person_is_male");

Thanks... that's awesome, will gladly keep it in mind. Can't avoid needing a custom script but I cannot complain: I'll likely write a custom map entity for this, can use it to do both storing and triggering based on circumstance.

Since I already asked, I kinda had a part two to my question: Is it possible to change AI definitions in realtime, so for minor changes you don't need to register a different AI altogether? Namely the model, skin, head definition, and voice; Can a script replace them? For the body model / skin I think that would work like on func_static, but def_head and def_vocal_set are probably read once on map load and not updated in realtime. It would also break precaching and cause a jitter.

Problem is that if I leave the unused AI in a hidden box on the map, it's still loaded in memory and thinks thus wasting CPU. Can I at least delete an entity I don't want safely? The difficulty filter does that, entities not corresponding to a given difficulty are erased... this however is likely decided during loading which wouldn't work here.

Link to comment
Share on other sites

In a TDM script (in real time) I want to calculate the angle between two points ('vectors' in the scripting language). It's basically arctan - but there is no 'arctan' function in the TDM script language. Is there any way to call an external script or function? Like, jython?

Worst case, I can hard-code a table of values, but that is kludge-a-rific.

Link to comment
Share on other sites

What exactly are you trying to do? There is an acos function which, with some wangling, should be able to give you the angles you need?

The angle between two vectors is given by acos( A·B/(|A||B| )

If you're after theta here:

trig1337.png.7b88dbb2f4659cd8d95e837297be7e75.png

 

the angle theta is indeed atan(b/a), but it is also acos(a/√(b²+a²))

 

You just have to be careful about angles greater than 90, or greater than 180.

  • Thanks 1

My missions:           Stand-alone                                                      Duncan Lynch series                              

                                      Down and Out on Newford Road              the Factory Heist

                                                                                                  A House Call

                                                                                                  The House of deLisle                                                                                                  

                              

Link to comment
Share on other sites

26 minutes ago, joebarnin said:

In a TDM script (in real time) I want to calculate the angle between two points ('vectors' in the scripting language). It's basically arctan - but there is no 'arctan' function in the TDM script language. Is there any way to call an external script or function? Like, jython?

Worst case, I can hard-code a table of values, but that is kludge-a-rific.

The way Id do it is sys.VecToAngles( point2 - point1 );

That gets you a set of angles from 0 to 360 - if you need their overall magnitude you could use sys.vecLength( angles ); Alternatively you can convert them with sys.angToForward( angles ); if you only need the angle on the horizontal plane.

You can also use anglemod180( angles ); to convert angles to the range -180 to +180. I believe that function only lets you do 1 angle at a time.

@thebighwere you able to get persistantargs to work?

@MirceaKitsuneI think you'd be better off respawning an AI with the desired properties. I highly doubt TDM allows you to alter an AI to that extent.

  • Thanks 1
Link to comment
Share on other sites

37 minutes ago, Dragofer said:

were you able to get persistantargs to work?

I confirmed they work within the same map, and persist over save-quitgame-load. I haven't tried a campaign before so I can't verify whether persistent args survive moving to a new map, I'm just going by what the wiki says.

Edited by thebigh

My missions:           Stand-alone                                                      Duncan Lynch series                              

                                      Down and Out on Newford Road              the Factory Heist

                                                                                                  A House Call

                                                                                                  The House of deLisle                                                                                                  

                              

Link to comment
Share on other sites

1 hour ago, Dragofer said:

The way Id do it is sys.VecToAngles( point2 - point1 );

That gets you a set of angles from 0 to 360 - if you need their overall magnitude you could use sys.vecLength( angles ); Alternatively you can convert them with sys.angToForward( angles ); if you only need the angle on the horizontal plane.

Brilliant, this worked like a charm.

  • Like 1
Link to comment
Share on other sites

I'm having trouble getting an AI character to follow the player. I have a path_follow_actor node at the end of the AI's path and the node targets Player1. The AI follows the rest of her path normally, but stops at path_follow_actor and just stands there like an idiot no matter what I do. Am I referencing the player incorrectly?

Link to comment
Share on other sites

9 minutes ago, grodenglaive said:

I'm having trouble getting an AI character to follow the player. I have a path_follow_actor node at the end of the AI's path and the node targets Player1. The AI follows the rest of her path normally, but stops at path_follow_actor and just stands there like an idiot no matter what I do. Am I referencing the player incorrectly?

I tried this as well and couldn't get it to work either.  Same result as you.  It works if it targets another AI, but not the player.  Would be interested to know if anyone else got it to work.

  • Sad 1
Link to comment
Share on other sites

Can you maybe kludge this by creating a non-solid invisible and completely inert AI, and binding it to you? Then the AI that's meant to be pursuing you will follow the invisible dummy.

Edited by thebigh

My missions:           Stand-alone                                                      Duncan Lynch series                              

                                      Down and Out on Newford Road              the Factory Heist

                                                                                                  A House Call

                                                                                                  The House of deLisle                                                                                                  

                              

Link to comment
Share on other sites

5 hours ago, thebigh said:

Can you maybe kludge this by creating a non-solid invisible and completely inert AI, and binding it to you? Then the AI that's meant to be pursuing you will follow the invisible dummy.

Unfortunately that didn't work, she still wont follow me. It's not a big deal, I just gave the AI her own path to follow to the exit. I can put in a couple path_waitfortrigger so the player doesn't fall too far behind.

Edited by grodenglaive
Link to comment
Share on other sites

 

9 hours ago, thebigh said:

Can you maybe kludge this by creating a non-solid invisible and completely inert AI, and binding it to you? Then the AI that's meant to be pursuing you will follow the invisible dummy.

Possibly the reason this doesn't work is because the FollowActorTask code screens out actors that are NULL, AI_DEAD, or AI_KNOCKEDOUT.

Edited by Geep
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.


  • Recent Status Updates

    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
    • nbohr1more

      Please vote in the 15th Anniversary Contest Theme Poll
       
      · 0 replies
×
×
  • Create New...