My Unanswered Questions

Discussion in 'ToEE Engine Recreation Project' started by DarkStorm, Jul 15, 2010.

Remove all ads!
  1. DarkStorm

    DarkStorm Established Member

    Joined:
    Oct 2, 2003
    Messages:
    514
    Likes Received:
    3
    Hello everyone,

    this thread'll serve to collect my open questions regarding the original Temple of Elemental Evil engine. If some modder knows an answer to one of my questions, please feel free to reply here.

    Open Questions:

    How's the icon on top of the loot window determined?
    There are several TGAs in art\interface\CHAR_UI\CHAR_LOOTING_UI (Lareth's locker, hommlet well, etc.) that seem to serve as an icon for the container, but only the Hommlett Well, Anvil and Rainbow Rock are actually referenced in the toee.dll. How exactly does the game determine which icon to use? (We should use a different system and convert the original mapping to the new mapping using the converter).
    Current Guess: It maps the mesh id from meshes.mes to an icon.

    How are map-ids mapped to area-ids?
    There are map-ids (e.g. 5001 for Hommlet) and area-ids (I don't know them yet). The scripts seem to access the former using pc.map and the latter using pc.area. Elmo's dialog for instance will give directions to the welcome wench for area = 1 (Hommlet) and directions to the waterside hostel for area = 3 (Nulb). These areas seem to be worldmap related. But how does the game know, which map-id relates to an area-id? Oh there seems to be a list of all areas in mes/gamearea.mes, but no information on mapid->area mapping.

    Answer: There's a huge lookup table in temple.dll mapping each map id to an area.

    How does the game know, which lines in a DLG file are for NPCs and which ones are for PCs?
    Initially I assumed that all NPC lines are multiple of 10s, and the PC lines are inbetween, but that is incorrect for some DLGs (Terjon). Then i thought, that after a NPC line, the next 5 lines are the PCs answers (since there can only be five answers). But in some dialogs, that'd also include a NPC line as an answer. I am really at a loss for this one.

    NPC lines have an empty intelligence check, while PC lines always have a number there. The answers to a NPC line are all the PC lines directly below (consecutive, 10 entries at most)

    What does find_npc_near(critter, internalId) consider as "near"?
    Good question, isn't it? ;-)

    What does game.map_flags(some-map-id, 0, 1) do?
    I've seen this in some dialog, i.E. calmert sets this when you donate the money to see terjon, but terjon only checks for global flag 21 in his initial heartbeat. So what do these flags do?

    Answer: Places flags on the townmap. First argument is the legacy map id, second argument is the flag id (starting with 1), third argument is flag on (1) or off (0). See rules\townmap_ui_placed_flag_locations.mes for locations and corresponding file in mes\ for text.

    What exactly does NPC reaction do ingame?
    Well I found out it starts at 50 (neutral), bad is 40 and below, good is 60 and above, and there seem to be no other reaction types, other than 0, at which the NPC attacks. Question in point: Do KOS creatures automatically have a reaction of 0? Do factions play into it somehow? And is the selection circle somehow affected by this?

    How's are the water pools handled?
    I found out that in Imeryds run, there are trees that are supposed to be partially underwater, but they are positioned at Z=0 and the model doesn't extend below the ground level. This does to some extent seem to imply that there is special handling for water.
    Current Guess: Every object whose position is within a tile marked as water, get's rendered "lower" automatically, and it also automatically adds the splashes when you move along.

    I'll update this list as I go along.
     
    Last edited: Jul 22, 2010
  2. DarkStorm

    DarkStorm Established Member

    Joined:
    Oct 2, 2003
    Messages:
    514
    Likes Received:
    3
    Answered my own question #2. (area-ids)
     
  3. Gaear

    Gaear Bastard Maestro Administrator

    Joined:
    Apr 27, 2004
    Messages:
    11,038
    Likes Received:
    42
    It doesn't. It only knows to go to which lines it's told to go to. A 'go-to' line is always an NPC line, and all following consecutive lines (eg 2, 3, and 4 if there are 3 responses to PC line number 1 - but not line 10 if that's the next line) are PC lines. Then, the 'go-to' lines in each PC response are considered NPC lines, and so on.

    This is initially achieved through an NPC's san_dialog script entry, which points to which line you're supposed to start at when you click on an NPC, and often has other conditions on where to go depending on things like whether you've met them already or not or whether certain flags have been set, quest conditions, etc.

    Thus, both NPC and PC lines can be any number in a dialog file. I think the groups of 10 method is just used for the sake of convenience, as it does help to easily read and understand a dialog file.

    There's also an .mes file that lists them in, I think, modules/ToEE/mes.

    That may be defined in one of the basic scripts somehwere - ToEE.py, scripts.py, utilities.py, etc. All found in data/scr.

    Yes. If it's a 'for everybody' conditional, it is still 1 (as in intelligence of 1 or above).
     
    Last edited: Jul 15, 2010
  4. Ranth

    Ranth Established Member

    Joined:
    Jan 26, 2008
    Messages:
    829
    Likes Received:
    1
    How does the game know, which lines in a DLG file are for NPCs and which ones are for PCs?

    I could have swore it was a multiple of 10 thing. Also, I now for sure that the syntax for NPC and PC dialogue is different. Due to my reformat I do not currently have the game installed, but I know that the NPC's have less {} of information than PC's generally. More info here:
    http://www.co8.org/forum/showthread.php?t=372
     
  5. Gaear

    Gaear Bastard Maestro Administrator

    Joined:
    Apr 27, 2004
    Messages:
    11,038
    Likes Received:
    42
    Actually they both have 7, but it just looks like one less for NPCs since there are two dialog lines (male and female) and only one for PCs. :)
     
  6. DarkStorm

    DarkStorm Established Member

    Joined:
    Oct 2, 2003
    Messages:
    514
    Likes Received:
    3
    I thought that at first, but it's not true for every dialog.

    Example for Terjon:
    {260}{I lost an artifact of St. Cuthbertp. }
    {261}{Do you have any idea .... } (goes to 265)
    {262}{You know where ... }
    {263}{I found something ... \
    {264}{Me have one ... }
    {265}{Most likely in the Battle of ..... }
    I marked the lines that belong to the NPC in bold. They are all consecutive, and there are only four lines between the two NPC lines.

    Yes, I already implemented that in my engine, and dialog works so far. I just noticed that sometimes I show NPC lines as answers, which isn't correct. I also noticed that the original scripts have some "odd" quirks.

    Yes I think so too. (See above). But I do need some foolproof way to detect which lines are answers to display them correctly.

    Yes, there is one file that lists the names for all areas, but not the corresponding maps. I figured that one out though. It's a hardcoded list in temple.dll, which I just had to reconstruct for my converter.

    Sadly I don't think so since the function calls back into temple.dll :-/

    Wouldn't that be a perfect way to distinguish NPC text lines from PC answer lines? The field is always empty for NPC lines i think. I'll have to try that.
     
  7. Gaear

    Gaear Bastard Maestro Administrator

    Joined:
    Apr 27, 2004
    Messages:
    11,038
    Likes Received:
    42
    Huh, I guess I don't know how it distinguishes them, then. I know that some dialogs don't abide by the 10 rule of thumb, but I think that's probably just because some dialog or options got added after the fact and they didn't want to put it at the end. I can say for certain that with Troika's ToEE, NPC and PC dialogs are never confused as long as you observe the 7 brackets thing, so there must indeed be something in the NPC line that says "this is an NPC line."

    (Thinking out loud: maybe it's the lack of an entry for a PC's third set of brackets - what would normally be the female line for an NPC. That set of brackets is always empty for PCs.)

    You could have a look at Shiningted's dialog tutorials to see if he has any clues.
     
  8. DarkStorm

    DarkStorm Established Member

    Joined:
    Oct 2, 2003
    Messages:
    514
    Likes Received:
    3
    Hi Gaear,

    i tried it out and so far it works like a charm: The fourth entry is the intelligence check. For NPC lines, that entry is always empty, for PC lines there's always a number (1 if there's no actual intelligence check). That's how the game distinguishes between NPC and PC lines.
    To get all answers for an NPC lines, just take all consecutive PC lines directly following the NPC line.

    That is how it seems to work.
     
  9. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,622
    Likes Received:
    538
    Looks like you got the answer for the dialogue.

    There are a few more esoteric rules in ToEE's dialogue system:

    1. A Reply Node can be used as an NPC's dialogue node too. (i.e. you can point to a reply node from a reply node, and the NPC will display it as usual, and list all the reply nodes that follow)
    2. The engine keeps reading and adding reply nodes to the available response list until it runs into a non-reply node.
    3. For the above rule, the number in the 1st curly bracket is what matters, not how the nodes are ordered in the file. Yes, that means the nodes can be all over the place (but that would be bad practice of course).

    But they are ultimately irrelevant since you're converting to a new system anyway, and are de facto unused in ToEE anyway.

    As for the "npc near" thing -
    it's a script from the utilities.py file.
    The core of it is the command:
    Code:
    game.obj_list_vicinity( obj.location, OLC_[TYPE] )
    IIRC it returns a list of all objects of [type] (e.g. OLC_NPC) in a large radius around obj.location. In terms of pc.distance_to() function, around R=64.
     
    Last edited: Jul 16, 2010
  10. DarkStorm

    DarkStorm Established Member

    Joined:
    Oct 2, 2003
    Messages:
    514
    Likes Received:
    3
    Thanks Sitra,

    is #1 used anywhere? I have to check that. My plans were to convert the dialog files to a structured format, where this would be a real problem.

    Oh by the way... You're right that it's not only the next *10* lines after the NPC lines. Jaroo has a lot more possible answers for one of his lines. Probably around 20 or so.

    Regards,
    Storm
     
  11. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,622
    Likes Received:
    538
    As far as I know, rule #1 isn't actually used anywhere in ToEE.
    If it is, it's very likely by accident, and I expect it will be easily spotted and fixed.

    Re the number of replies - some nodes can have many possible reply lines, since often there are mutually exlusive conditions and such. The low int/ normal int branching alone almost guarantees it for major NPCs.

    Also, please allow for more than 5 PC replies to be displayed :)
     
  12. DarkStorm

    DarkStorm Established Member

    Joined:
    Oct 2, 2003
    Messages:
    514
    Likes Received:
    3
    Currently the number is not limited in any arbitrary way (besides screen-space, scrolling for answers isn't implemented right now, although it could be. yet i think if you have to scroll to see all the answers, that's a dialog design issue ;-).

    Limiting to 9 or 10 would be preferred though, so you can map shortcuts 1-10 to the dialog options for quick access.

    Regards,
    Storm
     
  13. Gaear

    Gaear Bastard Maestro Administrator

    Joined:
    Apr 27, 2004
    Messages:
    11,038
    Likes Received:
    42
    That actually could be, since the mesh also controls things like critter sounds, of all things.

    I think there are only a handful of containers unattached to NPCs though, right? NPC looting shows the NPC up there.
     
  14. DarkStorm

    DarkStorm Established Member

    Joined:
    Oct 2, 2003
    Messages:
    514
    Likes Received:
    3
    Critter sounds are controlled by mesh? Hmm, well makes sense. A polymorphed player should sound like the critter after all.

    Yeah, there's the rainbow rock, the well in hommlet, all the chests, lareth's dresser, otis's anvil
    that should be about it.

    Should be possible to just convert that by hand.
     
  15. DarkStorm

    DarkStorm Established Member

    Joined:
    Oct 2, 2003
    Messages:
    514
    Likes Received:
    3
    Added a question about map_flags.
     
Our Host!