Jump to content
The Dark Mod Forums

Newbie DarkRadiant Questions


demagogue

Recommended Posts

Yes you can put looping on the soundshader to have it loop, omni makes it sound from anywhere so you don't have to literally have it near the player, and some other spawnarg makes it environmental (coming from the direction of its source, e.g., if you wanted distant thunder), but I think you're not doing that here. And just by triggering a speaker, e.g., from a trigger brush, button, or activating it from inside a script, you turn it on and off, so no need to spawn it in.

Also note that I added a feature to the location sound system where you can override an ambient and trigger a sound directly, and that's already set up to be looping, omni, and all you have to do is put in the soundshader name on the entity. I made it for things like "action music" when a guard was alerted or music that plays when some other state is entered (like reading, or frobbing a thing, etc.) or some special zing music that triggers for story or gameplay reasons. So you can use that system too if you read up on it in the location system wiki entry, down a ways in the sound part.

The speaker route is probably simpler though if what you want to do is simple. Well they're just different tools that can do similar jobs, and you pick the one that does your job best or that you have a preference for.

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to comment
Share on other sites

Had my first attempt on testing my skills in dark radiant. Very quikly I run in to my first issue: Once I try to test my first room with "testmap" comand in console I jump in game but I see a simple room with the first texture selection I have made (not the later one) and I cant see my work on the vertexes although it seems that I have collision with them. Any help?

Link to comment
Share on other sites

@kin
testmap isn't ideal when you're starting out because it ignores errors in dmap and loads anyway. It's likely a leak prevented your map from compiling properly.

 

Regarding Mircea's speaker, it's meant to be part of an addon available to all maps and players, so he has to create the speaker via script rather than use DR. Would seem like something that startSound or demagogue's ambient override should be able to handle, though.

  • Like 1
Link to comment
Share on other sites

Much appreciated. The speaker remains unclear so for now I'm not implementing the sound part... it's no emergency anyway. I took note of the entity finding script, just what I needed for what I hope to do next :D

Using "player self = $player1" will correctly let me access the AI flags; I assumed that $player1 is automatically of type player, but now that I think twice it's indeed a plain entity definition. I can correctly read flags like self.AI_CROUCH now... but when it comes to crouching how can I also set it and tell the player to crouch?

I looked in the builtin scripts directory but couldn't find any reference for the word "breath". Wasn't the breath potion a default asset? Search isn't helping me and this time I used a search engine too.

Link to comment
Share on other sites

6 hours ago, MirceaKitsune said:

I looked in the builtin scripts directory but couldn't find any reference for the word "breath". Wasn't the breath potion a default asset? Search isn't helping me and this time I used a search engine too.

It is. You can find it in DR under Player_tools (atdm:playertools_breath_potion). It uses the script of the health potion, but has the heal type air. This is defined the def-file tdm_healing.def. I hope this helps.

Link to comment
Share on other sites

7 hours ago, Destined said:

It is. You can find it in DR under Player_tools (atdm:playertools_breath_potion). It uses the script of the health potion, but has the heal type air. This is defined the def-file tdm_healing.def. I hope this helps.

Aha... I see it now: So I would use $player1.heal("air", 1) to make the breath restore more rapidly. But how do I decrease the breath down to a certain amount as well... should I use heal with a negative value, a $player1.damage() event I can call with the right damage def, or perhaps there's a flag I can use to make the player act as if underwater? Also I don't even know how to read the breath of the player... we have $player1.getHealth() but no such thing as a getAir().

Link to comment
Share on other sites

21 hours ago, Dragofer said:

@kin
testmap isn't ideal when you're starting out because it ignores errors in dmap and loads anyway. It's likely a leak prevented your map from compiling properly.

 

Regarding Mircea's speaker, it's meant to be part of an addon available to all maps and players, so he has to create the speaker via script rather than use DR. Would seem like something that startSound or demagogue's ambient override should be able to handle, though.

Ok thanks. Started a new map file using the "map" command but every time I use the "Pointfile" command from the drop down menu I get an error message "could not open point file "miss name".lin (I get that message even after reinstalling everything from scratch, Darkmod and Darkradiant)

Edited by kin
Link to comment
Share on other sites

@kin
you need to dmap, then map. Dmap compiles the map and is needed whenever you create or modify a brush or patch. If a leak is found during dmap, a lin file is created.

Testmap combines both commands for convenience, but won't tell you if dmap found a leak and load anyway.

  • Thanks 1
Link to comment
Share on other sites

@MirceaKitsune
It's possible that healing works in a similar way to damage, in the sense that defs are used (damage defs). The fact that a string called "air" is involved makes that a little more likely. Could look if you find defs for healing and damage. And as I said earlier, Seed of Lodestar beta contains custom breath scripting.

As for crouching the player, there seems to be no obvious way. Still seems like it should be possible to push a button for the player... maybe research impulses some more?

Link to comment
Share on other sites

7 hours ago, MirceaKitsune said:

... we have $player1.getHealth() but no such thing as a getAir().

First I still see that you use "self" has a simple variable name, not sure if wise. For comparation, in c++ using "this" (self is like c++ this) as a normal variable name, is totally forbidden and will give you a compile error. 

Quote

functions on self

All function calls without a specific entity reference will be checked to see if it’s a function declared in the script object, or a script event on the the spawn class.

There is an equivalent way to call functions on the current entity that some prefer - self .[function].

From the doom 3 wiki.

Second have you tried to search the  tdm_events.script  to see the available script functions? Don't know if all player script functions are defined on there thou.  

Edited by HMart
Link to comment
Share on other sites

26 minutes ago, MirceaKitsune said:

tdm_events.script seems to contain documentation for the same functions as the Scripting Reference page. I search these periodically, however they don't provide functions or information for a few of the things needed.

In that case you have to code them yourself, like those inside the player object script, if the necessary peace's of information, is available to the script code, that I don't know if it is. 

Link to comment
Share on other sites

1 hour ago, HMart said:

In that case you have to code them yourself, like those inside the player object script, if the necessary peace's of information, is available to the script code, that I don't know if it is. 

I seemingly have the knowledge to do that, unless something more than my experiences with scripting so far is involved. Main problem with that is I'd need to modify a default script, talk with the devs to see if they approve the change, and even if they do wait for the next TDM release (one every 6 - 12 months) so it can be normally used by everyone.

Link to comment
Share on other sites

16 hours ago, MirceaKitsune said:

Aha... I see it now: So I would use $player1.heal("air", 1) to make the breath restore more rapidly. But how do I decrease the breath down to a certain amount as well... should I use heal with a negative value, a $player1.damage() event I can call with the right damage def, or perhaps there's a flag I can use to make the player act as if underwater? Also I don't even know how to read the breath of the player... we have $player1.getHealth() but no such thing as a getAir().

Unfortunately, I have no idea how to directly access air in any way. I have wanted to do that myself at some point (to mimic the player holding his breath in an area with heavy smoke), but could find no references. This led me to believe that breath is only referenced in the source code and is not accessible via script. If I remember correctly, the damage type "air" did not work. The only defined damage type that I could find is "no air", which means the player takes damage due to air reaching a value of 0. I vaguely recall that I was able to trigger a loss of air with a rather complex setup that involved some sort of vacuum entity (which is a relic from doom) and a door. When the door was opened, the air was removed from the whole room. Problem in this case was, that this would not only affect the player, but rather everything, so I abandonded the project. If you would like, I can check, if I still have the test map somewhere.

Link to comment
Share on other sites

7 hours ago, Destined said:

Unfortunately, I have no idea how to directly access air in any way. I have wanted to do that myself at some point (to mimic the player holding his breath in an area with heavy smoke), but could find no references. This led me to believe that breath is only referenced in the source code and is not accessible via script. If I remember correctly, the damage type "air" did not work. The only defined damage type that I could find is "no air", which means the player takes damage due to air reaching a value of 0. I vaguely recall that I was able to trigger a loss of air with a rather complex setup that involved some sort of vacuum entity (which is a relic from doom) and a door. When the door was opened, the air was removed from the whole room. Problem in this case was, that this would not only affect the player, but rather everything, so I abandonded the project. If you would like, I can check, if I still have the test map somewhere.

It might help to see it, sure! Though in this case it really feels like core TDM should make a change to the player script and add functions for accessing the breath: This sounds like a big limitation including for mappers.

Link to comment
Share on other sites

13 hours ago, MirceaKitsune said:

I seemingly have the knowledge to do that, unless something more than my experiences with scripting so far is involved. Main problem with that is I'd need to modify a default script, talk with the devs to see if they approve the change, and even if they do wait for the next TDM release (one every 6 - 12 months) so it can be normally used by everyone.

Afaik you don't need to edit the original player script inside the .pk4, you can just make a copy of it change what you want (minus the file name obviously) and put it inside your own script folder, the engine will override the main TDM with yours.  You can also create global script functions like those inside the tdm_util.script file. 

edit: see the tdm_custum_scripts.script file it has important info on how to make your own custom scripts

Edited by HMart
Link to comment
Share on other sites

9 minutes ago, HMart said:

Afaik you don't need to edit the original player script inside the .pk4, you can just make a copy of it change what you want (minus the file name obviously) and put it inside your own script folder, the engine will override the main TDM with yours.  You can also create global script functions like those inside the tdm_util.script file. 

In this case it really feels like something vanilla TDM could and would make sense to offer. So just as you have $player1.getHealth(), could we have a $player1.getAir() as well? And in this case a $player1.setAir() too to be able to change it?

This is an obvious limitation to be fair, and I'm assuming it would take a few minutes to implement such a hook for mod makers to use. If so maybe it can still hit 2.9, so it wouldn't take until next year to be able to use it?

@Dragofer@stgatilov@SpringheelAny thoughts on adding those functions to the player script? Is it something the devs would agree on and still possible to do before 2.9 goes out of Beta? If I have the time and knowledge, I might change the player script myself and post the updated with those functions... maybe I can even add a hook to let mods make the player crouch / jump and other things I needed to use in my mod but was missing functions for.

Edited by MirceaKitsune
Link to comment
Share on other sites

7 hours ago, kin said:

Is it possible to search entities, models or textures by typing in search box?

A very basic one... like Destined said if you write in a window you'll get a basic form of search. I suggested a better alternative recently, so far no response to my idea.

Link to comment
Share on other sites

1 hour ago, MirceaKitsune said:

A very basic one... like Destined said if you write in a window you'll get a basic form of search. I suggested a better alternative recently, so far no response to my idea.

Make a DR feature request tracker entry, in the DR (not TDM) bug tracker https://bugs.thedarkmod.com is the best option to make sure greebo sees the idea. 

Edited by HMart
Link to comment
Share on other sites

6 minutes ago, HMart said:

Make a DR feature request tracker entry, in the DR (not TDM) bug tracker https://bugs.thedarkmod.com is the best option to make sure greebo sees the idea. 

Was thinking of doing that... thanks for confirming, opened one.

  • Like 1
Link to comment
Share on other sites

For near-future reference: Is there a script function that allows me to print a message on the screen to the player, which shows up for a little then fades away? I searched the script reference wiki page but nothing for the word "message".

Also how do I check if the player is holding the USE key? Probably going to need that as well soon.

Edited by MirceaKitsune
Link to comment
Share on other sites

6 hours ago, MirceaKitsune said:

For near-future reference: Is there a script function that allows me to print a message on the screen to the player, which shows up for a little then fades away? I searched the script reference wiki page but nothing for the word "message".

Also how do I check if the player is holding the USE key? Probably going to need that as well soon.

You'd want to create a GUI message entity, either in DR or by spawning in a script. Set the "text" spawnarg in the same frame you trigger it. There are 2 versions, one with and one without the scroll texture.

I'm not aware of any way to check what key the player is pressing - the only thing I know of is the mouse gesture checking event, which is used to determine which way to swing the sword. The game calls a key press an "impulse", so you might want to use that as a starting point for research.

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  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • 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
×
×
  • Create New...