Icewind Dale: ToEE - Total Conversion

Discussion in 'Icewind Dale Total Conversion' started by Allyx, May 7, 2016.

Remove all ads!
  1. ineth

    ineth Member

    Joined:
    May 15, 2016
    Messages:
    52
    Likes Received:
    4
    Character scripts

    To get an idea what kinds of things the six script slots per character are used for, this is a list of all script behaviors associated with Boy 1 (Jeffy) in Easthaven:
    • default script: EHBOY1.BCS (used only by this character)
      • randomly walk around a bit near the spawning point
      • randomly display one of three floating lines in between walks (limited by timer):
        • #2964 = ~Let's poke him with a stick.~
        • #2955 = ~I'm gonna ask if we can keep him.~
        • #2956 = ~Can he do any tricks?~
      • run away when an enemy is in sight
    • general script: EHGOBRUN.BCS (used by all townspersons standing outdoors in Easthaven)
      • run away when a goblin is in sight
    • race script:
    • class script: EFPIKHST.BCS (used by several townspersons)
      • turn hostile when the player failed a pickpocket attempt
    • specifics script: EFTWNCHK.BCS (used by all townspersons)
      • whole town goes hostile when player attacks any townsperson
    • override script:
    As you can see, different script slots are used to let multiple characters re-use the same script for a behavior that they share.

    For characters who can actually fight (rather than just run away from enemies), the race/class scripts tend to contain their combat AI.
     
    Last edited: Jul 14, 2016
  2. Allyx

    Allyx Master Crafter Global Moderator Supporter

    Joined:
    Dec 2, 2004
    Messages:
    5,009
    Likes Received:
    254
    Thanks @ineth that's very informative, I'll be sure to use the pick pocket/attacked responses to the scripts files in due course.

    There seems to be a somewhat random distribution of loot in IWD, EG I found a spear in one house next to some fishing poles on one run through that wasn't there on the next, likewise a chest in the caves has yielded either magical boots, a magical dagger, or a magical amulet among the loot in different games. How is this determined by the game engine?
     
  3. ineth

    ineth Member

    Joined:
    May 15, 2016
    Messages:
    52
    Likes Received:
    4
    @Allyx

    Random loot

    In BG and BG2, all loot is fixed (I think).
    In IWD, most loot is fixed, but some (and in particular the most valuable) loot is randomized.
    In IWD2, even more (most?) loot is randomized.

    For IWD, refer to this player guide which lists all random loot items and their locations, with screenshots.

    How it works

    How it works in IWD:EE, is that a container (or NPC inventory) can contain a "fake item", which represents multiple real items and which the engine automatically replaces with one of those real items when the player first enters the map that the container is in. (The choice is stored in the savegame, so to get a different item you'd have to load a savegame from before entering the map).

    For example, open the Orc Cave map (AR1201) in the NearInfinity area viewer, make sure the "Containers" checkbox is checked in the sidebar, and click the treasure chest in the top-left corner. It'll show you that three items are in the container, but the third one is a random-loot "fake item" called RNDTRE16:

    [​IMG]

    Near Infinity doesn't show any information about it here (a limitation that I hope will be fixed in a future NearInfinity version), but you can look up the information yourself:

    The real items associated with each random-loot fake item are defined in the RNDTREAS.2DA file.

    Like all 2DA files, this is a text-based associative table where the first three lines define the table header, and the remaining lines define the table entries. In each entry, fields are separated by spaces, and the first field is the key.

    The fake item RNDTRE16 corresponds to the table entry with key "EC3Tres", which happens to be the 16th entry.
    (To be honest, I have no idea how the engine gets from the name RNDTRE16 to the key EC3Tres, but at least for the few that I've checked, the number in the fake item name happens to map to the numerical position of the table entry.)

    This is the full table entry in question:
    Code:
    EC3Tres ring06 uRing1b uDagg1a BeltBea BootQui ring06 uRing1b uDagg1a BeltBea BootQui ring06 uRing1b uDagg1a BeltBea BootQui ring06 uRing1b uDagg1a BeltBea
    After the key, it has 19 more fields which are all real item names (without the .itm suffix).
    These are the items which the engine chooses from.

    Note that while each entry contains 19 item names, the same name can appear multiple times.
    For example, the entry shown above only has five different items, but each item appears 3 or 4 times. This can be used to calculate the percentage chance of each item appearing:
    Code:
    Item    | Name                      | Count | Percentage
    --------+---------------------------+-------+-----------
    ring06  | Ring of Protection +1     |     4 |    21.05 %
    uRing1b | Ring of Lesser Resistance |     4 |    21.05 %
    uDagg1a | Fire Dagger +1            |     4 |    21.05 %
    BeltBea | Girdle of Beatification   |     4 |    21.05 %
    BootQui | Quiet Boots               |     3 |    15.79 %
    
     
    Last edited: Jul 16, 2016
  4. Allyx

    Allyx Master Crafter Global Moderator Supporter

    Joined:
    Dec 2, 2004
    Messages:
    5,009
    Likes Received:
    254
    This does bring up an interesting point, something that is a personal bugbear of mine - being a bit of a rules lawyer myself: Non-RAW magic items.

    Personally I don't like them. Their inclusion in the Neverwinter Nights games (coupled with the combat system) provided significant discomfort to me which resulted in me not playing the games to their completion.

    In this instance I believe the problem as (I see it) is even more pronounced as we are also limited by ToEE's engine itself.

    A "Good Quality Dagger" is easily substituted for a Masterwork Dagger, but "Quiet Boots" with +17% to Move Silently checks aren't quite as powerful as Elven Boots. It's possible to add a watered down Elven Boots variant that adds 15% or 20% to Move Silently checks, but not 17%.

    Similarly, a "Fire Dagger +1" isn't as powerful as a Flaming Dagger +1 which would constitute a massive loot haul for low level characters were they to sell it.
     
  5. Shiningted

    Shiningted I changed this damn title, finally! Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,740
    Likes Received:
    374
    Did you do any modding with all this knowledge, Ineth? Forgive me if Ineth is the most famous name among IE modders, I'm a n00b at such games ;)
     
  6. ineth

    ineth Member

    Joined:
    May 15, 2016
    Messages:
    52
    Likes Received:
    4
    @Shiningted
    It only seems as if I know a lot because I look up all the gaps in my knowledge using NearInfinity/IESDP while doing these write-ups... :p

    I'm not much of a modder, really. I did release a portrait mod, but that only involved 40 or so lines of WeiDU code. (By comparison, some popular mods have thousands of lines of WeiDU code.)
    Besides that, I have ported some other people's mods to the Enhanced Edition engine, and stuff like that.
    The reason I started learning about the Infinity Engine behind-the-scenes stuff in the first place, was to help me work around bugs/glitches I experienced in those games, not because I had a vision to become a modder... :)


    Still, the thought of creating a small quest mod for IWD:EE has crossed my mind, but I'm really not great at writing (story, names, dialog, item descriptions, that kind of stuff).
     
  7. Allyx

    Allyx Master Crafter Global Moderator Supporter

    Joined:
    Dec 2, 2004
    Messages:
    5,009
    Likes Received:
    254
    I'm trying to figure out how ToEE's ambient music ia called, I found the 2 .mes files that seem lost the file names for the music, and ambient sounds, but not how the map itself links to those files... Is it in the map.php file as hex code?
     
  8. Gaear

    Gaear Bastard Maestro Administrator

    Joined:
    Apr 27, 2004
    Messages:
    11,038
    Likes Received:
    42
    schemeindex.mes contains a list of all the schemes (combinations of audio - background music, battle music, sound effects) by number. (1, 2, 3, etc.) schemelist.mes enumerates the elements of each scheme and is referenced by number from schemeindex, including sub-references, so

    Code:
    {20}{Hommlet Exterior #2000}
    in schemeindex.mes refers to

    Code:
    {2000}{music\Hommlet_Level_loop.mp3 /VOL:50 /loop}
    {2001}{ambient\dog_bark.wav /scatter /freq:5 /vol:50 /time:6-17}
    {2002}{ambient\sheep_baaing.wav /scatter /freq:5 /vol:50 /time:6-17}
    {2003}{ambient\rooster_crow.wav /scatter /freq:1 /time:6-7}
    {2004}{ambient\crickets.wav /VOL:25 /loop /time:18-23}
    {2005}{ambient\crickets.wav /VOL:25 /loop /time:0-5}
    {2006}{music\hommlet_combat_Rev1_loop.mp3 /VOL:60 /combatmusic}
    
    in schemelist.mes. The 20 in schemeindex.mes refers to 2000 and 2001 et al in schemelist.mes.

    Each map's folder in modules/maps contains a file called mapinfo.mes. That file almost always only contains a reference to play up to two specific soundschemes on that map, like so:

    Code:
    SoundScheme: 20,28
    So the map folder that contains the file that contains that code is instructing the game to play soundschemes 20 and 28 from schemeindex.mes on that map, which are {20}{Hommlet Exterior #2000} and {28}{Pleasant Nature Sounds #2800} as pointed to in schemelist.mes.

    schemelist.mes and schemeindex.mes live in data/sound, as well as all the audio itself, music and sound effects alike. Valid audio formats are .wav and .mp3. For a web distro, you should use .mp3 since it's compressed and much smaller than .wav. Don't use less than 256 kbps/44100 Hz/stereo for the .mp3 specs.
     
    anatoliy likes this.
  9. Allyx

    Allyx Master Crafter Global Moderator Supporter

    Joined:
    Dec 2, 2004
    Messages:
    5,009
    Likes Received:
    254
    I have been converting .wav files to .mp3, unsure how to verify the specs of the .mp3 files I created, but thanks @Gaear, never would have thought to look in mapinfo.mes for sound file references... Bye bye Moathouse Frogs and crickets, no place for you guys in Easthaven.

    By the way is there a way to key a sound to a specific area on a map in ToEE? In IWD ambient sounds can be set a certain area in which it can be heard.
     
    Last edited: Aug 3, 2017
  10. Gaear

    Gaear Bastard Maestro Administrator

    Joined:
    Apr 27, 2004
    Messages:
    11,038
    Likes Received:
    42
    You can attach the game.sound command to a script, like an object's heartbeat, and set it to fire only when the party's within a certain distance of the object. That's problematic though in that the sound has to play out no matter what, so if you wanted to assign crickets to a hole in the ground or something and you made a minute long cricket loop that you called, if the party walked away they'd still hear the crickets for one minute. So it's best for brief duration one-off sounds.

    Also you have to create imposter mobs to be scenery objects because scenery has no heartbeat et al. (Lots can go wrong with that.)

    AFAIK there's no way to assign an ambient background to map coordinates that fades in and out appropriately relative to how near you are to the coordinates
     
    anatoliy likes this.
  11. marc1967

    marc1967 Established Member

    Joined:
    Jan 19, 2014
    Messages:
    672
    Likes Received:
    110
    You can do what is done with the water wheel at the miller's house in hommlet.

    In the World Builder, set the 'Sound Effect' field of any scenery object to a sound number from one of the sound files like snd_misc.mes, or snd_critter.mes, and that sound will be looped.

    As you get near that scenery object, the sound will get louder, and then it slowly fades away as you walk to about 100 feet.

    If you don't want the object to be seen, set all those flags that make it non-interactive like OF_SEE_THROUGH, OF_SHOOT_THROUGH, OF_DONTDRAW, OF_NO_BLOCK, OF_CLICK_THROUGH, and OF_INVULNERABLE.
     
    anatoliy, Allyx and Gaear like this.
  12. Gaear

    Gaear Bastard Maestro Administrator

    Joined:
    Apr 27, 2004
    Messages:
    11,038
    Likes Received:
    42
    Yeah, I remember I used to make 'sound cabbages' and stuff like that. ;) I seem to recall the results were generally lackluster though - wouldn't fire reliably, etc.
     
  13. gabriel

    gabriel Member

    Joined:
    Nov 16, 2013
    Messages:
    11
    Likes Received:
    0
    Hello, I'm not a modder, nerver done it. But if there is any work that is repetitive and don't involve a lot of know how, I'm willing to help. This mod is like a dream coming to life, best of luck to you guys! :D
     
  14. Shiningted

    Shiningted I changed this damn title, finally! Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,740
    Likes Received:
    374
    Thanks Gabriel, we'll definitely be in touch. There's a lot of simple tasks that would take a lot of weight off Al's shoulders, and plenty of glory to go round ;)
     
  15. Allyx

    Allyx Master Crafter Global Moderator Supporter

    Joined:
    Dec 2, 2004
    Messages:
    5,009
    Likes Received:
    254
    @gabriel If you own a copy of Icewind Dale EE and are able to copy and paste in MS Paint, Photoshop or Gimp there are plenty of maps that need doors removed.

    I'm currently struggling with scripts, I keep messing up bits that work while trying to add bits...I'll get the hang of it one day.
     
Our Host!