Jump to content


Photo

Moving an NPCs starting point


  • Please log in to reply
2 replies to this topic

#1 Rana

Rana
  • Member
  • 5 posts

Posted 03 May 2011 - 05:09 PM

The goal:  To move Skie's starting location to same one Eldoth was given in the BG1 NPC project.

I've been staring at the script from the bg1npc setup tp2, but I can't make sense of it.  Here's an excerpt of Eldoth's section:

/* Eldoth Starts in the Cloakwood Forest */
BEGIN @1072 /* Eldoth Starts in the Cloakwood Forest. */
  SUBCOMPONENT @1073 /* The BG1 NPC Project: Eldoth's Starting Location. */
  GROUP @1065 /* The BG1 NPC Project: Tweaks */
  REQUIRE_PREDICATE (FILE_EXISTS_IN_GAME ~_sw1h01.itm~) @1095 /* Incompatible with BGT: please use the equivalent component in SwordCoastStrategems for BGT */
  REQUIRE_FILE ~override/X#BG1NPCCore.G3~ @1004 /* BG1 NPC Required Changes component is not installed. */
    PRINT @1074 /* Eldoth will start in the Cloakwood as in the original game. */

/* Eldoth Starts on the Coastal Way */
BEGIN @1075 /* Eldoth Starts on the Coast Way. */
  SUBCOMPONENT @1073 /* The BG1 NPC Project: Eldoth's Starting Location. */
  GROUP @1065 /* The BG1 NPC Project: Tweaks */
  REQUIRE_PREDICATE (FILE_EXISTS_IN_GAME ~_sw1h01.itm~) @1095 /* Incompatible with BGT: please use the equivalent component in SwordCoastStrategems for BGT */
  REQUIRE_FILE ~override/X#BG1NPCCore.G3~ @1004 /* BG1 NPC Required Changes component is not installed. */
    COPY ~BG1NPC/Core/X#component.xx~ ~override/X#EldothMove.G3~

  /*Patching _ELDOTH.bcs */
  COPY_EXISTING ~_ELDOTH.bcs~ ~override~
    DECOMPILE_BCS_TO_BAF
    REPLACE_TEXTUALLY
      ~!Global("X#SkieLeftEldoth","GLOBAL",1)~
      ~OR(2) !Global("X#SkieLeftEldoth","GLOBAL",1) !Global("EldothMove","GLOBAL",0)~
    COMPILE_BAF_TO_BCS
    BUT_ONLY_IF_IT_CHANGES

  COPY_EXISTING ~baldur.gam~ ~override~
    READ_LONG 0x30 non_joined_npcs_off
    READ_LONG 0x34 non_joined_npcs_count
    FOR (i = 0; i < non_joined_npcs_count; i+=1) BEGIN
      SET cre_offset = non_joined_npcs_off + i * 0x160
      READ_ASCII 0xc + cre_offset ~CREName~
      PATCH_IF !(~%CREName%~ STRING_COMPARE_CASE ~_ELDOTH~) BEGIN
        WRITE_ASCII cre_offset + 0x18 ~FW2800~ #8
        WRITE_SHORT cre_offset + 0x20 1064
        WRITE_SHORT cre_offset + 0x22 2086
      END
    END
    BUT_ONLY_IF_IT_CHANGES
  PRINT @1076 /* ~Remember to start a new game for Eldoth to start on the Coast Way near the Obelisk. */


If I wanted to use this script structure to apply to Skie, what values would I need to change?  Or if anyone else has a suggestion on how I could achieve the desired effect, I'd really appreciate it.  Thanks!

Edited by Rana, 03 May 2011 - 05:13 PM.


#2 Jarno Mikkola

Jarno Mikkola

    The Imp in his pink raincoat.

  • Member
  • 10911 posts

Posted 04 May 2011 - 12:57 AM

This is a bit complicated matter as you are probably intrested in the last proportion first, this:
I'll quote out my comments with the "//"s so you can read them and they are still excecuted...
COPY_EXISTING ~baldur.gam~ ~override~ //the default savegame is copied
READ_LONG 0x30 non_joined_npcs_off //a few of the variables are read from the save
READ_LONG 0x34 non_joined_npcs_count
FOR (i = 0; i < non_joined_npcs_count; i+=1) BEGIN 
SET cre_offset = non_joined_npcs_off + i * 0x160
READ_ASCII 0xc + cre_offset ~CREName~ //this line with the help of the above places the cre file to where it is 
PATCH_IF !(~%CREName%~ STRING_COMPARE_CASE ~_ELDOTH~) BEGIN //and here we identify the comparison to the _ELDOTH
WRITE_ASCII cre_offset + 0x18 ~FW2800~ #8 //this replaces the cre to the area FW2800.are in direction 8 out of 15
WRITE_SHORT cre_offset + 0x20 1064 // this is the x position
WRITE_SHORT cre_offset + 0x22 2086 // this is the y position
END
END
BUT_ONLY_IF_IT_CHANGES
PRINT ~Remember to start a new game for Eldoth to start on the Coast Way near the Obelisk.~


So you probably need to just alter the above code to have _SKIE instead of the _ELDOTH, while replaceing the 1064 with the x position you wish to place her, and the 2086 with the y position you wish to place her.... you gain these by starting a game and loading the area and having your mouse pointer at the place you wish to place the character and pushing the X button, the dialog window showns the exact position, and the area code should be included, so...

The rest of the above code firstly checks for the BGT, well that the game doesn't have the BGT installed but instead the BGTutu... as then it can assume that the Eldorth 's .cre file and death variable are _ELDOTH, and the area codes start with FW****'s

Then the next phase checks if here is a marker that would prevent the component from installing... and if there is not, it makes the marker.
And the 3rd impoves a condition for one of the creatures script conditions... and the rest does the above.

Deactivated account. The user today is known as The Imp.


#3 Rana

Rana
  • Member
  • 5 posts

Posted 04 May 2011 - 09:56 AM

I tried swapping out Eldoth's info for Skie's in the section you mentioned and replacing the XY values with the ones I wanted Skie to appear at, but it didn't work. ><