Author Topic: Offering new component for UB  (Read 26680 times)

Offline plainab

  • Sasha al'Therin
  • Planewalker
  • *****
  • Posts: 491
    • Infinity Engine Modding
Offering new component for UB
« on: February 03, 2012, 01:38:31 PM »
Miloch doesn't want this in the fixpack.

it fixes the exploit of being able to turn in Prism's emeralds one at a time by making them unique items
it provides new options to obtain the emeralds.
it provides split rewards if the player is only able to obtain one of the emeralds.

it's designed to reverse the changes made by the fixpacks inadequate non-tweak fix by overwriting Oublek's dialog file with the original so this component would need be installed prior to any other mods which affect Oublek's dialog file.

to add into UB uncomment and modified the opening component type lines (i.e. BEGIN, REQUIRE_COMPONENT & INCLUDE)  you can drop the fixpack's print statement for processing the specific tph file

Note: This was coded several years ago, at the time I used WAPT.tph which was based off of Qwinn's area patching tools and modified by myself and Ardanis.  if there is something better to use these days, feel free tho you'll need to determine what changes are made....

the patch code:
Code: [Select]
//ISSUES-OublekEmeraldBountyExploitTWEAK.tph
PRINT ~Processing ISSUES-OublekEmeraldBountyExploitTWEAK.tph~
// ----------------------------------------------------------------------------
//BEGIN @7 //~Optional: Oublek & Prism - No Exploit & Multiple Ways to Solve Quest~
//REQUIRE_COMPONENT ~Setup-BGFixPack.tp2~ ~0~ @3 //~SKIPPING Required Component not installed~
//INCLUDE ~bgfixpack\tph\wapt.tph~ //definitions for the various Weidu Area Patching Tool macros and functions
LAUNCH_ACTION_FUNCTION ~wapt_add_container~
INT_VAR //integer variables
wapt_num_new_Conta = 2
//data for container 1
wapt_use_point_x_1 = 641 wapt_use_point_y_1 = 2713 wapt_type_1 = 6 wapt_lock_diff_1 = 30 wapt_flags_1 = 0b00000001 wapt_trap_detect_diff_1 = 100 wapt_trap_disarm_diff_1 = 100 wapt_trap_launch_x_1 = 641 wapt_trap_launch_y_1 = 2713 wapt_num_items_1 = 1 wapt_vertices_1 = 6
//data for container 2
wapt_use_point_x_2 = 641 wapt_use_point_y_2 = 2713 wapt_type_2 = 6 wapt_lock_diff_2 = 70 wapt_flags_2 = 0b00000001 wapt_trap_detect_diff_2 = 100 wapt_trap_disarm_diff_2 = 100 wapt_trap_launch_x_2 = 641 wapt_trap_launch_y_2 = 2713 wapt_num_items_2 = 1 wapt_vertices_2 = 6
//Vertex points for container 1:
wapt_vx_1 = 564 wapt_vy_1 = 2559 wapt_vx_2 = 578 wapt_vy_2 = 2552 wapt_vx_3 = 590 wapt_vy_3 = 2556 wapt_vx_4 = 586 wapt_vy_4 = 2561 wapt_vx_5 = 580 wapt_vy_5 = 2563 wapt_vx_6 = 570 wapt_vy_6 = 2562
//Vertex points for container 2:
wapt_vx_7 = 638 wapt_vy_7 = 2544 wapt_vx_8 = 635 wapt_vy_8 = 2550 wapt_vx_9 = 627 wapt_vy_9 = 2554 wapt_vx_10 = 614 wapt_vy_10 = 2555 wapt_vx_11 = 626 wapt_vy_11 = 2543 wapt_vx_12 = 635 wapt_vy_12 = 2541
STR_VAR //string variables
wapt_area = ~ar5400~ wapt_object_name_1 = ~A6StatueRightEye~ wapt_object_name_2 = ~A6StatueLeftEye~
END //end launch command
//create left eye emerald
COPY_EXISTING ~misc43.itm~ ~override/abgfEyeL.itm~
 SAY UNIDENTIFIED_DESC ~An Emerald is a brilliant green beryl, cleaved along straight box like lines, with rectangular cutting in the finished gem.  Emeralds are often connected with health, and so are used ornamentally for such a purpose. This emerald is marked with a small 'L'. It had been stolen by Prism for his use in a statue of his lady love, Ellesime. It is surmised that this gem was intended to be used as the left eye. Whether or not it was used in the statue, there is a bounty for returning it to the proper authorities.~
 SAY IDENTIFIED_DESC ~An Emerald is a brilliant green beryl, cleaved along straight box like lines, with rectangular cutting in the finished gem.  Emeralds are often connected with health, and so are used ornamentally for such a purpose. This emerald is marked with a small 'L'. It had been stolen by Prism for his use in a statue of his lady love, Ellesime. It is surmised that this gem was intended to be used as the left eye. Whether or not it was used in the statue, there is a bounty for returning it to the proper authorities.~
BUT_ONLY_IF_IT_CHANGES
//create right eye emerald
COPY_EXISTING ~misc43.itm~ ~override/abgfEyeR.itm~
 SAY UNIDENTIFIED_DESC ~An Emerald is a brilliant green beryl, cleaved along straight box like lines, with rectangular cutting in the finished gem.  Emeralds are often connected with health, and so are used ornamentally for such a purpose. This emerald is marked with a small 'R'. It had been stolen by Prism for his use in a statue of his lady love, Ellesime. It is surmised that this gem was intended to be used as the right eye. Whether or not it was used in the statue, there is a bounty for returning it to the proper authorities.~
 SAY IDENTIFIED_DESC ~An Emerald is a brilliant green beryl, cleaved along straight box like lines, with rectangular cutting in the finished gem.  Emeralds are often connected with health, and so are used ornamentally for such a purpose. This emerald is marked with a small 'R'. It had been stolen by Prism for his use in a statue of his lady love, Ellesime. It is surmised that this gem was intended to be used as the right eye. Whether or not it was used in the statue, there is a bounty for returning it to the proper authorities.~
BUT_ONLY_IF_IT_CHANGES
//change the emeralds that prism carries
COPY_EXISTING ~prism.cre~ ~override~
 REMOVE_CRE_ITEM ~misc43~
 REPLACE_CRE_ITEM ~abgfEyeL~ #1 #0 #0 ~identified~ ~qitem1~
 REPLACE_CRE_ITEM ~abgfEyeR~ #1 #0 #0 ~identified~ ~qitem2~
BUT_ONLY_IF_IT_CHANGES
//compile the dialog changes to oublek and prism
COPY ~bgfixpack/files/oublek/oublek.dlg~ ~override~ //replace earlier 'fixed' file with original cause it is easier than trying to undo the changes made to all versions
COMPILE ~bgfixpack/files/oublek/oublek.d~
//check existance of area script and add rep penalty for taking gems from statue
COPY_EXISTING ~ar5400.are~ ~override~
 LAUNCH_PATCH_MACRO ~wapt_header_initvars~
 INNER_ACTION BEGIN
  EXTEND_BOTTOM ~%wapt_h_AreBS%.bcs~ ~bgfixpack/files/oublek/ar5400.baf~ //add our stuff -- creates new if doesn't exist
 END
BUT_ONLY_IF_IT_CHANGES
//check existance of area script and add global sets to complete quest
COPY_EXISTING ~ar4800.are~ ~override~
 LAUNCH_PATCH_MACRO ~wapt_header_initvars~
 INNER_ACTION BEGIN
  EXTEND_BOTTOM ~%wapt_h_AreBS%.bcs~ ~bgfixpack/files/oublek/ar4800.baf~ //add our stuff -- creates new if doesn't exist
 END
BUT_ONLY_IF_IT_CHANGES

the required macro/function code:
Code: [Select]
//////////////////////////////////////////////

// Note by Ardanis:
// As you can tell by the prefix, it originally was a Qwinn's macro. I compressed it
// into a more accessible format. A fair example of how to make a good use of arrays.

// Bigg, Weidu's readme says it needs a real example of array usage. Does this pass for one?

DEFINE_PATCH_MACRO ~wapt_Q_ARE_InitVars~ BEGIN

PATCH_IF (GAME_IS ~pst~)                     BEGIN Q_Game=1 END
PATCH_IF (GAME_IS ~bg2 tob tutu tutu_totsc~) BEGIN Q_Game=2 END
PATCH_IF (GAME_IS ~bg1 totsc iwd how~)       BEGIN Q_Game=3 END

DEFINE_ARRAY object BEGIN Actor Trigg Spawn Entra Conta Items Ambie Varia Doors Tiled Vertx Explo Anima Songs RestS MapNo ProTr END
DEFINE_ARRAY Siz    BEGIN 0x110 0xc4  0xc8  0x68  0xc0  0x14  0xd4  0x54  0xc8  0x6c  0x4   0x0   0x4c  0x90  0xe4  0x34  0x1A  END
DEFINE_ARRAY OoN    BEGIN 0x58  0x5a  0x64  0x6c  0x74  0x76  0x82  0x8c  0xa4  0xb4  0x80  0x0   0xac  0x0   0x0   0xc8  0xd0  END
DEFINE_ARRAY OoO    BEGIN 0x54  0x5c  0x60  0x68  0x70  0x78  0x84  0x88  0xa8  0xb8  0x7c  0xa0  0xb0  0xbc  0xc0  0xc4  0xcc  END
DEFINE_ARRAY SoL    BEGIN 2     2     4     4     2     2     2     4     4     4     2     0     4     0     0     4     4     END

FOR (i=0;i<17;i+=1) BEGIN
  SET $Q_Siz($object("%i%"))=$Siz("%i%")     // size of object's section
  SET $Q_OoN($object("%i%"))=$OoN("%i%")     // offset of number of objects
  SET $Q_OoO($object("%i%"))=$OoO("%i%")     // offset of offset of objects
  SET $Q_SoL($object("%i%"))=$SoL("%i%")     // SHORT or LONG offset of number of objects
  PATCH_IF i=15 & Q_Game=1 BEGIN                                 // PST uses different values
    Q_OoN_MapNo=0xcc Q_OoO_MapNo=0xc8 END
  PATCH_IF $SoL("%i%")=2 BEGIN               // number of objects
    READ_SHORT $Q_OoN($object("%i%")) $Q_Num($object("%i%")) END // if SoL = 2 = SHORT, then READ_SHORT
  PATCH_IF $SoL("%i%")=4 & ( i!=16 | Q_Game=2) BEGIN             // non-BG2 games can't have projectiles
    READ_LONG  $Q_OoN($object("%i%")) $Q_Num($object("%i%")) END // if SoL = 4 = LONG, then READ_LONG
  PATCH_IF $SoL("%i%")=0 BEGIN                                   // if SoL = 0 = not needed, don't READ, instead
    SET $Q_Num($object("%i%"))=1 END                             //   SET it to 1, as this can't be any other
  PATCH_IF i!=16 | Q_Game=2 BEGIN            // offset of objects
    READ_LONG  $Q_OoO($object("%i%")) $Q_Off($object("%i%")) END // offsets' READs always LONG
END

PATCH_IF Q_Game!=2 BEGIN                                         // if it's non-BG2 then set everything
  Q_OoN_ProTr=0 Q_OoO_ProTr=0 Q_Num_ProTr=0 Q_Off_ProTr=0 END    // related to projectiles to zero

END

/////////////////////////////////////////////////

// Note by Ardanis:
// Again, Qwinn's stuff that was revamped.

DEFINE_PATCH_MACRO ~wapt_Q_AREAdd_InitVars~ BEGIN
FOR (i=0;i<17;i+=1) BEGIN
  SET $Q_New($object("%i%"))=0        // number of new objects
  SET $Q_NewOffset($object("%i%"))=0  // writing offset for new objects
END
Q_ManualInsert=0  // unnecessary, but may be required for RESHAPE_AREA_POLYGON, should it be added later (unlikely)
END

//////////////////////////////////////////

// Note by Ardanis:
// Unlike the other two Qwinn's macros, this one is almost untouched, except of adding the 'wapt_' prefix to
// it's name and correcting the name of the macro LAUNCHed at the very end, which now has that prefix as well

DEFINE_PATCH_MACRO ~wapt_Q_AREAdd_Process~
BEGIN

// DO NOT use this macro without first running Q_AREAdd_InitVars.
// Documentation for the use of this macro is contained within that macro definition.

PATCH_FOR_EACH "S1" IN
  ~Actor~ ~Trigg~ ~Spawn~ ~Entra~ ~Conta~ ~Items~ ~Ambie~ ~Varia~ ~Doors~
  ~Tiled~ ~Vertx~ ~Anima~ ~MapNo~ ~ProTr~
BEGIN
  SET "Q_NewSect" = $Q_New("%S1%") // How many new sections user has asked for
  PATCH_IF !("Q_NewSect" = 0) THEN
  BEGIN
// WRITE_ASCII 0x33c ~%S1%~ #32 // DEBUG
SET "Q_OoNSect" = $Q_OoN("%S1%") // Offset where count of each section is stored
SET "Q_NumSect" = $Q_Num("%S1%") // Original count for that section
SET "Q_SoLSect" = $Q_SoL("%S1%")  // Whether original count is stored as long or short
SET "Q_OoOSect1" = $Q_OoO("%S1%") // Offset of offset for the section
SET "Q_Offset1" = $Q_Off("%S1%") // Offset of the section being added to
SET "Q_SizSect" = $Q_Siz("%S1%") // The size of one new section
PATCH_FOR_EACH "S2" IN
  ~Actor~ ~Trigg~ ~Spawn~ ~Entra~ ~Conta~ ~Items~ ~Ambie~ ~Varia~ ~Doors~
  ~Tiled~ ~Vertx~ ~Explo~ ~Anima~ ~Songs~ ~RestS~ ~MapNo~ ~ProTr~
BEGIN
  // WRITE_ASCII 0x33c ~%S1% %S2%~ #32 // DEBUG
  SET "Q_Offset2" = $Q_Off("%S2%") // Offset of each other section
  SET "Q_OoOSect2" = $Q_OoO("%S2%") // Offset of that offset
  SET "Q_OldInsert" = $Q_NewOffset("%S2%") // Previous insert offsets need to be updated too

  PATCH_IF ("Q_Offset2" >= "Q_Offset1") AND NOT ("%S1%" STRING_EQUAL "%S2%") THEN
  BEGIN
WRITE_LONG "Q_OoOSect2" ("Q_Offset2" + ("Q_NewSect" * "Q_SizSect"))
  END
  PATCH_IF ("Q_OldInsert" >= "Q_Offset1") AND NOT ("%S1%" STRING_EQUAL "%S2%") THEN
  BEGIN
SET $Q_NewOffset("%S2%") = $Q_NewOffset("%S2%") + ("Q_NewSect" * "Q_SizSect")
  END
END
SET $Q_NewOffset("%S1%") = "Q_Offset1" + ("Q_NumSect" * "Q_SizSect")
SET "Q_InsertOffset" = $Q_NewOffset("%S1%")
PATCH_IF "Q_ManualInsert" = 0 THEN
BEGIN
  INSERT_BYTES "Q_InsertOffset" ("Q_NewSect" * "Q_SizSect")
END
        PATCH_IF "Q_SoLSect" = 2 THEN BEGIN WRITE_SHORT "Q_OoNSect" ("Q_NumSect" + "Q_NewSect") END
                                 ELSE BEGIN WRITE_LONG  "Q_OoNSect" ("Q_NumSect" + "Q_NewSect") END
LAUNCH_PATCH_MACRO ~wapt_Q_ARE_InitVars~  // Reset all our variables to their new values
  END
END

END

////////////////////////////////////////////////////
//////////////////////////////////////

// This macro does the following:
//   sets 'bbox' to 1, which is the starting value for all ADD_AREA_STUFF functions
//   calculates the total amount of new vertices
//   inserts new objects using Qwinn's algorithm
//   writes new vertices
//   sets 'vert_entry' - the starting index of newly added vertices

DEFINE_PATCH_MACRO wapt_inserter BEGIN
  bbox=1 // vertex index for bounding box calculation
  vert=0                               //calculating the number of new
  FOR (i=1;i<wapt_object+1;i+=1) BEGIN //vertices, to save modder the
    vert+= $wapt_vertices("%i%")       //trouble of doing it manually
  END
  LAUNCH_PATCH_MACRO ~wapt_Q_ARE_InitVars~    //launch variable initiation macro
  LAUNCH_PATCH_MACRO ~wapt_Q_AREAdd_InitVars~ //launch variable initiation macro for adding new sections
  Q_New_Vertx = vert
  PATCH_FOR_EACH ob_type IN ~Conta~ ~Entra~ ~Trigg~ BEGIN         //which type of object we're adding
    PATCH_IF ~%wapt_ob_type%~ STRING_EQUAL_CASE ~%ob_type%~ BEGIN //wapt_ob_type is preset by STR_VAR
      SET $Q_New("%ob_type%") = wapt_object
    END ELSE BEGIN
      SET $Q_New("%ob_type%") = 0
    END
    PATCH_IF (~%ob_type%~ STRING_EQUAL_CASE ~Conta~) AND (VARIABLE_IS_SET wapt_num_new_Items ) BEGIN  //if user is adding items to new containers
     Q_New_Items = %wapt_item%                                                                        //update variable to get proper space installed
     wapt_idx_items = %Q_Num_Items%                                                                   //assign index value for item(s) in first container
    END
  END
  LAUNCH_PATCH_MACRO ~wapt_Q_AREAdd_Process~  //launch macro that adds new space for above listed entries
  vert_entry = Q_Num_Vertx - Q_New_Vertx      //starting index for new vertices, used by the main FUNCTION
  FOR (i=1;i<vert+1;i+=1) BEGIN                             //
    WRITE_SHORT (Q_NewOffset_Vertx+i*4 - 4) $wapt_vx("%i%") //writing new vertices
    WRITE_SHORT (Q_NewOffset_Vertx+i*4 - 2) $wapt_vy("%i%") //
  END
END

/////////////////////////////////////

// This macro does the following:
//   sets 'new_loc' - the starting offset for writing down the new object
//   writes the object's name, which is 32 char long
//   calculates and writes the bounding box for the object

DEFINE_PATCH_MACRO wapt_routine BEGIN // vars used for bbox math: a b c c1 c2 bbox_off
  new_loc = $Q_NewOffset("%wapt_ob_type%") + (i - 1)*$Q_Siz("%wapt_ob_type%") // from where we'll do writing
  WRITE_EVALUATED_ASCII new_loc $wapt_object_name("%i%") (32)                 // object's name
  bbox_off=new_loc+wapt_bbox                                 //offset for this object's bbox, wapt_bbox is preset by INT_VAR
  FOR (a=0;a<4;a+=1) BEGIN                                   //0=X_low - left, 1=Y_low - down, 2=X_high - right, 3=Y_high - top
    PATCH_IF a=0 OR a=2 BEGIN SPRINT xy ~wapt_vx_~ END ELSE BEGIN SPRINT xy ~wapt_vy_~ END //X or Y coordinate of the vertex
    c=bbox                                                   //we assume that the extreme vertex is the 1st one of the object
    c1=EVALUATE_BUFFER ~%%xy%%c%%~                           //coord_value_1=(X/Y)_%vert_index%, coord of object's the 1st vertex
    FOR (b=bbox+1;b<$wapt_vertices("%i%")+bbox;b+=1) BEGIN   //start with 2nd vertex of the object, finish with the last
      c2=EVALUATE_BUFFER ~%%xy%%b%%~                         //coord_value_2=(X/Y)_%counter%, other vertices of the object
      PATCH_IF (a<2&c2<c1)|(a>1&c2>c1) BEGIN //compare the 1st vertex's value with that of the others, if some exceeds then...
        c=b                                  //...mark it as the new extreme and...
        c1=c2                                //...use it's value to check against the remaining
      END
      WRITE_SHORT (bbox_off+a*2) EVALUATE_BUFFER ~%%xy%%c%%~ //precisely the box's values for the object, writing that down
    END
  END
  bbox+=$wapt_vertices("%i%") // update the bbox index so it matches the 1st vertex of the next object
END // should ADD_DOOR (it has 3 polygons instead of 1) be introduced, this macro will have to be revamped

////////////////////////////////////////////////////
DEFINE_ACTION_FUNCTION wapt_add_container
  INT_VAR
    wapt_object=1
    wapt_item=0
    wapt_bbox=0x38
  STR_VAR
    wapt_ob_type= ~Conta~
  BEGIN
COPY_EXISTING ~%wapt_area%.are~ ~override~
  PATCH_IF (VARIABLE_IS_SET wapt_num_new_Conta) BEGIN   //if user choose to add more than one container -- uses a more user friendly variable name
   wapt_object = %wapt_num_new_Conta%
  END
  PATCH_IF (VARIABLE_IS_SET wapt_num_new_Items) BEGIN   //if user choose to add one or more items to a container -- uses a more user friendly variable name
   wapt_item = %wapt_num_new_Items%
  END
  LAUNCH_PATCH_MACRO wapt_inserter
  FOR (i=1;i<wapt_object+1;i+=1) BEGIN
    LAUNCH_PATCH_MACRO wapt_routine
DEFINE_ARRAY field BEGIN use_point_x use_point_y type lock_diff flags trap_detect_diff trap_disarm_diff trap_trapped trap_detected trap_launch_x trap_launch_y script key_item string vertices END
DEFINE_ARRAY Off   BEGIN 0x20        0x22        0x24 0x26      0x28  0x2c             0x2e             0x30         0x32          0x34          0x36          0x48   0x78     0x84   0x54     END
DEFINE_ARRAY SoL   BEGIN 2           2           2    2         4     2                2                2            2             2             2             8      8        4      4        END
    FOR(i2=0;i2<15;i2+=1)BEGIN
     PATCH_IF ($SoL("%i2%")=2) AND (VARIABLE_IS_SET $wapt($field("%i2%")"%i%") ) BEGIN
      WRITE_SHORT (%new_loc%+ $Off("%i2%")) $wapt($field("%i2%")"%i%")
     END
     PATCH_IF ($SoL("%i2%")=4) AND (VARIABLE_IS_SET $wapt($field("%i2%")"%i%") ) BEGIN
      WRITE_LONG (%new_loc%+ $Off("%i2%")) $wapt($field("%i2%")"%i%")
     END
     PATCH_IF ($SoL("%i2%")=8) AND (VARIABLE_IS_SET $wapt($field("%i2%")"%i%") ) BEGIN
      WRITE_ASCIIE (%new_loc%+ $Off("%i2%")) $wapt($field("%i2%")"%i%") (8)
     END
    END
    PATCH_IF (%wapt_item% >0) BEGIN
     WRITE_LONG (new_loc+0x40) %wapt_idx_items%                 // index value for first new item in current container
     WRITE_LONG (new_loc+0x44) $wapt_num_items("%i%")           // won't write for some reason within the array system
     wapt_idx_items += $wapt_num_items("%i%")                   // update item index for the next container
    END
    WRITE_LONG (new_loc + 0x50)  vert_entry                    // vertex index
    vert_entry += $wapt_vertices("%i%")                        // update vertex index for the next object
  END
DEFINE_ARRAY ifield BEGIN itm_name exp_time qc1 qc2 qc3 itm_flags END
DEFINE_ARRAY i_off  BEGIN 0x0      0x8      0xa 0xc 0xe 0x10      END
DEFINE_ARRAY i_sol  BEGIN 8        2        2   2   2   4         END
  FOR (i4=1;i4<%wapt_item%+1;i4+=1)BEGIN
    FOR(i3=0;i3<6;i3+=1)BEGIN
     PATCH_IF ($i_sol("%i3%")=8) AND (VARIABLE_IS_SET $wapt($ifield("%i3%")"%i4%") ) BEGIN
      WRITE_ASCIIE (%Q_NewOffset_Items% + (%Q_Siz_Items% * (%i4%-1))) $wapt($ifield("%i3%")"%i4%") (8)
     END
     PATCH_IF ($i_sol("%i3%")=4) AND (VARIABLE_IS_SET $wapt($ifield("%i3%")"%i4%") ) BEGIN
      WRITE_LONG (%Q_NewOffset_Items% + (%Q_Siz_Items% * (%i4%-1))) $wapt($ifield("%i3%")"%i4%")
     END
     PATCH_IF ($i_sol("%i3%")=2) AND (VARIABLE_IS_SET $wapt($ifield("%i3%")"%i4%") ) BEGIN
      WRITE_SHORT (%Q_NewOffset_Items% + (%Q_Siz_Items% * (%i4%-1))) $wapt($ifield("%i3%")"%i4%")
     END
    END
  END
BUT_ONLY_IF_IT_CHANGES
END

//////////////////////////////////////
DEFINE_PATCH_MACRO ~wapt_header_initvars~ BEGIN
 PATCH_IF (GAME_IS ~pst~)                     BEGIN Q_Game=1 END
 PATCH_IF (GAME_IS ~bg2 tob tutu tutu_totsc~) BEGIN Q_Game=2 END
 PATCH_IF (GAME_IS ~bg1 totsc iwd how~)       BEGIN Q_Game=3 END
 DEFINE_ARRAY Entry BEGIN Signa WedFi LSave AFlag North East South West AType RainP SnowP FogPr LiteP AreBS RMDay RMNit END
 DEFINE_ARRAY OoEnt BEGIN 0x0   0x8   0x10  0x14  0x18  0x24 0x30  0x3c 0x48  0x4a  0x4c  0x4e  0x50  0x94  0xd4  0xdc  END
 DEFINE_ARRAY SoEnt BEGIN 8     8     4     4     8     8    8     8    2     2     2     2     2     8     8     8     END
 FOR(i=0;i<16;i+=1)BEGIN
  PATCH_IF ($SoEnt("%i%")=8) BEGIN
   READ_ASCII $OoEnt("%i%") $wapt_h($Entry("%i%"))
  END
  PATCH_IF ($SoEnt("%i%")=4) BEGIN
   READ_LONG $OoEnt("%i%") $wapt_h($Entry("%i%"))
  END
  PATCH_IF ($SoEnt("%i%")=2) BEGIN
   READ_SHORT $OoEnt("%i%") $wapt_h($Entry("%i%"))
  END
 END
END
My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altherin.webs.com

Offline Salk

  • Planewalker
  • *****
  • Posts: 832
Re: Offering new component for UB
« Reply #1 on: February 04, 2012, 12:50:26 AM »
This is great stuff!

I remembered suggesting it to Ascension64 quite some many years ago and here it is in full shine!  ;)

I sincerely hope it will find a home here at BG1 UB because it truly deserves it.

Offline Miloch

  • Barbarian
  • Planewalker
  • *****
  • Posts: 1030
  • Gender: Male
Re: Offering new component for UB
« Reply #2 on: February 05, 2012, 08:21:23 AM »
Ascension64 actually did code it (the container-adding bit anyway) originally. I'm guessing plainab recoded that. The fj_are_structure function is the preferred way to add things like containers nowadays. As you can see if you scroll down a bit, it's fairly simple to use (example from the WeiDU doc).
Code: [Select]
  LPF fj_are_structure
    INT_VAR
    fj_type        = 8 //nonvisible
    fj_loc_x       = 4388
    fj_loc_y       = 2876
    fj_box_left    = 4372
    fj_box_top     = 2826
    fj_box_right   = 4420
    fj_box_bottom  = 2858
    fj_trap_loc_x  = 4380
    fj_trap_loc_y  = 2870
    fj_vertex_0    = 4411 + (2858 << 16)
    fj_vertex_1    = 4372 + (2845 << 16)
    fj_vertex_2    = 4382 + (2826 << 16)
    fj_vertex_3    = 4420 + (2839 << 16)
    STR_VAR
    fj_structure_type = container
    fj_name           = ~Cornerstone~
  END
"Emerald" should be lowercase in the description (unless it's at the beginning of a sentence).

Offline jastey

  • Moderator
  • Planewalker
  • *****
  • Posts: 1136
  • Gender: Female
Re: Offering new component for UB
« Reply #3 on: February 07, 2012, 07:29:17 AM »
The code kind fo scares me off - I'll have to look at this with more time at hand.

Offline plainab

  • Sasha al'Therin
  • Planewalker
  • *****
  • Posts: 491
    • Infinity Engine Modding
Re: Offering new component for UB
« Reply #4 on: February 07, 2012, 10:07:27 AM »
The code kind fo scares me off - I'll have to look at this with more time at hand.
if i can figure out the thing built into weidu now, it'll reduce the code i'm sure.

i have a lot of stuff in the fixpack that's like this.... so i have to learn how to modify it all anyway....
My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altherin.webs.com

Offline jastey

  • Moderator
  • Planewalker
  • *****
  • Posts: 1136
  • Gender: Female
Re: Offering new component for UB
« Reply #5 on: February 07, 2012, 11:36:07 AM »
Great. Let me know then.  ;D  ;)

Offline plainab

  • Sasha al'Therin
  • Planewalker
  • *****
  • Posts: 491
    • Infinity Engine Modding
Re: Offering new component for UB
« Reply #6 on: February 07, 2012, 12:19:37 PM »
ok... think i got the built in function figured out...  AND it installs without giving errors...  could use in game testing to be sure everything works
also didn't include all the necessary files earlier

modified tph/tp2 code:
Code: [Select]
// ----------------------------------------------------------------------------
//BEGIN @7 //~Optional: Oublek & Prism - No Exploit & Multiple Ways to Solve Quest~
//first container
COPY_EXISTING ~ar5400.are~ override
LAUNCH_PATCH_FUNCTION ~fj_are_structure~
INT_VAR fj_loc_x = 641
        fj_loc_y = 2713
        fj_type = 6
        fj_lock_diff = 30
//        fj_flags to the bitwise container flags (bit0=locked, bit3=trap resets, bit5=disabled);
        fj_flags = 0b00000001
        fj_trap_detect = 100
        fj_trap_remove_diff = 100
//        fj_trap_active to whether the container is trapped (0=no, 1=yes);
//        fj_trap_status to whether the trap is detected (0=no, 1=yes);
        fj_trap_loc_x = 641
        fj_trap_loc_y = 2713
        fj_box_left = 564
        fj_box_top = 2552
        fj_box_right = 590
        fj_box_bottom = 2563
        fj_vertex_0 = (564 + (2559 << 16))
        fj_vertex_1 = (578 + (2552 << 16))
        fj_vertex_2 = (590 + (2556 << 16))
        fj_vertex_3 = (586 + (2561 << 16))
        fj_vertex_4 = (580 + (2563 << 16))
        fj_vertex_5 = (570 + (2562 << 16))
//        fj_lockpick_strref to the lockpick string reference (default -1);
STR_VAR fj_structure_type = ~container~
        fj_name = ~A6StatueRightEye~
//        fj_trap_script to the trapís script;
//        fj_key_resref to the filename of the containerís key;
END

//second container
COPY_EXISTING ~ar5400.are~ override
LAUNCH_PATCH_FUNCTION ~fj_are_structure~
INT_VAR fj_loc_x = 641
        fj_loc_y = 2713
        fj_type = 6
        fj_lock_diff = 70
//        fj_flags to the bitwise container flags (bit0=locked, bit3=trap resets, bit5=disabled);
        fj_flags = 0b00000001
        fj_trap_detect = 100
        fj_trap_remove_diff = 100
//        fj_trap_active to whether the container is trapped (0=no, 1=yes);
//        fj_trap_status to whether the trap is detected (0=no, 1=yes);
        fj_trap_loc_x = 641
        fj_trap_loc_y = 2713
        fj_box_left = 614
        fj_box_top = 2541
        fj_box_right = 638
        fj_box_bottom = 2555
        fj_vertex_0 = (638 + (2544 << 16))
        fj_vertex_1 = (635 + (2550 << 16))
        fj_vertex_2 = (627 + (2554 << 16))
        fj_vertex_3 = (614 + (2555 << 16))
        fj_vertex_4 = (626 + (2543 << 16))
        fj_vertex_5 = (635 + (2541 << 16))
//        fj_lockpick_strref to the lockpick string reference (default -1);
STR_VAR fj_structure_type = ~container~
        fj_name = ~A6StatueLeftEye~
//        fj_trap_script to the trapís script;
//        fj_key_resref to the filename of the containerís key;
END

//create left eye emerald
COPY_EXISTING ~misc43.itm~ ~override/abgfEyeL.itm~
 SAY UNIDENTIFIED_DESC ~An emerald is a brilliant green beryl, cleaved along straight box like lines, with rectangular cutting in the finished gem.  Emeralds are often connected with health, and so are used ornamentally for such a purpose. This emerald is marked with a small 'L'. It had been stolen by Prism for his use in a statue of his lady love, Ellesime. It is surmised that this gem was intended to be used as the left eye. Whether or not it was used in the statue, there is a bounty for returning it to the proper authorities.~
 SAY IDENTIFIED_DESC ~An emerald is a brilliant green beryl, cleaved along straight box like lines, with rectangular cutting in the finished gem.  Emeralds are often connected with health, and so are used ornamentally for such a purpose. This emerald is marked with a small 'L'. It had been stolen by Prism for his use in a statue of his lady love, Ellesime. It is surmised that this gem was intended to be used as the left eye. Whether or not it was used in the statue, there is a bounty for returning it to the proper authorities.~
BUT_ONLY_IF_IT_CHANGES

//create right eye emerald
COPY_EXISTING ~misc43.itm~ ~override/abgfEyeR.itm~
 SAY UNIDENTIFIED_DESC ~An emerald is a brilliant green beryl, cleaved along straight box like lines, with rectangular cutting in the finished gem.  Emeralds are often connected with health, and so are used ornamentally for such a purpose. This emerald is marked with a small 'R'. It had been stolen by Prism for his use in a statue of his lady love, Ellesime. It is surmised that this gem was intended to be used as the right eye. Whether or not it was used in the statue, there is a bounty for returning it to the proper authorities.~
 SAY IDENTIFIED_DESC ~An emerald is a brilliant green beryl, cleaved along straight box like lines, with rectangular cutting in the finished gem.  Emeralds are often connected with health, and so are used ornamentally for such a purpose. This emerald is marked with a small 'R'. It had been stolen by Prism for his use in a statue of his lady love, Ellesime. It is surmised that this gem was intended to be used as the right eye. Whether or not it was used in the statue, there is a bounty for returning it to the proper authorities.~
BUT_ONLY_IF_IT_CHANGES

//change the emeralds that prism carries
COPY_EXISTING ~prism.cre~ ~override~
 REMOVE_CRE_ITEM ~misc43~
 REPLACE_CRE_ITEM ~abgfEyeL~ #1 #0 #0 ~identified~ ~qitem1~
 REPLACE_CRE_ITEM ~abgfEyeR~ #1 #0 #0 ~identified~ ~qitem2~
BUT_ONLY_IF_IT_CHANGES

//compile the dialog changes to oublek and prism
COMPILE ~bgfixpack/files/oublek/oublek.d~

//check existance of area script and add rep penalty for taking gems from statue
COPY_EXISTING ~ar5400.are~ ~override~
 READ_ASCII 0x94 ~script~
 PATCH_IF (FILE_EXISTS_IN_GAME ~%script%~) BEGIN
  INNER_ACTION BEGIN
   EXTEND_BOTTOM ~%script%.bcs~ ~bgfixpack/files/oublek/ar5400.baf~ //add our stuff -- creates new if doesn't exist
  END
 END ELSE BEGIN
  WRITE_EVALUATED_ASCII 0x94 ~%SOURCE_RES%~
  READ_ASCII 0x94 ~script~
  INNER_ACTION BEGIN
   EXTEND_BOTTOM ~%script%.bcs~ ~bgfixpack/files/oublek/ar5400.baf~ //add our stuff -- creates new if doesn't exist
  END
 END
BUT_ONLY_IF_IT_CHANGES

//check existance of area script and add global sets to complete quest
COPY_EXISTING ~ar4800.are~ ~override~
 READ_ASCII 0x94 ~script~
 PATCH_IF (FILE_EXISTS_IN_GAME ~%script%~) BEGIN
  INNER_ACTION BEGIN
   EXTEND_BOTTOM ~%script%.bcs~ ~bgfixpack/files/oublek/ar4800.baf~ //add our stuff -- creates new if doesn't exist
  END
 END ELSE BEGIN
  WRITE_EVALUATED_ASCII 0x94 ~%SOURCE_RES%~
  READ_ASCII 0x94 ~script~
  INNER_ACTION BEGIN
   EXTEND_BOTTOM ~%script%.bcs~ ~bgfixpack/files/oublek/ar4800.baf~ //add our stuff -- creates new if doesn't exist
  END
 END
BUT_ONLY_IF_IT_CHANGES
Dialog changes
Code: [Select]
//changing from one item to two ensures that players can not take advantage of dropping one item and trying to get the full reward twice
REPLACE_TRANS_TRIGGER oublek BEGIN 9 END BEGIN 1 END ~PartyHasItem("MISC43")~ ~PartyHasItem("abgfEyeL")
PartyHasItem("abgfEyeR")~
REPLACE_TRANS_TRIGGER oublek BEGIN 9 END BEGIN 4 END ~!PartyHasItem("MISC43")~ ~!PartyHasItem("abgfEyeL")
!PartyHasItem("abgfEyeR")~
REPLACE_TRANS_TRIGGER oublek BEGIN 10 END BEGIN 9 END ~PartyHasItem("MISC43")~ ~PartyHasItem("abgfEyeL")
PartyHasItem("abgfEyeR")~
REPLACE_TRANS_TRIGGER oublek BEGIN 10 END BEGIN 5 END ~!PartyHasItem("MISC43")~ ~!PartyHasItem("abgfEyeL")
!PartyHasItem("abgfEyeR")~
REPLACE_TRANS_ACTION oublek BEGIN 14 END BEGIN 0 END ~TakePartyItem("MISC43")~ ~TakePartyItem("abgfEyeL")
TakePartyItem("abgfEyeR")~
ALTER_TRANS oublek BEGIN 4 END BEGIN 0 END BEGIN
 ACTION ~AddexperienceParty(200)
GivePartyGold(300)
TakePartyItem("abgfEyeL")
TakePartyItem("abgfEyeR")
SetGlobal("OublekBounty2","GLOBAL",1)~
END

//adding new states that give half the reward when only one item gets turned in
APPEND oublek
IF ~~ THEN BEGIN abLeftEye
  SAY ~One of the Emeralds! That will be a 150 gold bounty for you.  Be sure to bring the other if you should find it.~//this is custom text
  IF ~~ THEN DO ~AddexperienceParty(100)
GivePartyGold(150)
TakePartyItem("abgfEyeL")
SetGlobal("abgf_LeftEyeBounty","GLOBAL",1)~ EXIT
END
IF ~~ THEN BEGIN abRightEye
  SAY ~One of the Emeralds! That will be a 150 gold bounty for you.  Be sure to bring the other if you should find it.~//this is custom text
  IF ~~ THEN DO ~AddexperienceParty(100)
GivePartyGold(150)
TakePartyItem("abgfEyeR")
SetGlobal("abgf_RightEyeBounty","GLOBAL",1)~ EXIT
END
IF ~~ THEN BEGIN abLeftEyeLast
  SAY ~The last of the Emeralds! That will be another 150 gold bounty for you. Well, you'll make quite a name for yourself among the bounty hunters if you keep this up.  Whether it is for better or worse, I do not know.~//this is custom text
  IF ~~ THEN DO ~AddexperienceParty(100)
GivePartyGold(150)
TakePartyItem("abgfEyeL")
SetGlobal("abgf_LeftEyeBounty","GLOBAL",1)~ EXIT
END
IF ~~ THEN BEGIN abRightEyeLast
  SAY ~The last of the Emeralds! That will be another 150 gold bounty for you. Well, you'll make quite a name for yourself among the bounty hunters if you keep this up.  Whether it is for better or worse, I do not know.~//this is custom text
  IF ~~ THEN DO ~AddexperienceParty(100)
GivePartyGold(150)
TakePartyItem("abgfEyeR")
SetGlobal("abgf_RightEyeBounty","GLOBAL",1)~ EXIT
END

END //end the append

//adding additional transitions that allow the player to turn in only one of the two required items for good boy
EXTEND_BOTTOM oublek 9
IF ~PartyHasItem("abgfEyeL")
!PartyHasItem("abgfEyeR")
Global("abgf_LeftEyeBounty","GLOBAL",0)
Global("abgf_RightEyeBounty","GLOBAL",0)~ THEN REPLY ~I've come to turn in a bounty, and collect the reward that is duly mine.~ GOTO abLeftEye
IF ~!PartyHasItem("abgfEyeL")
PartyHasItem("abgfEyeR")
Global("abgf_LeftEyeBounty","GLOBAL",0)
Global("abgf_RightEyeBounty","GLOBAL",0)~ THEN REPLY ~I've come to turn in a bounty, and collect the reward that is duly mine.~ GOTO abRightEye
IF ~PartyHasItem("abgfEyeL")
!PartyHasItem("abgfEyeR")
Global("abgf_RightEyeBounty","GLOBAL",1)~ THEN REPLY ~I've come to turn in a bounty, and collect the reward that is duly mine.~ GOTO abLeftEyeLast
IF ~!PartyHasItem("abgfEyeL")
PartyHasItem("abgfEyeR")
Global("abgf_LeftEyeBounty","GLOBAL",1)~ THEN REPLY ~I've come to turn in a bounty, and collect the reward that is duly mine.~ GOTO abRightEyeLast
END //end the extend bottom

//adding additional transitions that continue to keep 'bad boy' player from getting full reward. If they turn in only one gem, they get rewarded but can't turn in the other or resolve brage issue with oublek. It is an overall punishment when compared to 'good boy' rewards.
EXTEND_BOTTOM oublek 10
IF ~PartyHasItem("abgfEyeL")
!PartyHasItem("abgfEyeR")~ THEN REPLY ~I've come to turn in a bounty, and collect the reward that is duly mine.~ GOTO 14
IF ~!PartyHasItem("abgfEyeL")
PartyHasItem("abgfEyeR")~ THEN REPLY ~I've come to turn in a bounty, and collect the reward that is duly mine.~ GOTO 14
END //end the extend bottom

//adjustments needed for prism to work with the rest of the component
ADD_STATE_TRIGGER prism 0 ~HasItem("abgfEyeL",Myself)
HasItem("abgfEyeR",Myself)~
REPLACE_TRANS_ACTION ~PRISM~ BEGIN 7 END BEGIN 0 END ~DropInventory()~
~DestroyItem("abgfEyeL")
DestroyItem("abgfEyeR")
ActionOverride("A6StatueRightEye",CreateItem("abgfEyeL",1,0,0))
ActionOverride("A6StatueLeftEye",CreateItem("abgfEyeR",1,0,0))
SetGlobal("abgf_GemInEyeL","GLOBAL",1)
SetGlobal("abgf_GemInEyeR","GLOBAL",1)~ //1 means they are in the container and penalties for taking them out of 'statue' apply
REPLACE_TRANS_ACTION prism BEGIN 9 END BEGIN 0 END ~GiveItem("MISC43","GREYWOLF")~
~GiveItem("abgfEyeL","GREYWOLF")
GiveItem("abgfEyeR","GREYWOLF")
SetGlobal("abgf_GemInEyeL","GLOBAL",2)
SetGlobal("abgf_GemInEyeR","GLOBAL",2)~ //anything not one means that either the gems were not in container when obtained OR the penalty was applied
//only way to get items if player allowed greywolf to attack prism is to attack greywolf before prism is dead and hopefully kill him before he runs away.
APPEND prism
IF ~NumTimesTalkedTo(0)
!HasItem("abgfEyeL",Myself)
!HasItem("abgfEyeR",Myself)
PartyHasItem("abgfEyeL")
PartyHasItem("abgfEyeR")
Global("ab_GemStoleResolve","GLOBAL",0)~ THEN BEGIN abBothStole
 SAY ~My Emeralds! You! You took them! I must have them back. I need them to finish this epiphany. Please, please return them. I will give you all else that is mine.~
  IF ~~ THEN REPLY #4750 DO ~SetGlobal("ab_GemStoleResolve","GLOBAL",1)~ GOTO abRelent
  IF ~~ THEN REPLY #4751 DO ~SetGlobal("ab_GemStoleResolve","GLOBAL",1)~ GOTO 3
END
IF ~~ THEN BEGIN abRelent
  SAY #678
  IF ~~ THEN DO ~TakePartyItem("abgfEyeL")
TakePartyItem("abgfEyeR")
CreateCreature("GREYWO",[1267.2579],0)
ClearAllActions()
StartCutSceneMode()
StartCutScene("Prismcut")~ EXIT
END
IF ~NumTimesTalkedTo(0)
HasItem("abgfEyeL",Myself)
!HasItem("abgfEyeR",Myself)
PartyHasItem("abgfEyeR")
Global("ab_GemStoleResolve","GLOBAL",0)~ THEN BEGIN abRightStole
 SAY ~My Emerald! You! You took it! I must have it back. I need it to finish this epiphany. Please, please return it. I will give you all else that is mine.~
  IF ~~ THEN REPLY #4750 DO ~SetGlobal("ab_GemStoleResolve","GLOBAL",1)~ GOTO abRelent
  IF ~~ THEN REPLY #4751 DO ~SetGlobal("ab_GemStoleResolve","GLOBAL",1)~ GOTO 3
END
IF ~NumTimesTalkedTo(0)
!HasItem("abgfEyeL",Myself)
HasItem("abgfEyeR",Myself)
PartyHasItem("abgfEyeL")
Global("ab_GemStoleResolve","GLOBAL",0)~ THEN BEGIN abLeftStole
 SAY ~My Emerald! You! You took it! I must have it back. I need it to finish this epiphany. Please, please return it. I will give you all else that is mine.~
  IF ~~ THEN REPLY #4750 DO ~SetGlobal("ab_GemStoleResolve","GLOBAL",1)~ GOTO abRelent
  IF ~~ THEN REPLY #4751 DO ~SetGlobal("ab_GemStoleResolve","GLOBAL",1)~ GOTO 3
END
IF ~NumTimesTalkedTo(0)
!HasItem("abgfEyeL",Myself)
!HasItem("abgfEyeR",Myself)
!PartyHasItem("abgfEyeL")
!PartyHasItem("abgfEyeR")
Global("ab_GemStoleResolve","GLOBAL",0)~ THEN BEGIN abBothStoleButGone
 SAY ~My Emeralds! You! You took them! I must have them back. I need them to finish this epiphany. Please, please return them. I will give you all else that is mine.~
  IF ~Global("OublekBounty2","GLOBAL",1)~ THEN REPLY ~They are gone. Given to the authorities. You will never finish that lump of stone now.~ DO ~SetGlobal("ab_GemStoleResolve","GLOBAL",1)~ GOTO 8
  IF ~Global("OublekBounty2","GLOBAL",0)~ THEN REPLY ~They are gone. Sold by now to hang on the neck as some fat woman's trinket.~ DO ~SetGlobal("ab_GemStoleResolve","GLOBAL",1)~ GOTO 8
END
END//end the append
Script changes
ar5400
Code: [Select]
IF
PartyHasItem("abgfEyeL")
Global("abgf_GemInEyeL","GLOBAL",1)
THEN
RESPONSE #100
  SetGlobal("abgf_GemInEyeL","GLOBAL",2)
  ReputationInc(-1)
  AddJournalEntry(~Perhaps it was wrong, but we took the emerald from the left eye of the late Prism's final masterpiece. It should bring a hefty price at the right place or a decent reward...~)
END

IF
PartyHasItem("abgfEyeR")
Global("abgf_GemInEyeR","GLOBAL",1)
THEN
RESPONSE #100
  SetGlobal("abgf_GemInEyeR","GLOBAL",2)
  ReputationInc(-1)
  AddJournalEntry(~Perhaps it was wrong, but we took the emerald from the right eye of the late Prism's final masterpiece. It should bring a hefty price at the right place or a decent reward...~)
END
ar4800
Code: [Select]
IF
Global("abgf_LeftEyeBounty","GLOBAL",1)
Global("abgf_RightEyeBounty","GLOBAL",1)
Global("OublekBounty2","GLOBAL",0)
THEN
RESPONSE #100
  SetGlobal("OublekBounty2","GLOBAL",1)
  AddJournalEntry(~Prism's story was a sad tale indeed.  A shame it could not have had a better ending.  Ah well, I profit in the end.  300 gold bounty for the emeralds he stole.~)
END

that should be everything (I hope)
empty containers made,
2 unique items made,
adjustments to Oublek to recognize the 2 items. can turn in just one and get half the reward (if you claimed to be greywolf in the beginning and turn in just one, well you may be screwed on turning in the 2nd)
adjustment to Prism to have him transfer the gems to the statue if you let him finish, he responds if you talk to him after stealing the gems from him
script blocks to add journal entry and rep reduction for taking the gems out of the statue after having let Prism finish.
script block in nashkel area to add journal entry once both emeralds have been turned in.
AND fixpack was adjusted to only prevent the exploit despite how many of the original item the player has so... no need to revert/replace the oublek.dlg file

EDIT: one state for changing the original single item to the unique 2 items was missed.  proper code added above into the dialog change file
« Last Edit: February 07, 2012, 01:54:28 PM by plainab »
My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altherin.webs.com

Offline jastey

  • Moderator
  • Planewalker
  • *****
  • Posts: 1136
  • Gender: Female
Re: Offering new component for UB
« Reply #7 on: February 13, 2012, 01:33:53 AM »
Great, thanks! Would this code work for Tutu and BGT, too? Because BG1UB requires compatibility with all platforms.

Offline plainab

  • Sasha al'Therin
  • Planewalker
  • *****
  • Posts: 491
    • Infinity Engine Modding
Re: Offering new component for UB
« Reply #8 on: February 13, 2012, 10:33:16 AM »
Great, thanks! Would this code work for Tutu and BGT, too? Because BG1UB requires compatibility with all platforms.
not in its current state no

the methods of making things compatible between the 3 set ups has always confused and eluded me plus I'm sure those methods have evolved since this was originally developed.

while i have some EasyTutu installs that I could perhaps work with, BGT is another story.  I'm not even sure if what I managed to get to go works or is even considered BGT.  Its all unclear to me, BGT, BWP, BWS, MegaMod.  SHS has it all kind of blending together.  *confusing*

so feel free to adapt it to other platforms
My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altherin.webs.com

Offline Salk

  • Planewalker
  • *****
  • Posts: 832
Re: Offering new component for UB
« Reply #9 on: February 13, 2012, 11:09:12 PM »
I wish I could be of help with you in this, jastey but I simply can't.

This code in the present state is useless for BG1 UB because it is a mod that cover all three platforms (BG, (Easy)TuTu and BGT). Perhaps Miloch can lend a hand here.

Offline plainab

  • Sasha al'Therin
  • Planewalker
  • *****
  • Posts: 491
    • Infinity Engine Modding
Re: Offering new component for UB
« Reply #10 on: February 13, 2012, 11:57:07 PM »
If someone can give an example on how to make a simple patch compatible with all the platforms...

and then provide the different file names needed for EasyTutu & BGT

I could probably adapt it  BUT someone else would have to test the install and functionality simply because the BG2 engine does things differently and those conversions could have had adjustments made which would/could affect things.

Game resource files used:
ar4800.bcs
ar5400.bcs
prism.dlg
oublek.dlg
ar4800.are
ar5400.are
prism.cre
misc43.itm (it's only copied not modified -- so if the BG2 version is present & identical then that could used)

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altherin.webs.com

Offline hook71

  • Planewalker
  • *****
  • Posts: 61
  • Gender: Male
Re: Offering new component for UB
« Reply #11 on: February 14, 2012, 12:58:55 AM »
I can test the BGT version of the component.

For BGT the files would be:
ar4800.bcs -> AR3700.BCS
ar5400.bcs -> AR4400.BCS
prism.dlg -> PRISM.DLG
oublek.dlg -> OUBLEK.DLG
ar4800.are -> AR3700.ARE
ar5400.are -> AR4400.ARE
prism.cre -> PRISM.CRE
misc43.itm -> MISC43.ITM (present and identical)

The header "Prism, the emerald thief." should be added to the journal entries for BGT. EraseJournalEntries() would need to be added/modified as Oublek hands out the rewards as well.

Looking at the OUBLEK.DLG file in Near Infinity I think BGT works like this currently:
BGT has a SetGlobal("OublekBounty2","GLOBAL",1) set when completing the mission. You only need to have one of the emeralds in your inventory for the reward in BGT but the quest can't be repeated due to the Global.

Offline Wisp

  • Planewalker
  • *****
  • Posts: 806
Re: Offering new component for UB
« Reply #12 on: February 14, 2012, 04:32:40 AM »
For Tutu the areas need an s/ar/fw/ substitution and the other resources need an underscore prepended. If the resref is already 8 characters long Tutu overwrites the first character with the underscore.

For BGT you need to look up the BGT area equivalents and make sure none of the other resources are renamed by BGT (none are, in this case).

Offline Miloch

  • Barbarian
  • Planewalker
  • *****
  • Posts: 1030
  • Gender: Male
Re: Offering new component for UB
« Reply #13 on: February 14, 2012, 08:52:18 AM »
The BG1, Tutu and BGT area equivalents are all in the IESDP. Just assign a variable to the area name and use that when you refer to it. UB already does this IIRC, though it uses some pretty long-winded variables for some areas (would be easier to reference if it just used the BG1 area source_res for the variable name or something).

Offline plainab

  • Sasha al'Therin
  • Planewalker
  • *****
  • Posts: 491
    • Infinity Engine Modding
Re: Offering new component for UB
« Reply #14 on: February 14, 2012, 10:13:32 AM »
Quote
Looking at the OUBLEK.DLG file in Near Infinity I think BGT works like this currently:
BGT has a SetGlobal("OublekBounty2","GLOBAL",1) set when completing the mission. You only need to have one of the emeralds in your inventory for the reward in BGT but the quest can't be repeated due to the Global.
FYI the exploit may have been fixed in BGT.  Original file lacks a check for the global on the state(s) leading up to turning in the emerald, hence being able to get the reward multiple times.


thanks for the file name information...

The big thing needed tho is how one determines which platform is being installed upon.  Would GAME_IS suffice or is there a better method?

EDIT:  This seems to work for BG/BG:ToTSC
Code: [Select]
ACTION_IF (GAME_IS ~bgt~) THEN BEGIN
OUTER_SPRINT area0001 ~ar4400~
OUTER_SPRINT area0002 ~ar3700~
OUTER_SPRINT cre0001  ~prism~
OUTER_SPRINT item0001 ~misc43~
OUTER_SPRINT dia0001  ~oublek~
OUTER_SPRINT dia0002  ~prism~
END
ACTION_IF (GAME_IS ~tutu tutu_totsc~) THEN BEGIN
OUTER_SPRINT area0001 ~fw5400~
OUTER_SPRINT area0002 ~fw4800~
OUTER_SPRINT cre0001  ~_prism~
OUTER_SPRINT item0001 ~_misc43~
OUTER_SPRINT dia0001  ~_oublek~
OUTER_SPRINT dia0002  ~_prism~
END
ACTION_IF (GAME_IS ~bg1 totsc~) THEN BEGIN
OUTER_SPRINT area0001 ~ar5400~
OUTER_SPRINT area0002 ~ar4800~
OUTER_SPRINT cre0001  ~prism~
OUTER_SPRINT item0001 ~misc43~
OUTER_SPRINT dia0001  ~oublek~
OUTER_SPRINT dia0002  ~prism~
END
« Last Edit: February 14, 2012, 11:04:21 AM by plainab »
My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altherin.webs.com

Offline plainab

  • Sasha al'Therin
  • Planewalker
  • *****
  • Posts: 491
    • Infinity Engine Modding
Re: Offering new component for UB
« Reply #15 on: February 14, 2012, 11:11:59 AM »
Quote
The header "Prism, the emerald thief." should be added to the journal entries for BGT. EraseJournalEntries() would need to be added/modified as Oublek hands out the rewards as well.
more bg2 funkiness?  why?  that means a whole other file doesn't it?

no.  that's too far.  if it can't be done in BG/BG:ToTSC then its not going to be included by me.  that would have to be something added in by the UB team.
My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altherin.webs.com

Offline Miloch

  • Barbarian
  • Planewalker
  • *****
  • Posts: 1030
  • Gender: Male
Re: Offering new component for UB
« Reply #16 on: February 14, 2012, 11:18:28 AM »
GAME_IS is fine for detecting platforms. It basically does an FILE_EXISTS_IN_GAME ~some_game-specific_area.are~.

You don't need to define variables for each CRE etc., just each area, and UB already has them defined in some library - might as well use those. The underscore (or lack of it) is something like %tutu_var% so %tutu_var%prism will work for all versions of Prism, and so on.

It wouldn't surprise me if Ascension64 fixed all the things he considered actual fixes, since he wrote the code for this originally, and at the time anyway, was providing fixes both ways (from BGT to the BG1 Fixpack and vice-versa).

BG2 (Tutu/BGT) uses labels for journal entries, and separate sections for solved, unsolved and so on. BG1 does not use labels and only has one section for journal entries regardless of their status. But jastey can probably figure that part out as she has a lot of experience there.

Offline jastey

  • Moderator
  • Planewalker
  • *****
  • Posts: 1136
  • Gender: Female
Re: Offering new component for UB
« Reply #17 on: February 14, 2012, 01:45:42 PM »
Sorry, plainab, I know that BG1 is your game. I didn't mean to annoy you with Tutu/BGT compatibilty. I can cover game detection, the different area/script/whatever names, and also the journal entries for all installs.

What I was referring to was the compatibility of the actual area patching. I don't know how to do that and I know I won't in any near future, so that is what someone with experience in area-patching and BGT/Tutu (BGII engine) would be very welcome to provide for me, if it cannot be assuemd to be the same for BG1 and Tutu/BGT.

Offline plainab

  • Sasha al'Therin
  • Planewalker
  • *****
  • Posts: 491
    • Infinity Engine Modding
Re: Offering new component for UB
« Reply #18 on: February 14, 2012, 02:42:34 PM »
Sorry, plainab, I know that BG1 is your game. I didn't mean to annoy you with Tutu/BGT compatibilty. I can cover game detection, the different area/script/whatever names, and also the journal entries for all installs.

What I was referring to was the compatibility of the actual area patching. I don't know how to do that and I know I won't in any near future, so that is what someone with experience in area-patching and BGT/Tutu (BGII engine) would be very welcome to provide for me, if it cannot be assuemd to be the same for BG1 and Tutu/BGT.
area structure between BG & BG2 is identical with the exception of map notes and those are tacked onto the end of the area file.  So unless the area itself has undergone major changes during the conversion process, simply changing the file name(s) as needed should work.
My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altherin.webs.com

Offline jastey

  • Moderator
  • Planewalker
  • *****
  • Posts: 1136
  • Gender: Female
Re: Offering new component for UB
« Reply #19 on: February 14, 2012, 03:02:25 PM »
Cool. I hope I will be able to make a package out of this the coming week.

plainab, in case you have an installable package of what you posted above, I would appreciate having it. Thank you for your work!

Offline jastey

  • Moderator
  • Planewalker
  • *****
  • Posts: 1136
  • Gender: Female
Re: Offering new component for UB
« Reply #20 on: February 19, 2012, 01:59:01 PM »
plainab: I don't see why there should be a rep loss of two if the emeralds are taken out of the statue. I would like to stick to the original game where there is no rep loss. Where would it come from? Prism was a lunatic and thief (to the common people). Plus, he is dead at that time.

Also I am considering adding to Prism's dialogue a path for a LG character. All there is in the original game is "yes, I will let you use the stolen emeralds" or "I will let the bounty hunter kill you" or "I want to collect the bounty myself".

Offline jastey

  • Moderator
  • Planewalker
  • *****
  • Posts: 1136
  • Gender: Female
Re: Offering new component for UB
« Reply #21 on: February 19, 2012, 02:53:59 PM »
Unfortunately, what I experienced before with CreateItem for containers is true here, too: In original BG1, the emeralds land on the floor, in front of the statue.

How would a possible solution without the CreateItem look like? Put gemeralds into the eyes of the statue from the start with a lock difficulty of 100% (so the player really cannot get to them since they aren't there yet, officially) and change the lock difficulty via script when Prism puts his gems "in"?
« Last Edit: February 19, 2012, 02:59:34 PM by jastey »

Offline Salk

  • Planewalker
  • *****
  • Posts: 832
Re: Offering new component for UB
« Reply #22 on: February 19, 2012, 11:40:01 PM »
As I replied at G3, I do believe the reputation loss makes sense but 1 might be enough.

Taking the emeralds off the statue's eyes is a rather callous action, considering that Prism was not really a lunatic but an artist that devoted his life to the creation of that statue. And this is especially true if the player sided with Prism, whose dying wish was to have his statue completed (and implicitly untouched).

I don't believe any additional dialogue choices are needed instead.
« Last Edit: February 19, 2012, 11:41:53 PM by Salk »

Offline jastey

  • Moderator
  • Planewalker
  • *****
  • Posts: 1136
  • Gender: Female
Re: Offering new component for UB
« Reply #23 on: February 20, 2012, 06:23:59 AM »
(As I pointed out in the (hidden) thread at G3,) I don't see where the rep loss would come from. Reputation increases / losses in BG1 are gained from interaction with people, assuming they talk about it later. It's not a punishment for unmorale behaviour per se. Since Prism is dead ,there is no-one who witnesses and judges the situation. Considering the emeralds were stolen, the PC might rather gain a rep increase upon returning them.

You say that you don't see a need for additional reply options: Do you mean my suggestion to add a line for a LG character who wants to return the emeralds? I don't see how a LG character is to act correctly. Being LG, returning the stolen gems should be his highest interest. Currently, he has only the chance to get them by saying that he wants to collect the bounty, which is most probably not what a paladin would say.

I could even imagine more oprions in this: Tell Oublek where the stolen emeralds are so he can collect them himself (if Prism put them in the statue), OR offer to pay for them, so Prism has his peace (since he is dead after the first meeting, this way they could remain in the statue).
If there will be a rep loss for taking them out, there has to be another way of solving the quest.


Offline jastey

  • Moderator
  • Planewalker
  • *****
  • Posts: 1136
  • Gender: Female
Re: Offering new component for UB
« Reply #24 on: February 20, 2012, 06:42:27 AM »
To the mentioned "CreateItem" problem for BG1: Ascension64 already coded a solution for containers that will be activated during the quest, albeit for BGT (BGII-engine). I have to see whether this could be used for BG1.

The gem handling and container setting as offered by plainab could be used for BGT/Tutu without changes.

 

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)?: