Jump to content
The Dark Mod Forums

Newbie DarkRadiant Questions


demagogue

Recommended Posts

Example of handle use follows.

You might consider using the atdm_message entity, and showing the map through that. It has the advantage of already having a "show" time-out-if-not-clicked mechanic. Caveat: I didn't test this code

"classname" "atdm:gui_message"
"name" "atdm_gui_message_my_map"
"comment" "Slide of map. 'show' is maximum seconds if user doesn't click. 'lines' & 'text' are ignored."
"gui" "guis/my_map.gui"
"show" "10"

A script to use it might be like:

void show_map() // called from some external trigger
{
   sys.trigger($atdm_gui_message_my_map);
   tdm_gui_message e = $atdm_gui_message_my_map;
   // Can takes awhile for the overlay handle to be created and for e.gui to be non-zero.
   // If spawnarg "delay" is zero, the default, a 0.1 second delay is imposed.
   float handlenum = 0;
   while(handlenum == 0)
   {
       handlenum = e.gui; // 10 is default overlayHandle for atdm:gui_message layer
       sys.wait(0.1);
   }
   //sys.println("Handle Num: " + handlenum);
   // MAP IS NOW SHOWING
   float map_done = 0;
   while(map_done == 0)
   {
    // NOT SHOWN: your code here to calculate xdisp, ydisp;
    $player1.setGuiFloat(handlenum, "dispx", xdisp);
    $player1.setGuiFloat(handlenum, "dispy", ydisp);
    sys.wait(0.1);
    map_done = $player1.getGuiFloat(handlenum, "MyMapDone");
   }
}

Where associated my_map.gui is

windowDef MyMapSlide
{
    visible 1
    rect 0,0,640,480 // x, y, w, h. Origin upper-left
    backcolor 0, 0, 0, 1

    // Map clicked:
    onAction {
       set "MyMapSlide::visible" "0";
       set "gui::MyMapDone" "1";
    }

    windowDef MyMapArt {
        visible 1
        rect 0,0,640,480 // x, y, w, h.
        background    "guis/assets/my_map_art"
        // If you wanted map to have a transparent perimeter, you could base it on a standard asset like "guis/assets/readables/scroll"
        // In that case, adjust rect, which can be bigger than the parent if you want to reduce transparent perimeter.
    }

    windowDef Player_position {
    // NOT SHOWN: your code to read "gui::xdisp" and "gui::ydisp" to show player position
    }
}

 

Link to comment
Share on other sites

So using 

 $player1.setGuiFloat(handlenum, "dispx", xdisp);
 $player1.setGuiFloat(handlenum, "dispy", ydisp);

was the right syntax and my problem is the handlenum value? It's being handled by the inventory use action so shouldn't that be 1?

Link to comment
Share on other sites

I should mention that I used Grayman's method of getting an in game map with an atdm:map_of entity with the following spawnargs

 "name" "MapOfMaze"
"inv_map_start" "0"
"inv_name" "Maze Map"
"gui" "guis/map_of_maze.gui"

So this should work if I get the right handle number?

Link to comment
Share on other sites

Ooooo that looked so promising so I tried

        float inventoryHandle=$player1.getInventoryOverlay();
        $player1.setGuiFloat(inventoryHandle,"dispx",transpx);
        $player1.setGuiFloat(inventoryHandle,"dispy",transpy);

Close but no cigar.

Link to comment
Share on other sites

Hi @boissiere that's where it all started, in the wiki it says The scriptobject as well as an example setup can be found on @Obsttorte's thread which says the code is in the pk4.txt. From there it's not very clear what has to be done. All I want to do is regularly update  "gui::coordinates" as a string 0,1,2,3 in map_of_maze.gui

windowDef Desktop
{
       rect 0,0,640,480
       nocursor 1
 
       windowDef Maze_map
       {
               rect 130,2,428,476
               background "guis/assets/game_maps/map_of_maze"
               visible 1

    

    windowDef Player_position
        {
            rect "gui::coordinates" // Value to be updated constantly
            backcolor 0, 0, 0, 0
                  text "X"
                  font "fonts/andrew_script"
                  textscale .25
                  forecolor 0, 0, 0, 0.66
                  visible 1
         }
    }
    // Required include for inventory map as mentioned in the wiki
       #include "guis/readables/inventory_map.guicode"
}
 

Thanks for the advice, I'll keep going over the scriptobject wiki to see if I can find the solution.

Link to comment
Share on other sites

As one debugging technique you might try: just give the Player_position some fixed coordinates on-screen, and try to pass some content into the "text" (e.g., instead of the "X") from your script.

Link to comment
Share on other sites

I am a newcomer to using the Dark Radiant editor, does anyone have any tutorials on how to begin my first mission, room creation, lighting, character placement, object placement, in-game readables and stuff like that?

Link to comment
Share on other sites

26 minutes ago, Keyring93 said:

I am a newcomer to using the Dark Radiant editor, does anyone have any tutorials on how to begin my first mission, room creation, lighting, character placement, object placement, in-game readables and stuff like that?

You can start here: https://forums.thedarkmod.com/index.php?/topic/12558-useful-important-editing-links/

 

Specifically, I recommend Springheel's new mapper's workshop: https://forums.thedarkmod.com/index.php?/topic/18945-tdm-new-mappers-workshop/

 

Edited by Frost_Salamander

TDM Community Github: https://github.com/thedarkmodcommunity

My fan missions: The Hare in the Snare, Part 1

The Lieutenant Series: In Plain Sight  High Expectations Foreign Affairs

Link to comment
Share on other sites

On 7/13/2024 at 7:10 PM, Keyring93 said:

I am a newcomer to using the Dark Radiant editor, does anyone have any tutorials on how to begin my first mission, room creation, lighting, character placement, object placement, in-game readables and stuff like that?

You can find everything on the wiki, especially these video's:

https://wiki.thedarkmod.com/index.php?title=DarkRadiant_Video_Tutorials

@Springheel's video's give you a broad overview of a lot of things in mission making and or building it mostly uses pre-made prefabs

@Sotha's video are very informative about classic building with brushes and patches etc.

Edited by datiswous
Link to comment
Share on other sites

On 5/25/2024 at 8:21 PM, Geep said:

Yeah, I agree, it probably would be a good new-feature request for the bugtracker, and likely not too hard to implement.

I wouldn't mind having "side by side" tracking too (one or two more spawnargs), but that's no doubt a bigger bite, and has complications like passing through doors.

@Amadeus implemented this:

https://bugs.thedarkmod.com/view.php?id=6552

If you have more input, go there.

  • Like 2
Link to comment
Share on other sites

On 7/13/2024 at 1:10 PM, Keyring93 said:

I am a newcomer to using the Dark Radiant editor, does anyone have any tutorials on how to begin my first mission, room creation, lighting, character placement, object placement, in-game readables and stuff like that?

I found this (non-video) crash course very helpful. https://wiki.thedarkmod.com/index.php?title=A_-_Z_Beginner_Full_Guide_Start_Here!

Link to comment
Share on other sites

  • 2 weeks later...
1 hour ago, grodenglaive said:

I'm using some custom textures - TGA format. Does converting them to DDS have any performance benefit in game or is it just done to save space?

Both.

If the source texture is a compressed DDS with mipmaps, the game can load it directly into GPU memory. If it is an uncompressed TGA, the game will compress it and generate the mipmaps at runtime, which will have a performance cost (particularly if you have a large number of high-res textures). Once the texture upload is complete, there is no difference in terms of FPS.

Keeping the textures as TGA while you are developing the mission is fine, but you should definitely convert them to DDS before releasing the final mission package. The correct formats to use are DXT1 for diffuse maps (without alpha), and BC5/RGTC for normal maps.

  • Thanks 1
Link to comment
Share on other sites

  • 3 weeks later...

I don't think you can 'reset' a trigger_once. One way to do what you want is make it a trigger_multiple (wait = 1), then write script code that sets a flag the first time the trigger fires. The code that processes the trigger_multiple only does it if the flag hasn't been set. E.g.

boolean hasTriggered;

// code that processes trigger, only once
void myTriggerCode()
{
  if (!hasTriggered)
  {
    hasTriggered = true;
    // do whatever you want the trigger to do here
  }
}

void main()
{
  hasTriggered = false;
}

Then, put additional trigger_multiples around the main trigger area, and all these do is reset the boolean (hasTriggered = false). So when the player leaves the trigger area, the flag gets reset, so when they come back, the trigger is processed again.

  • Thanks 1
Link to comment
Share on other sites

I had a question for an idea I'm thinking of but haven't yet created a map for. I presume it will require scripting a custom entity, I did it before so that's fine if that's the case, but I'd like confirmation that the functions I'm thinking of would work as expected and what you think the best script structure is; I'd basically like a reusable entity which when triggered, changes the visibility / model / skin on all entities it targets.

The plan is to use this in a few exotic ideas for maps that mess with the player, allowing heavy modifications to rooms when the player isn't looking, without having to make copies of each area and teleport the player there which isn't seamless: I can use this as a workaround to our lack of warp zones in some situations to make places change heavily using smart trigger placement. The goal is to transform building modules and furniture including objects, such as switching a wall panel between the version with and without a door or a drawer between its covered and non-covered variant or a piece of furniture between the polished versus worn out version.

  1. Show / hide: I already know how to do this for mere func_static entities, you just set the initial visibility flag then trigger that entity. The problem is more complex entities, from movables to loot to AI. The later is especially important as I want AI and ragdolls appearing in and out of existence without having to teleport them each time: When turned off the AI should suspend all logical processing and become invisible / non-solid including all worn attachments, when made visible again the AI code and patrolling should resume from where it left off.
  2. Change model: I should mainly need this one for func_static entities, though I could use it on a few other things like doors... if the engine doesn't complain I may even switch the body and head model on AI to make characters subtly transform. I just need a way to set a new model on a static entity which also updates its collisions, ideally in a way that's precached so the engine doesn't hiccup during the change.
  3. Change skin: Should be the easiest one and should work on anything if changing the model does; I need the ability to change the skin on the selected entity to the given skin definition. I'll be heavily using this to change the colors or quality on building modules, changing paintings, possibly editing loot items to change vases between gold and bronze though in this case I'd also need a way to change the icon it displays after being picked up.
Edited by MirceaKitsune
Link to comment
Share on other sites

6 hours ago, joebarnin said:

For #3, there's a setSkin() script command. 

And for #2 there was equally a setModel() correct? They should work for most entities I imagine at least static ones. Biggest question here is if the models being set are precached in case they aren't used elsewhere on the map, if not the player will likely get a quick jitter and console warning when they first activate and load.

Biggest question is how to make an AI or ragdoll disappear and become completely disabled, then reappear again when reversing the effect. In the past I'd just teleport them away, but this becomes an issue if the AI patrols across a path_corner chain especially ones that play different animations like sitting or sleeping: You can only teleport them at a fixed point and not where they left off when disappearing, the engine will likely complain about having no path to the next node while the AI is in the invisible room then not know where to go next when the AI is brought back if it's at a fixed respawn point in that area.

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


×
×
  • Create New...