Author Topic: Adding creatures to areas  (Read 19261 times)

Offline temujin

  • Planewalker
  • *****
  • Posts: 78
Re: Adding creatures to areas
« Reply #25 on: July 26, 2010, 06:45:02 PM »
I'm way out of my league here (deciding if something's a word or dword etc) but according to the IESDP Nythrun's values are correct except the travel trigger is, according to the IESDP, 32 bytes.

maybe I'm the one overlooking something here... but let me show you what I mean.

let's take AR0300.ARE for example, look at the first actor Rylock.


Here is a screenshot based on the recent version of NearInfity:


Notice the "Is Spawned?" field starts at 0x148.  The next field 'Unknown' starts at 0x14A.

0x14A - 0x148 = 0x02 = WORD


Why would this be considered a DWORD?



EDIT:  I should mention the relevant code I'm talking about from the macro is the line in bold

Quote
        PATCH_IF fj_structure_type = 0x54 BEGIN
          WRITE_ASCIIE fj_position + 0x00 ~%fj_name%~
          WRITE_SHORT  fj_position + 0x20 fj_loc_x
          WRITE_SHORT  fj_position + 0x22 fj_loc_y
          WRITE_SHORT  fj_position + 0x24 fj_dest_loc_x
          WRITE_SHORT  fj_position + 0x26 fj_dest_loc_y
          WRITE_LONG   fj_position + 0x28 fj_flags
          WRITE_LONG   fj_position + 0x2c fj_spawned
          WRITE_LONG   fj_position + 0x30 fj_animation
          WRITE_LONG   fj_position + 0x34 fj_orientation
          WRITE_LONG   fj_position + 0x38 fj_expiry
          WRITE_SHORT  fj_position + 0x3c fj_limit_rndwlk
          WRITE_LONG   fj_position + 0x40 fj_schedule
          WRITE_LONG   fj_position + 0x44 fj_num_talked
          WRITE_ASCIIE fj_position + 0x48 ~%fj_dlg_resref%~
          WRITE_ASCIIE fj_position + 0x50 ~%fj_bcs_override%~
          WRITE_ASCIIE fj_position + 0x58 ~%fj_bcs_general%~
          WRITE_ASCIIE fj_position + 0x60 ~%fj_bcs_class%~
          WRITE_ASCIIE fj_position + 0x68 ~%fj_bcs_race%~
          WRITE_ASCIIE fj_position + 0x70 ~%fj_bcs_default%~
          WRITE_ASCIIE fj_position + 0x78 ~%fj_bcs_specific%~
          WRITE_ASCIIE fj_position + 0x80 ~%fj_cre_resref%~
        END ELSE PATCH_IF fj_structure_type = 0x5c BEGIN
« Last Edit: July 26, 2010, 06:50:28 PM by temujin »

Offline Wisp

  • Moderator
  • Planewalker
  • *****
  • Posts: 1176
Re: Adding creatures to areas
« Reply #26 on: July 26, 2010, 07:48:14 PM »
Notice the "Is Spawned?" field starts at 0x148.  The next field 'Unknown' starts at 0x14A.

0x14A - 0x148 = 0x02 = WORD


Why would this be considered a DWORD?
The two "unknown" bytes could be part of the "Is spawned?" field.
But the "orientation" field plus the two following "unknown" bytes says 0e 00 23 01 h for that same actor. Considering 0xe is apparently a valid orientation, maybe the IESDP is wrong.

Offline Echon

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 1944
  • Gender: Male
    • The Fields of the Dead
Re: Adding creatures to areas
« Reply #27 on: August 10, 2010, 12:03:36 PM »
I need a description of the parameters for the docs, though.
Ok, I'll see if I can come up with a sample for each use. I can mine Aurora and a couple other mods for most of them.

So, how is this coming along? :)

Offline Miloch

  • Barbarian
  • Planewalker
  • *****
  • Posts: 1032
  • Gender: Male
Re: Adding creatures to areas
« Reply #28 on: August 22, 2010, 10:03:28 PM »
So, how is this coming along? :)
Well, it'll be easy enough to mine the code samples once I get a chance to sit down and do it (have been busy moving for the past few weeks) but I was kinda hoping temujin, Wisp, etc. could come to some decision on what needs to be changed in the function. Or better yet, just change it for us :) (it's not like it's my code or anything).

Offline temujin

  • Planewalker
  • *****
  • Posts: 78
Re: Adding creatures to areas
« Reply #29 on: August 23, 2010, 08:47:15 AM »
but I was kinda hoping temujin, Wisp, etc. could come to some decision on what needs to be changed in the function. Or better yet, just change it for us :)

I'm not really sure myself if what I said was accurate TBH, lol. I was only reporting the length of those fields as shown in NI. Wisp is more experienced at this, so you should probably take his word.

Still, something's not right here. Another example:  the length of the travel trigger used in the function is 16.  Wisp says it should be 32 according to IESDP.  But the length I'm seeing in NI is 24 bytes (from the screenshot, 0xB7F0 - 0xB7D8 = 0x18 = 24).

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: Adding creatures to areas
« Reply #30 on: August 23, 2010, 02:24:53 PM »
That's because I hate conditionalizing all the code. If I made it 32 bytes (which it is), then I'd have to have the code for the Baldur's Gates (and maybe the Icewind Dales) and separate code for PST so that those dialogue fields were correct (and where the trigger link is just 24 bytes of reserved/unused space). Older versions of NI always got the size wrong, and all the vanilla uses fit into 24 bytes, so I just decided to have the PST fields always be there.

Offline temujin

  • Planewalker
  • *****
  • Posts: 78
Re: Adding creatures to areas
« Reply #31 on: August 23, 2010, 04:35:05 PM »
Because you hate conditionalizing, you simply decided to lump all fields together?  :o  come on, dev, with all due respect, this is very unprofessional, especially coming from someone like you.

so it's treated as 32 bytes for BG1 & BG2 (and maybe IWD1 & IWD2?), and {24, 4, 4} for PST?  And how do you expect the user to know this?  Does one have to guess which of the five games those additional fields belong to?  ::)


something else needs clarifying:

"dailog name/strref" and "dialog resref" (Doors) are stored at 0xBC and 0xC0 according to IESDP.  However, in NI, they (i.e. "speaker name" and "dialogue") are located at 0xB4 and 0xB8 respectively (for BG2, that is).  Since the offsets don't match, I take it this applies to some other game?  ???

Offline Miloch

  • Barbarian
  • Planewalker
  • *****
  • Posts: 1032
  • Gender: Male
Re: Adding creatures to areas
« Reply #32 on: August 23, 2010, 04:38:20 PM »
Well the function accounts for different game datatypes already, but I don't know if it's worth it for this field if 24 bytes (or maybe even 16) accounts for everything currently. Not really tough though either way. Seems to me it should be more of a concern for an actual editor like NI.

As to whether "is spawned" is a 2 or 4 byte field, I dunno - maybe half of it is "unknown"? There are some other discrepancies between the IESDP, NI and whatever the real actual game values are, for example (from Nythrun):
Quote
The "new" fields in item abilities are:
 
BYTE_AT abl + 0x03 alternate dice sides
BYTE_AT abl + 0x11 alternate dice thrown
BYTE_AT abl + 0x13 alternate damage bonus

used when attacking .cres with the plot critical flag set. These are only ever used by mistake in Bioware items and aren't really good for anything. Also:

BYTE_AT abl + 0x17 primary type
BYTE_AT abl + 0x19 secondary type
Didn't check recently if these are accounted for in NI or the IESDP, but I think they are in the function, for what that's worth.

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: Adding creatures to areas
« Reply #33 on: August 23, 2010, 11:31:05 PM »
Because you hate conditionalizing, you simply decided to lump all fields together?
Yes. I made the field larger than it originally was, bringing it closer to its actual size and leaving more than enough space for any real-world use, and I was able to also support PST funk without having a bunch of duplicate code. And if you look to see all the places where the different variants have to be accommodated, I think you could grant me this one structure to have a condensed-if-not-wholly-accurate list of stuff that nobody in the history of IE has ever cared about.

so it's treated as 32 bytes for BG1 & BG2 (and maybe IWD1 & IWD2?), and {24, 4, 4} for PST?  And how do you expect the user to know this?  Does one have to guess which of the five games those additional fields belong to?  ::)
It doesn't matter what the user knows or doesn't. Nobody actually uses this stuff, and if they had a question about it, they would ask and I or more likely one of the other format buffs around here would answer.

"dailog name/strref" and "dialog resref" (Doors) are stored at 0xBC and 0xC0 according to IESDP.
IESDP is wrong. Trigger and door dialogue hack is ONLY for PST (not a single other engine supports it), and the offset in the door structure is +180 (speaker name resref) and +184 (speaker dialogue resref). ("Speaker," in NI parlance, is the phantom dialogue object that is the target of the conversation initiated with the clicked door or activated trigger.) In Baldur's Gate, the IE string (32 bytes) at +156 is the last used field in the structure, and in Icewind (some or both), I think the trigger link may not even exist. In various other structures, pieces or parts may not be relevant in all engines (like the lockpick string in container structures, I don't think is used for most IE).

Is spawned doesn't matter; we know of only the first bit in the first word, so with only the two possible values of 0 or 1, writing as _LONG or _SHORT is inconsequential. (We read it as a WORD in NI because we present you the 0-or-1 list and there's usually worthless junk in the subsequent WORD that would break our map.) Orientation is in the same situation (and nothing will change whether you write 0-15 as _LONG or _SHORT). Movement distance could be added but is disregarded in all the engines.

Offline Miloch

  • Barbarian
  • Planewalker
  • *****
  • Posts: 1032
  • Gender: Male
Re: Adding creatures to areas
« Reply #34 on: September 12, 2010, 09:51:10 PM »
On a un-related note, there's a typo in Nythrun's macro - number of projectile's missiles is stored at 0x12, not 0xe, although for reasons abovementioned, it shouldn't cause problems.
Are you saying the IESDP is wrong here too? It has missile reference (projectl #) at a SHORT at 0xe and an "unknown" LONG at 0x10, which Nythrun has down as "level_base". If that's actually a SHORT and the missile # is 0x12, then what's at 0xe?

Unless someone can make a fairly certain case for changing any of the existing macro values, I'm going to leave them. Don't want to break something that otherwise works. The only possible one to change so far here I've seen is travel_trigger, where increasing the WRITE_ASCIIE from #16 to #24 should suffice, no?

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: Adding creatures to areas
« Reply #35 on: September 12, 2010, 10:26:11 PM »
The structure should be
Code: [Select]
    list.add(new ResourceRef(buffer, offset, "Trap", "PRO"));
    list.add(new SectionOffset(buffer, offset + 8, "Effects list offset", null));
    list.add(new DecNumber(buffer, offset + 12, 2, "Effects list size"));
    list.add(new Unknown(buffer, offset + 14, 2, "Projectile"));
    list.add(new DecNumber(buffer, offset + 16, 2, "Explosion frequency (frames)"));
    list.add(new DecNumber(buffer, offset + 18, 2, "Duration"));
    list.add(new DecNumber(buffer, offset + 20, 2, "Location: X"));
    list.add(new DecNumber(buffer, offset + 22, 2, "Location: Y"));
    list.add(new DecNumber(buffer, offset + 24, 2, "Location: Z"));
    list.add(new DecNumber(buffer, offset + 26, 2, "Target"));
Target is so the projectile works with targeting friends/enemies (since it operates relative to the source). Z is height, frequency should be explosion length (in frames), and duration is number of explosions (these labels are set up to match NI's PRO handler).

#24 should be fine for travel_trigger. It won't break any existing use.
« Last Edit: September 12, 2010, 10:30:33 PM by devSin »

Offline Miloch

  • Barbarian
  • Planewalker
  • *****
  • Posts: 1032
  • Gender: Male
Re: Adding creatures to areas
« Reply #36 on: September 12, 2010, 11:11:09 PM »
The structure should be
Code: [Select]
    list.add(new ResourceRef(buffer, offset, "Trap", "PRO"));
    list.add(new SectionOffset(buffer, offset + 8, "Effects list offset", null));
    list.add(new DecNumber(buffer, offset + 12, 2, "Effects list size"));
    list.add(new Unknown(buffer, offset + 14, 2, "Projectile"));
    list.add(new DecNumber(buffer, offset + 16, 2, "Explosion frequency (frames)"));
    list.add(new DecNumber(buffer, offset + 18, 2, "Duration"));
    list.add(new DecNumber(buffer, offset + 20, 2, "Location: X"));
    list.add(new DecNumber(buffer, offset + 22, 2, "Location: Y"));
    list.add(new DecNumber(buffer, offset + 24, 2, "Location: Z"));
    list.add(new DecNumber(buffer, offset + 26, 2, "Target"));
Target is so the projectile works with targeting friends/enemies (since it operates relative to the source). Z is height, frequency should be explosion length (in frames), and duration is number of explosions (these labels are set up to match NI's PRO handler).
If all that's accurate, then the only change (for this structure anyway) is fj_level_base at 0x10 gets broken down to fj_frequency and fj_duration; fj_dunno = fj_loc_z; fj_dunno1 = fj_target.

Would be nice if someone was keeping the IESDP current, or if it was wiki-like so any authorised user could update it...

Edit: the WRITE_BYTE for fj_caster_id should be moved from 0x1b to 0x1c though, assuming that bit of the IESDP is accurate...
« Last Edit: September 12, 2010, 11:14:41 PM by Miloch »

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: Adding creatures to areas
« Reply #37 on: September 13, 2010, 05:51:38 PM »
Edit: the WRITE_BYTE for fj_caster_id should be moved from 0x1b to 0x1c though, assuming that bit of the IESDP is accurate...
I don't know what that's from.

You can always grab the NI source; the structure definitions are always up-to-date (with maybe a several month delay, depending on my schedule, and then a year or two delay to make it to git). (Make sure to note the license if you want to publish changes.)
« Last Edit: October 03, 2010, 03:07:40 PM by devSin »

Offline Miloch

  • Barbarian
  • Planewalker
  • *****
  • Posts: 1032
  • Gender: Male
Re: Adding creatures to areas
« Reply #38 on: September 13, 2010, 08:45:20 PM »
Edit: the WRITE_BYTE for fj_caster_id should be moved from 0x1b to 0x1c though, assuming that bit of the IESDP is accurate...
I don't know what that's from.
Well it's the last field listed for that structure in the IESDP (after the two not-so-unknowns):
Quote
0x001C   1 (byte)   Caster ID (reset on game-load)
Only difference is the function had it at 0x1b, which can't be true if the previous field is a SHORT.

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: Adding creatures to areas
« Reply #39 on: September 13, 2010, 10:44:16 PM »
Yeah, target's a word at +0x1A. The macro can use two bytes if it wants (nobody is ever going to set these, and I don't know the correct data to use in any case).

The structure is only 0x1C bytes in length. IESDP is just a typo (he meant 0x1B).

Offline temujin

  • Planewalker
  • *****
  • Posts: 78
Re: Adding creatures to areas
« Reply #40 on: September 14, 2010, 07:54:15 PM »
Unless someone can make a fairly certain case for changing any of the existing macro values, I'm going to leave them. Don't want to break something that otherwise works.
you're not going to change the offsets for dialog strref and dialog resref?  ???  devSin himself just said those values from IESDP (which are currenlty used by Nythrun) were wrong.


If all that's accurate, then the only change (for this structure anyway) is fj_level_base at 0x10 gets broken down to fj_frequency and fj_duration; fj_dunno = fj_loc_z; fj_dunno1 = fj_target.

LOL, so you finally arrived at this conclusion, huh? ;D I mentioned the exact same thing in my first post:  "WRITE_LONG   fj_position + 0x10 fj_level_base" should probably be split to two WRITE_SHORTs (explosion frequency & duration) for Projectiles


Since you say everything else works, Miloch, would you mind providing an example of adding a structure (for ex: an actor) to an area that contains embedded creatures? (without breaking or corrupting the area, that is)



btw, I just took another look at this function and can reproduce this bug:

but I did notice some discrepancies when trying to add a door. Namely, it added the door but didn't associate the new vertices correctly.

if you haven't already fixed this, I can look into it.
« Last Edit: September 14, 2010, 08:01:32 PM by temujin »

Offline temujin

  • Planewalker
  • *****
  • Posts: 78
Re: Adding creatures to areas
« Reply #41 on: September 14, 2010, 09:17:29 PM »
Quote
but I did notice some discrepancies when trying to add a door. Namely, it added the door but didn't associate the new vertices correctly.

OK, I think I see the problem. In fact, it looks like there are three issues that are responsible.

1. The vertex array names were defined/initialised as fj_door_open, fj_door_closed, fj_cell_closed, fj_cell_open, but, later on, they are being referenced as fj_door_open_vert, fj_door_closed_vert, fj_cell_closed_vert and fj_cell_open_vert.

2. Each fj_structure_type is being compared with the corresponing offset position for that structure. For example, "PATCH_IF fj_structure_type = 0x54" for actors, "PATCH_IF fj_structure_type = 0x5c" for regions, etc... However, in the case of Doors, it's being compared with the number of doors (line 450) instead of the Door offset itself. It should be "PATCH_IF fj_structure_type = 0xa8" (not 0xa4).

3. The vertex updating code adds the new vertices in this order: door_open, door_closed, cell_closed, cell_open. This is causing some vertex coordinates to screw up. The correct order (at least according to NI) should be: door_open, door_closed, cell_open, cell_closed.


Fixed version uploaded here. (doesn't include any of the changes mentioned in this thread, but make sure to diff so you can see what's changed and where)

Offline Miloch

  • Barbarian
  • Planewalker
  • *****
  • Posts: 1032
  • Gender: Male
Re: Adding creatures to areas
« Reply #42 on: September 15, 2010, 02:11:08 AM »
Unless someone can make a fairly certain case for changing any of the existing macro values, I'm going to leave them. Don't want to break something that otherwise works.
you're not going to change the offsets for dialog strref and dialog resref?  ???  devSin himself just said those values from IESDP (which are currenlty used by Nythrun) were wrong.
If all that's accurate, then the only change (for this structure anyway) is fj_level_base at 0x10 gets broken down to fj_frequency and fj_duration; fj_dunno = fj_loc_z; fj_dunno1 = fj_target.
LOL, so you finally arrived at this conclusion, huh? ;D I mentioned the exact same thing in my first post:  "WRITE_LONG   fj_position + 0x10 fj_level_base" should probably be split to two WRITE_SHORTs (explosion frequency & duration) for Projectiles
As I said when you posted that, I was going offline for a while (moving) so I was hoping you could just correct what needed to be corrected. Then when I came back and asked about it, you said:
Quote
I'm not really sure myself if what I said was accurate TBH, lol.
Maybe you just meant the latter of your posts, but I took it to mean all of it, so I didn't analyse it.
Quote
Since you say everything else works, Miloch, would you mind providing an example of adding a structure (for ex: an actor) to an area that contains embedded creatures? (without breaking or corrupting the area, that is)
It doesn't support that, as I thought I mentioned somewhere. Maybe not, but I did ask Nythrun if it could be supported back in March. Never heard back, so she's obviously MIA. If you could figure it out, that'd be great.
Quote
Fixed version uploaded here. (doesn't include any of the changes mentioned in this thread, but make sure to diff so you can see what's changed and where)
Cheers. (I assume you tested it or do I have to?) If you want to fix the other stuff too, be my guest, as I'm currently working on the function's WeiDU documentation. If not, I'll get to it eventually.

For info's sake, here's what I PMed Nythrun:
I was wondering how difficult a couple of enhancements to your function would be:

1) Compatibility in the function for embedded CREs so it works with adding actors in conjunction with EDIT_SAV_GAME (see my WeiDU forum post for sample syntax). If you decompress and look at an area from a saved game, you'll notice a big (undocumented essentially) data chunk for these before the Actors section. AFAICT, that seems to be the main difference between in-game areas and saved game ones (the ordering seems to be slightly different too but I don't know if that matters).

2) A del_are_structure function for deleting along the same veins as adding structures (probably easier - currently I do this manually though). Also compatibility with embedded CREs for saved games as per the above.

temujin.

  • Guest
Re: Adding creatures to areas
« Reply #43 on: September 15, 2010, 07:29:34 AM »
I assume you tested it or do I have to?
I always test before I post about it. Still, I'd suggest you test it just once in case I missed something.

By testing, I mean I randomly picked an area (for ex: ar0070.are), deleted the last door (Door10) and all it's relevant vertices, then re-added the door back:

Code: [Select]
COPY_EXISTING ~ar0070.are~ ~override~
    LPF fj_add_are_structure
      INT_VAR
        fj_flags               = 0b00000000000000000000000100000000
        fj_open_box_left       = 520
        fj_open_box_top        = 724
        fj_open_box_right      = 545
        fj_open_box_bottom     = 830
        fj_closed_box_left     = 507
        fj_closed_box_top      = 761
        fj_closed_box_right    = 562
        fj_closed_box_bottom   = 869
        fj_cursor_idx          = 30
        fj_trap_detect_diff    = 0
        fj_trap_remove_diff    = 0
        fj_trap_active         = 0
        fj_trap_status         = 0
        fj_trap_loc_x          = 500
        fj_trap_loc_y          = 852
        fj_detect_diff         = 0
        fj_lock_diff           = 0
        fj_open_loc_x          = 517
        fj_open_loc_y          = 881
        fj_closed_loc_x        = 562
        fj_closed_loc_y        = 814
        fj_lockpick_strref     = (0 - 1)
        fj_dialogue_strref     = 0
        fj_door_open_vert_0    = 520 + (826 << 16)
        fj_door_open_vert_1    = 527 + (830 << 16)
        fj_door_open_vert_2    = 545 + (798 << 16)
        fj_door_open_vert_3    = 545 + (727 << 16)
        fj_door_open_vert_4    = 539 + (724 << 16)
        fj_door_open_vert_5    = 520 + (750 << 16)
        fj_door_closed_vert_0  = 507 + (831 << 16)
        fj_door_closed_vert_1  = 562 + (869 << 16)
        fj_door_closed_vert_2  = 562 + (799 << 16)
        fj_door_closed_vert_3  = 507 + (761 << 16)
        fj_cell_open_vert_0    = 32 + (68 << 16)
        fj_cell_open_vert_1    = 33 + (67 << 16)
        fj_cell_open_vert_2    = 32 + (67 << 16)
        fj_cell_closed_vert_0  = 32 + (70 << 16)
        fj_cell_closed_vert_1  = 33 + (71 << 16)
        fj_cell_closed_vert_2  = 34 + (72 << 16)
        fj_cell_closed_vert_3  = 34 + (71 << 16)
        fj_cell_closed_vert_4  = 33 + (70 << 16)
        fj_cell_closed_vert_5  = 32 + (69 << 16)
        fj_cell_closed_vert_6  = 32 + (68 << 16)
        fj_cell_closed_vert_7  = 33 + (69 << 16)
        fj_cell_closed_vert_8  = 34 + (70 << 16)
      STR_VAR
        fj_structure_type      = door
        fj_name                = ~Door10~
        fj_door_wed_id         = ~DOOR10~
        fj_door_open_wav       = ~~
        fj_door_close_wav      = ~~
        fj_key_resref          = ~~
        fj_door_script         = ~~
        fj_travel_trigger      = ~~
        fj_dialogue_resref     = ~~
    END


As for adding support for embedded creatures, I'm going to have to pass on that one.  Don't have the time right now, and I wouldn't be comfortable heavily modifying someone else's code anyway. 

Interesting thing about these types of creatures is that COPY_EXISTING_REGEXP GLOB ~^.+\.cre$~ doesn't capture them (I guess that's one way to prevent other mods from modifying your creatures)  :D

Offline Miloch

  • Barbarian
  • Planewalker
  • *****
  • Posts: 1032
  • Gender: Male
Re: Adding creatures to areas
« Reply #44 on: September 17, 2010, 02:32:42 AM »
So, how is this coming along? :)
Well, it'll be easy enough...
Little did I know it would involve basically rewriting the entire IESDP page on .are file format. Though for something like this, I prefer code examples, which I've included toward the end of the documentation. I've attached the updated area-patching function and documentation to this post (can't attach stuff on PPG and didn't want to codebox them as they're both a few hundred lines long).

The source code includes temujin's fix and updates and a few of my own. I had to change a couple variable names due to differing default values, but otherwise tried to maintain consistency.

temujin.

  • Guest
Re: Adding creatures to areas
« Reply #45 on: September 17, 2010, 06:30:31 AM »
Looks good.  The name field for Variables should be 32 bytes instead of 20.


Something else I just thought of.  All those *_strrefs... are being patched using WRITE_LONG. Unless I'm missing something, this implies only the internal (existing) strings in dialog.tlk can be used. Wouldn't it be better to use SAY / SAY_EVALUATED, otherwise how would you add new strrefs from TRAs (without resorting to do it manually of course)?

Offline Miloch

  • Barbarian
  • Planewalker
  • *****
  • Posts: 1032
  • Gender: Male
Re: Adding creatures to areas
« Reply #46 on: September 17, 2010, 04:54:30 PM »
Wouldn't it be better to use SAY / SAY_EVALUATED, otherwise how would you add new strrefs from TRAs (without resorting to do it manually of course)?
Probably. I think I'll leave that one in bigg's hands though. What with the oddities of how WeiDU handles .tra strings, he can probably figure out what's best (we hope :)).

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: Adding creatures to areas
« Reply #47 on: September 17, 2010, 05:07:55 PM »
 :-Zzz uh, somebody mentioned me?

I haven't exactly been reading this thread carefully, but I think you're looking for this sort of thing:

Code: [Select]
DEFINE_PATCH_MACRO whatever BEGIN
blah blah
SAY_EVALUATED NAME1 (AT var )
END

<...>
SET var = 25
LAUNCH_PATCH_MACRO whatever
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline Miloch

  • Barbarian
  • Planewalker
  • *****
  • Posts: 1032
  • Gender: Male
Re: Adding creatures to areas
« Reply #48 on: September 17, 2010, 06:40:17 PM »
:-Zzz uh, somebody mentioned me?

I haven't exactly been reading this thread carefully, but I think you're looking for this sort of thing
Well since you seem to've been sleeping, the function and documentation I linked is ready to add to WeiDU. The question is whether to change the WRITE_LONG for any _strref variables to SAY_EVALUATED. If we change it to the syntax you indicated, will it not *only* work for @tra references, or will it take hardcoded strrefs as well? There should be a way to designate either, methinks.

[Edit: oh and change the #20 in the //Variable section to #32.]

temujin.

  • Guest
Re: Adding creatures to areas
« Reply #49 on: September 17, 2010, 06:47:40 PM »
I haven't exactly been reading this thread carefully, but I think you're looking for this sort of thing:

that's what we meant (replacing the WRITE_LONGs with SAY_EVALUATEDs), except you can't assume the "AT ..." part. In other words, the strref could be either internal (from dialog.tlk) or external (from .tra), and that part is specified by the user when using the function.


for example, something like:

Code: [Select]
COPY_EXISTING ~blahblah.are~ ~override~
    LPF fj_add_are_structure
      STR_VAR
        fj_info_point_strref = @1234
        fj_info_point_strref = AT var
        fj_lockpick_strref   = #5678
        fj_dlg_strref        = #-1
        fj_note_strref       = ~%variable%~
        fj_some_other_strref = ~@1234~     // this is a normal string, not a tra ref
    END

As I understand, you can't use @ or # or (AT var) directly inside STR_VARs...  ???

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: