Jump to content
The Dark Mod Forums

Newbie DarkRadiant Questions


demagogue

Recommended Posts

It's alive!

#ifndef INVSWITCH
#define INVSWITCH
object invswitch : player_tools
{
    void   init();
    void inventoryUse(entity userEntity, entity frobbedEntity, float buttonState);
};

    void invswitch::init()
{
sys.waitFrame();
}

    void invswitch::inventoryUse(entity userEntity, entity frobbedEntity, float buttonState)
{
sys.trigger($helmet_light);
sys.trigger($helmet_light_sound);
}

#endif
  • Like 2

S2wtMNl.gif

Link to comment
Share on other sites

atdm:target_setobjective_visibility have these options:

obj_visibility (If set to 1, this objective is visible)

obj_state (The visibility that the given objectives should be set to (1 = shown, 0 = hidden, defaults to 1).)

 

I don't understand difference between them. I guess none of them will set objective to invisible again if I trigger target_setobjective_visibility second time later, so I need two different entities for this to happen?

  • Like 1

S2wtMNl.gif

Link to comment
Share on other sites

According to the Wiki, obj_state should not be about visibility, but if the objective is complete, incomplete, invalid or failed.

http://wiki.thedarkmod.com/index.php?title=Objectives

 

objN_state (int) Defines the state of the objective at map start.
Possible Objective States:
  • 0 = STATE_INCOMPLETE
  • 1 = STATE_COMPLETE
  • 2 = STATE_INVALID
  • 3 = STATE_FAILED
Code defaults to 0 = incomplete.
Edited by Destined
  • Like 1
Link to comment
Share on other sites

I think to turn it invisible again you would have to change its settings via a map script.

eg.

scriptEvent void setObjectiveVisible(float ObjNum, float val);

 

which would be

name_of_objective_controler = the entity that contains all your default objectives settings at map start.

 

$<name_of_objective_controler>.setObjectiveVisible( n, 0); //where n is the objective number

 

example of make something visible

$my_objectives.setObjectiveVisible( 5 , 1 );

  • Like 2
Link to comment
Share on other sites

I have a question; I'm trying to test one of my missions, including AI behavior and entity interactions. However I already have AI relations established, and can only enter some areas without being attacked. Is there no cheat code to disable AI hostility and make all AI friendly, or make the player invisible to all AI? I really hope there is such a thing, I could definitely use it.

Link to comment
Share on other sites

Something very useful is to bind such commands to keys, for example I've typed these into the console:

 

bind "n" "noclip"

bind "t" "notarget"

bind "h" "god"

bind "b" "_impulse27"

bind "." "tdm_showloot"

 

Press n and t as soon as your WIP map has loaded and you'll be invisible and noclipping.

 

Edit: _impulse27 shows the areas where the engine has created pathfinding for the AIs. It generates pathfinding even in high-up places that aren't accessible to AIs, which can be avoided by making monsterclip brushes as tall as the room or the sky.

Edited by Dragofer
Link to comment
Share on other sites

Running into another little problem: I added an AI in my tavern whom I want to be singing a song on the lute, as I've seen in a few other missions. I gave it the property "def_attach" "atdm:prop_playable_lute": The lute appears in its hand and the animation executes accordingly. However, there is no song playing! How do I define the music to be played while the AI is singing, and where do I find the sound definitions for that too?

 

I'm not sure I see fog there; maybe you're referring to lamp haze particles?

 

Yes: I'm referring to the volumetric haze seen under the lamp. I'm already using that light entity, but the haze doesn't seem to appear by default.

Link to comment
Share on other sites

That's probably the tdm_lamphaze_wide_yellow particle effect, or a similar one, with a func_emitter positioned and rotated to match the lamp.

The only lute player I definitely remember seeing was in The Siege Shop (though it doesn't use the prop entity), and that appears just to use a speaker with "s_shader" "music_harp01". Maybe someone who's used the prop knows a better way.

Edited by VanishedOne

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Link to comment
Share on other sites

That's probably the tdm_lamphaze_wide_yellow particle effect with a func_emitter positioned and rotated to match the lamp.

 

The only lute player I definitely remember seeing was in The Siege Shop (though it doesn't use the prop entity), and that appears just to use a speaker with "s_shader" "music_harp01". Maybe someone who's used the prop knows a better way.

 

Thanks, I'll take a look at that. I don't remember the exact name of the mission, but it was a tavern and the singer was located in the upstairs area.

 

I could use a speaker of course, but it needs to be properly triggered by the AI, else if you kill them or scare them off the music would keep playing. In the example I'm referring to, I did scare the lute player out of curiosity, and the music stopped the moment he got off the chair and restarted the moment he began playing again.

Link to comment
Share on other sites

King of Diamonds, possibly? I don't see anything obviously affecting the speaker here though. (Edit: in fact, from the acuity spawnargs it looks as though he's set to be never alerted, so it must be some other mission.)

// entity 1693
{
"classname" "atdm:ai_townsfolk_commoner_02"
"name" "atdm_ai_townsfolk_commoner_02_1"
"acuity_aud" "0.00"
"acuity_vis" "0.00"
"canLightTorches" "0"
"def_attach6" "atdm:prop_playable_lute"
"def_attach7" "atdm:prop_key_simple"
"def_head" "atdm:ai_head08_commoner_blonde"
"def_vocal_set" "atdm:ai_vocal_set_critic_unarmed_01"
"disable_alert_idle" "1"
"fov" "0"
"fov_vert" "0"
"name_attach7" "patricks_key"
"neverdormant" "0"
"noDamage" "1"
"origin" "612 -200 240"
"pos_attach6" "hips"
"pos_attach7" "belt_back_right"
"rotation" "-0.1214 -0.992604 0 0.992604 -0.1214 0 0 0 1"
"set inv_name on patricks_key" "Patrick's Chest Key"
"set name on patricks_key" "patricks_key"
"sitting" "1"
"target0" "path_cycleanim_1"
"team" "5"
}
// entity 1705
{
"classname" "speaker"
"name" "speaker_2"
"origin" "616 -184 288"
"s_maxdistance" "9"
"s_mindistance" "1"
"s_shader" "lute_song"
"s_waitfortrigger" "0"
}
// entity 1706
{
"classname" "path_cycleanim"
"name" "path_cycleanim_1"
"anim" "play_lute_idle"
"origin" "584 -176 276"
}
Edited by VanishedOne

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Link to comment
Share on other sites

King of Diamonds, possibly? I don't see anything obviously affecting the speaker here though. (Edit: in fact, from the acuity spawnargs it looks as though he's set to be never alerted, so it must be some other mission.)

 

It's one of the missions I played recently, so it's likely. I remember that, as I occasionally do in every TDM mission when I get bored, I threw some objects at AI's heads to start some trouble. The bard who was playing did stop singing, get up and walk around... then if I remember correctly, sat down again and started playing once he calmed down. I definitely wouldn't want to make the AI both immune to alerts let alone immortal, which would be a silly solution (how much the first DeusEx game suffered from using this approach :P ).

Link to comment
Share on other sites

I think, one of the most elegant ways to do this would be to include the sound in the animation. You can use a frame command for that:

http://wiki.thedarkmod.com/index.php?title=Frame_commands

 

The definition, into which this frame command has to be put, can be found in "tdm_ai_guard_proguard_devel.def" in the def folder. However, I am not sure if the sound immediately stops if the animation is canceled. But at least the sound is linked to the animation.

Link to comment
Share on other sites

I think, one of the most elegant ways to do this would be to include the sound in the animation. You can use a frame command for that:

http://wiki.thedarkmod.com/index.php?title=Frame_commands

 

The definition, into which this frame command has to be put, can be found in "tdm_ai_guard_proguard_devel.def" in the def folder. However, I am not sure if the sound immediately stops if the animation is canceled. But at least the sound is linked to the animation.

 

Nice. How would I define that as properties on a given AI entity from DarkRadiant though? I'd really rather not create an entire new character definition just to add a sound.

Link to comment
Share on other sites

You can add spawnargs on any entity with a script containing the function $entityname.setKey(property, value);

 

The catch is many properties only work at spawntime and not if they're put in during game time. That's one reason to have def files in the first place. You can test it and find out.

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

I did wonder about frame commands, but I suspect they'll only work well for strumming chords or something, so whether they're a good choice will depend on what kind of musical sound you want (and have assets for).

 

I think it's the model def. that needs to be adapted to add new frame commands; you should, I think, be able to inherit from the usual one, then set your entity's "model" spawnarg to use the customised one.

Edited by VanishedOne

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Link to comment
Share on other sites

I have two sliding doors that seem to be going through each other. I have tried setting the spawnargs "interruptable" and "stop_when_blocked" to "1" and adding collision brushes but nothing seems to work.

 

Basically I just need the door to stop from opening if it comes into contact with another brush/door/player.

Link to comment
Share on other sites

I did wonder about frame commands, but I suspect they'll only work well for strumming chords or something, so whether they're a good choice will depend on what kind of musical sound you want (and have assets for).

 

I think it's the model def. that needs to be adapted to add new frame commands; you should, I think, be able to inherit from the usual one, then set your entity's "model" spawnarg to use the customised one.

No, it is not the model def that is modified, it is a seperate definition for the animation (also not the md5anim, but another one). In the file "tdm_ai_guard_proguard_devel.def" you will find all animations that are based on the proguard model (which should currently include all animations based on male models). Among them are the animations called "play_lute_idle", "play_lute_idle2", and "play_lute_idle_random". In there you have a path for the md4anim file that is used and after that in brackets the frame commands. There is already one called "frame 1 call overrideLegs". You can just add another line "frame 1 sound soundname" to start the sound "soundname" at the first frame of the animation (maybe you have to change the number behind the frame for a short delay). However, I am still not sure if the sound stops, when the animation is aborted.

 

Edit: I just thought of another possible problem to this approach: The frame command gets called each time the animation is repeated. So, if you have a sound that has a different length than the animation, it might lead to a sudden restart of the sound (maybe accompanied by the sounds being played on top of each other) or a pause if the sound is too short. I think, this makes the frame command approach not really useful for you :-/

I have just found a script reference called "getAnimState(float channel)", so it might be possible to turn on the sound you want as long as the animation is playing and turn it off, when it isn't playing anymore. However, I have not enough experience with scripting to further help with this approach...

Edited by Destined
Link to comment
Share on other sites

I have this script for dozen on info_location sounds:

$info_location_1.setKey("ambient","snd_silence");

 

It seems fine at the beginning, but after a few minutes of looking at AI and not interacting with anything fps count start to pulse and drops (more than once/sec) more and more as time goes. I'm not even sure if is this command that causing it, anyone have seen something similar?

Edited by ERH+

S2wtMNl.gif

Link to comment
Share on other sites

No, it is not the model def that is modified, it is a seperate definition for the animation

From http://wiki.thedarkmod.com/index.php?title=Frame_commands#How_to_use

 

You need an animation in the md5anim format, and a definition for your AI, which must be placed in the model defitinion of your AI.

I read that as saying the anim. has to be defined inside a model def. (which is how the examples I've looked at do it). Is it wrong? (Edit: and if it is and you can have an anim. def. outside a model def., does the global or local scope take precedence where two anim. defs share a name?)

Edited by VanishedOne

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

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