Jump to content
The Dark Mod Forums

Newbie DarkRadiant Questions


demagogue

Recommended Posts

8 hours ago, datiswous said:

Well could be useful to have spawnargs for this?

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.

Link to comment
Share on other sites

  • 2 weeks later...
On 5/24/2024 at 11:59 AM, nbohr1more said:

Hey!

Can I claim to be a newbie here?

I am trying to make an improved version of the Ropescroller script that sets a shader parm on the rope texture to make it scroll and fakes movement. I am working with a 3 state elevator rather than the two state elevator that was in "A New Job" ( where my original script was designed ). The elevator position entities only offer call_on_arrive and call_on_leave spawnargs so you cannot distinguish when the middle buttons intend to go up, down, or called to player. I tried adding a frob_action_script spawnarg to the buttons but it just kills the entities. Is there a preferred way to query which button was pressed and pass that to a script variable? As I can tell, the "elevator buttons entities" don't offer any end-point for making such a request?

To close the loop on this, I found this helpful wiki:

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

state_change_callback is the missing ingredient ( also, must be a "map" script for some reason )

  • Like 1

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

  • 2 weeks later...

I seem to have run into a wall. I'm consistently getting the same error when compiling AAS as part of the dmap process: "WARNING: reached outside from entity..." followed by the entity number and name. The issue is that the pointfile generated is going through solid brushwork and the origin of the entity in question isn't in the void. It's always my NPCs and if I delete that one, another random guard will cause it to fail. I'm really not sure what the issue is, these guards were perfectly fine when I dmapped previous versions of this map, only now am I getting this behavior. I checked around the forums to see if anyone had encountered this before but haven't really seen any mention of it. Any thoughts?

Link to comment
Share on other sites

38 minutes ago, Ansome said:

I seem to have run into a wall. I'm consistently getting the same error when compiling AAS as part of the dmap process: "WARNING: reached outside from entity..." followed by the entity number and name. The issue is that the pointfile generated is going through solid brushwork and the origin of the entity in question isn't in the void. It's always my NPCs and if I delete that one, another random guard will cause it to fail. I'm really not sure what the issue is, these guards were perfectly fine when I dmapped previous versions of this map, only now am I getting this behavior. I checked around the forums to see if anyone had encountered this before but haven't really seen any mention of it. Any thoughts?

I am pretty sure there is something leaky and several possibilities come to my mind. However, if you want a quick fix, just provide me a link with the WIP and I will have a look and you will get an answer within an hour as I am at home today.

  • Thanks 1
Link to comment
Share on other sites

1 hour ago, Ansome said:

I seem to have run into a wall. I'm consistently getting the same error when compiling AAS as part of the dmap process: "WARNING: reached outside from entity..." followed by the entity number and name. The issue is that the pointfile generated is going through solid brushwork and the origin of the entity in question isn't in the void. It's always my NPCs and if I delete that one, another random guard will cause it to fail. I'm really not sure what the issue is, these guards were perfectly fine when I dmapped previous versions of this map, only now am I getting this behavior. I checked around the forums to see if anyone had encountered this before but haven't really seen any mention of it. Any thoughts?

Interesting, I just ran into a similar issue during AAS compile. In my case I had moved the floor up a few units so the AI was spawning with it's feet embedded in the floor.  My error was "Warning: no entities found inside" though.

Link to comment
Share on other sites

@Ansome there's almost certainly nothing wrong with the entity itself. dmap is just telling you that the particular entity can 'see' into the void (and it stops at the first one that fails). I suspect that you have moved your 'solid' brushwork a smidgen and it's no longer actually solid. 

Link to comment
Share on other sites

JackFarmer fortunately resolved it for me pretty quickly. At some point, likely when rotating some of my prefabs made of a few different entity types, I had accidentally applied the rotation value to some worldspawn.

Link to comment
Share on other sites

  • 2 weeks later...

How do you determine if the player can see an object? There are a bunch of script methods (canSee, canSeeExt, canSeeEntity, canSeePositionExt), but they only work with AI objects, and the player isn't an AI.

Maybe something with stim/response? 

Link to comment
Share on other sites

3 hours ago, joebarnin said:

How do you determine if the player can see an object? There are a bunch of script methods (canSee, canSeeExt, canSeeEntity, canSeePositionExt), but they only work with AI objects, and the player isn't an AI.

Maybe something with stim/response? 

Maybe have a look at this? https://wiki.thedarkmod.com/index.php?title=Triggering_events_when_looking_at_something

It also links to a video where he explains how it all works.

  • Thanks 1

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/2/2024 at 7:48 PM, joebarnin said:

How do you determine if the player can see an object? There are a bunch of script methods (canSee, canSeeExt, canSeeEntity, canSeePositionExt), but they only work with AI objects, and the player isn't an AI.

 

On 7/2/2024 at 11:02 PM, Frost_Salamander said:

Maybe have a look at this? https://wiki.thedarkmod.com/index.php?title=Triggering_events_when_looking_at_something

It also links to a video where he explains how it all works.

The trigger_look script can trigger outside rooms. If you can specify where or when it runs (inside info_location area for example), I think it's useful, otherwise I think not.

The only place I know it's used is in mission Tears of st Lucia and there it is partly broken (I extensivelly tested it for a solution).

 

Btw. there's also trigger_facing

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

It's less complex but (I think) doesn't take height into account .

 

Edit: These script options are about if a user looks in a certain direction, which isn't really what you asked.

Edited by datiswous
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

On 7/2/2024 at 7:48 PM, joebarnin said:

How do you determine if the player can see an object? There are a bunch of script methods (canSee, canSeeExt, canSeeEntity, canSeePositionExt), but they only work with AI objects, and the player isn't an AI.

Quote

scriptEvent float canSeeEntity(entity target, float useLighting);

This is a general version of idAI::canSee, that can be used by all entities. It doesn't regard FOV, it just performs a trace to check whether the target is occluded by world geometry. Is probably useful for stim/response as well Pass useLighting = true to take the lighting of the target entity into account. Use "isEntityHidden" as a script event with a threshold. The constant threshold value for useLighting is defined within the SDK in game/entity.h.
Spawnclasses responding to this event: idEntity

Since it doesn't regard FOV of ai, isn't this also useful to check if player can see it?

Edit: I guess this doesn't take FOV of player into account, so might not be so useful.

 

Quote

scriptEvent float getFov();

    This returns the current FOV of the player. You can modify the current FOV with startZoom() and endZoom().

    Spawnclasses responding to this event: idPlayer

Maybe it's possible to do a check if object is in FOV of player?

Edited by datiswous
Link to comment
Share on other sites

What I ended up doing is to getting several pieces of data:

  • the position of the player's eyes (getEyePos())
  • the position of the object ($object.getOrigin())
  • where the player is looking (getViewAngles())
  • the FOV of the player (getFov())

and doing math/trigonometry to determine if the player can see the object. This code is not general purpose, since it doesn't deal with walls/obstacles/line-of-sight. In my case it will only need to run in a certain room, so it'll be "good enough".

  • Like 3
Link to comment
Share on other sites

8 hours ago, datiswous said:

Could you share the code?

Sure. It's a bit rough now. I'm going to clean it up and do some more testing. Once I'm not embarrassed to show it to others, I'll post it here lol.

Link to comment
Share on other sites

Hi all, I'm very new to TDM which I started playing a few months ago then later discovered the wonderful world of mapping with DarkRadiant and got hooked. With retirement coming up in a couple of months this has now become one of the hobbies on my list which also includes music (wind instruments, synthesizers and software), SBCs and microprocessors (ARMs, Arduinos and PICO pi) and of course relaxing by the pool. I've been having a lot of fun learning from scratch and building my first map using the Startpack. I used prefabs and models and started to build a small town, a mansion area, a forest area and a large underground maze.
I'm trying to use the map_of gui to show the current player position in the maze with an "X". 
I need to find a way to get the player coordinates from a script to the gui. 


//The map_of_maze.gui used with the inventory map in this case map_of_maze.tga

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
        {
// Not sure how but dispx and dispy need to be obtained from MazePosition script.
            rect dispx,dispy,dispx+1,dispy+40 
            backcolor 0, 0, 0, 0
                  text "X"
                  font "fonts/andrew_script"
                  textscale .25
                  forecolor 0, 0, 0, 0.66
                  visible 1
        }
    }
}


// The script to be called to get the player position parameters of where the 
// windowDef Player_position rect should be made visible.
// It will be called by trigger entities at the maze access points.

void MazePosition()
{
    sys.println("The Maze Position Script has been called.");
    // Getting player posision coordinates in real world 
    vector pos = $player1.getOrigin();
    float x = pos_x;
    float y = pos_y;
    float z = pos_z;

    // Coordinates of maze in real world
    float Lcoor = -512; // The Left margin.
    float Rcoor = 648; // The Right margin
    float Tcoor = 3840; // the Top margin
    float Bcoor = 644; // The Bottom margin

    // Coordinates of maze in map_of_maze.gui
    float Lmap = 50;
    float Rmap = 350;
    float Tmap = 0;
    float Bmap = 470;

    // Calculation for coordinates transposition from real world to maze map
    float xcent = abs ((x - Lcoor) / (Rcoor - Lcoor)) * 100;
    float ycent = abs ((y - Tcoor) / (Tcoor - Bcoor)) * 100; 
    float dispx = (((Rmap - Lmap) * xcent)/100) + Lmap;
    float dispy = (((Bmap - Tmap) * ycent)/100) + Tmap;
    // dispx and dispy need to be sent to windowDef Player_position before calling the GUI
}

Any help in finding a solution to my little problem would be greatly appreciated.
In the meantime I'll keep building.
Happy Mapping

Link to comment
Share on other sites

I do get the right coordinates with vector pos = $player1.getOrigin(); (what is the difference?) but I don't know how to get them from the script to the gui. I tried with gui_parm but either it doesn't work or I'm not using the right syntax. I only need to transfer dispx and dispy to the gui.

Link to comment
Share on other sites

@Geep Thanks for the quick response and sorry for the tardy response (got an invitation to check out a VR kit I might purchase). So in the script file do I wright it like this?

 float "dispx" = (((Rmap - Lmap) * xcent)/100) + Lmap;
 float "dispy" = (((Bmap - Tmap) * ycent)/100) + Tmap;

Because I read that in the script you don't use gui:: prefix. There aren't too many simple examples of this in the wiki.

Link to comment
Share on other sites

20 hours ago, northern_pilgrim said:

Hi all, I'm very new to TDM which I started playing a few months ago then later discovered the wonderful world of mapping with DarkRadiant and got hooked. With retirement coming up in a couple of months this has now become one of the hobbies on my list which also includes music (wind instruments, synthesizers and software), SBCs and microprocessors (ARMs, Arduinos and PICO pi) and of course relaxing by the pool. I've been having a lot of fun learning from scratch and building my first map using the Startpack. I used prefabs and models and started to build a small town, a mansion area, a forest area and a large underground maze.
I'm trying to use the map_of gui to show the current player position in the maze with an "X". 
I need to find a way to get the player coordinates from a script to the gui. 


//The map_of_maze.gui used with the inventory map in this case map_of_maze.tga

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
        {
// Not sure how but dispx and dispy need to be obtained from MazePosition script.
            rect dispx,dispy,dispx+1,dispy+40 
            backcolor 0, 0, 0, 0
                  text "X"
                  font "fonts/andrew_script"
                  textscale .25
                  forecolor 0, 0, 0, 0.66
                  visible 1
        }
    }
}


// The script to be called to get the player position parameters of where the 
// windowDef Player_position rect should be made visible.
// It will be called by trigger entities at the maze access points.

void MazePosition()
{
    sys.println("The Maze Position Script has been called.");
    // Getting player posision coordinates in real world 
    vector pos = $player1.getOrigin();
    float x = pos_x;
    float y = pos_y;
    float z = pos_z;

    // Coordinates of maze in real world
    float Lcoor = -512; // The Left margin.
    float Rcoor = 648; // The Right margin
    float Tcoor = 3840; // the Top margin
    float Bcoor = 644; // The Bottom margin

    // Coordinates of maze in map_of_maze.gui
    float Lmap = 50;
    float Rmap = 350;
    float Tmap = 0;
    float Bmap = 470;

    // Calculation for coordinates transposition from real world to maze map
    float xcent = abs ((x - Lcoor) / (Rcoor - Lcoor)) * 100;
    float ycent = abs ((y - Tcoor) / (Tcoor - Bcoor)) * 100; 
    float dispx = (((Rmap - Lmap) * xcent)/100) + Lmap;
    float dispy = (((Bmap - Tmap) * ycent)/100) + Tmap;
    // dispx and dispy need to be sent to windowDef Player_position before calling the GUI
}

Any help in finding a solution to my little problem would be greatly appreciated.
In the meantime I'll keep building.
Happy Mapping

I can't help you with map location gui, but welcome to TDM! It's a good way to waste time in retirement. Btw there is also a wonderful VR mod for TDM if you end up buying a headset (and you should), but it currently only works on the older missions (pre 2023). 

Link to comment
Share on other sites

Hi @grodenglaive thanks for the welcome. It's actually on the script side of things that my issue might be. I keep going back to the GUI::PARAMETERS wiki and I think I need to use the setGuiFloat command but I'm not sure about the handle thing.

void MazePosition()
{
    sys.println("The Maze Position Script has been called.");
    do {
        // Getting player posision coordinates in real world 
        vector pos = $player1.getOrigin();
        float x = pos_x;
        float y = pos_y;
        float z = pos_z;

        // Coordinates of maze in real world
        float Lcoor = -512; // The Left margin.
        float Rcoor = 648; // The Right margin
        float Tcoor = 3840; // the Top margin
        float Bcoor = 644; // The Bottom margin
    
        // Coordinates of maze in map_of_maze.gui
        float Lmap = 50;
        float Rmap = 350;
        float Tmap = 0;
        float Bmap = 470;

        // Calculation for coordinates transposition from real world to maze map
        float xcent = abs ((x - Lcoor) / (Rcoor - Lcoor)) * 100;
        float ycent = abs ((y - Tcoor) / (Tcoor - Bcoor)) * 100; 
        float transpx = (((Rmap - Lmap) * xcent)/100) + Lmap;
        float transpy = (((Bmap - Tmap) * ycent)/100) + Tmap;
        $player1.setGuiFloat(1,"dispx",transpx);
        $player1.setGuiFloat(1,"dispy",transpy);
        sys.println(transpx);
        sys.println(transpy);
        sys.println(z);
        sys.println("<------>");
        sys.wait(5);
        } while (z < -128);
}
 

The coordinates I get are correct but I just can't seem to get them to the map_of_maze.gui to change the values in its windowDef Player_position as shown below.

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::dispx", "gui::dispy", "gui::dispx"+1, "gui::dispy"+40
            backcolor 0, 0, 0, 0
                  text "X"
                  font "fonts/andrew_script"
                  textscale .25
                  forecolor 0, 0, 0, 0.66
                  visible 1
         }
    }
}
 

If someone knows how to do so PLEASE help. 🥺

 

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