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

    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 6 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
    • nbohr1more

      Looks like the "Reverse April Fools" releases were too well hidden. Darkfate still hasn't acknowledge all the new releases. Did you play any of the new April Fools missions?
      · 5 replies
×
×
  • Create New...