Geep Posted May 25 Report Share Posted May 25 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. Quote Link to comment Share on other sites More sharing options...
nbohr1more Posted June 6 Report Share Posted June 6 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 ) 1 Quote 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 More sharing options...
Ansome Posted June 19 Report Share Posted June 19 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? Quote Link to comment Share on other sites More sharing options...
JackFarmer Posted June 19 Report Share Posted June 19 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. 1 Quote Link to comment Share on other sites More sharing options...
grodenglaive Posted June 19 Report Share Posted June 19 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. Quote Link to comment Share on other sites More sharing options...
boissiere Posted June 19 Report Share Posted June 19 @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. Quote Link to comment Share on other sites More sharing options...
Ansome Posted June 19 Report Share Posted June 19 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. Quote Link to comment Share on other sites More sharing options...
joebarnin Posted July 2 Report Share Posted July 2 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? Quote Link to comment Share on other sites More sharing options...
Frost_Salamander Posted July 2 Report Share Posted July 2 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. 1 Quote 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 More sharing options...
datiswous Posted July 3 Report Share Posted July 3 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 I made one: https://bugs.thedarkmod.com/view.php?id=6552 1 Quote Link to comment Share on other sites More sharing options...
datiswous Posted July 3 Report Share Posted July 3 (edited) 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 July 5 by datiswous 1 1 Quote Link to comment Share on other sites More sharing options...
datiswous Posted July 5 Report Share Posted July 5 (edited) 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 July 5 by datiswous Quote Link to comment Share on other sites More sharing options...
joebarnin Posted July 7 Report Share Posted July 7 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". 3 Quote Link to comment Share on other sites More sharing options...
datiswous Posted July 8 Report Share Posted July 8 Could you share the code? Quote Link to comment Share on other sites More sharing options...
joebarnin Posted July 8 Report Share Posted July 8 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. Quote Link to comment Share on other sites More sharing options...
northern_pilgrim Posted July 10 Report Share Posted July 10 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 Quote Link to comment Share on other sites More sharing options...
nbohr1more Posted July 10 Report Share Posted July 10 You need to use $player1.getWorldOrigin(); Quote 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 More sharing options...
northern_pilgrim Posted July 10 Report Share Posted July 10 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. Quote Link to comment Share on other sites More sharing options...
Geep Posted July 10 Report Share Posted July 10 I think this might be what you want in your .gui: rect "gui::dispx", "gui::dispy", "gui::dispx"+1, "gui::dispy"+40 Quote Link to comment Share on other sites More sharing options...
northern_pilgrim Posted July 10 Report Share Posted July 10 @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. Quote Link to comment Share on other sites More sharing options...
grodenglaive Posted July 11 Report Share Posted July 11 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). Quote Link to comment Share on other sites More sharing options...
northern_pilgrim Posted July 11 Report Share Posted July 11 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. Quote Link to comment Share on other sites More sharing options...
nbohr1more Posted July 11 Report Share Posted July 11 Did you look at the auto-map in "The Painter"s Wife" ? I think that's the closest example to what you are aiming for? Quote 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 More sharing options...
northern_pilgrim Posted July 11 Report Share Posted July 11 Hi @nbohr1more please excuse my ignorance but how would I do that? Quote Link to comment Share on other sites More sharing options...
northern_pilgrim Posted July 11 Report Share Posted July 11 Nix that I figured it out. I'll look at that and see if I find this simple little issue. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.