a.greene Posted November 28, 2022 Share Posted November 28, 2022 Good evening, I'm trying to create an item (tome) that when read will grant the reader 25,000 experience points. I have modelled it after the tome of leadership and influence replacing the charisma bonus with an XP bonus. I'm struggling to edit the effect Display String (139), I would like it to say '<CHARNAME> has gained 25,000 Experience.' Currently it returns 'no such index' I have attached the files for review, any assistance would be appreciated. BEGIN ~Tome~ ACTION_IF GAME_IS ~bgee~ THEN BEGIN ACTION_IF FILE_EXISTS_IN_GAME ~enginest.2da~ BEGIN ////////////////////////////////////// ITEMS /////////////////////////////////////// COPY ~Tome/Items/WA3BOOK.ITM~ ~override~ SAY NAME1 ~Book~ SAY NAME2 ~Tome of Experience~ SAY DESC ~Studying this tome teaches the reader skills and techniques never imagined possible. As if this isn't enough, the reader also gains 25,000 experience points. Unfortunately, the tome is consumed after a single use. STATISTICS: Experience: Raised by 25,000 points permanently Special: The book is consumed upon use Usage: Place into quick item slot Weight: 5~ SAY 0xDE ~<CHARNAME> has gained 25,000 Experience.~ END END Tome.zip Quote Link to comment
Jarno Mikkola Posted November 28, 2022 Share Posted November 28, 2022 (edited) SAY 0xDE Nope. that's not how... Try this: WRITE_ASCII 0xDE ~<CHARNAME> has gained 25,000 Experience.~ Edited November 28, 2022 by Jarno Mikkola Quote Link to comment
jmerry Posted November 28, 2022 Share Posted November 28, 2022 Definitely wrong, Jarno. Opcode 139 takes a string reference as a parameter, not a literal string. That write command would just create gibberish. As a matter of good practice, using hardcoded magic numbers to edit elements of structures several layers in is a bad idea. Functions are much easier to work with. In fact ... here's how I'd do it: COPY_EXISTING ~BOOK07.ITM~ ~override/WA3BOOK.ITM~ SAY NAME1 ~Book~ SAY NAME2 ~Tome of Experience~ SAY DESC ~Studying this tome teaches the reader skills and techniques never imagined possible. As if this isn't enough, the reader also gains 25,000 experience points. Unfortunately, the tome is consumed after a single use. STATISTICS: Experience: Raised by 25,000 points permanently Special: The book is consumed upon use Usage: Place into quick item slot Weight: 5~ /* I'd use @ references to a tra file, but literal strings still work */ LPF ALTER_ITEM_EFFECT INT_VAR match_opcode=6 new_opcode=104 parameter1=25000 parameter2=0 END /* Convert the charisma boost into an experience boost */ SET newref = RESOLVE_STR_REF (~<GABBER> has gained 25,000 Experience.~) /* <GABBER> instead of <CHARNAME>, as it doesn't have to be player 1 using the item. Not tested, though; I don't know whether that token works in this context. If it doesn't, I recommend using the passive-voice "25,000 experience gained" instead. */ LPF ALTER_ITEM_EFFECT INT_VAR match_opcode=139 parameter1=newref END /* Replace the old "Charisma increased by 1" text. */ IF_EXISTS /* This check isn't necessary, but I like to have something to close the COPY_EXISTING */ Quote Link to comment
Graion Dilach Posted November 28, 2022 Share Posted November 28, 2022 jmerry was faster, was typing the same pretty much; use RESOLVE_STR_REF then ALTER_EFFECT or ALTER_ITEM_EFFECT atleast for the practical benefit so that you don't have to recalculate offsets if you change/rearrange the opcodes. 0xDE was your op141's Target, that's why it failed though. Quote Link to comment
a.greene Posted November 28, 2022 Author Share Posted November 28, 2022 @Jarno Mikkola @jmerry @Graion Dilach Thank you. Quote Link to comment
a.greene Posted November 29, 2022 Author Share Posted November 29, 2022 @Jarno Mikkola @jmerry @Graion Dilach Follow up question if I may? How do I restrict installation of a component to a specific game for example BGEE vs BG2EE? I've been reviewing other mods and tried using REQUIRE_PREDICATE GAME IS ~bgee~ but that just returns an parse error Thank you in advance, any assistance would be appreciated. BACKUP ~Tome/Backup~ AUTHOR ~Greener~ VERSION ~1.0~ ////////////////////////////////////// BGEE //////////////////////////////////////// BEGIN ~Tome of Experience BGEE~ REQUIRE_PREDICATE GAME IS ~bgee~ COPY_EXISTING ~BOOK07.ITM~ ~override/WA3BOOK.ITM~ SAY NAME1 ~Book~ SAY NAME2 ~Tome of Experience~ SAY DESC ~Studying this tome teaches the reader skills and techniques never imagined possible. As if this isn't enough, the reader also gains 25,000 experience points. Unfortunately, the tome is consumed after a single use. STATISTICS: Experience: Raised by 25,000 points permanently Special: The book is consumed upon use Usage: Place into quick item slot Weight: 5~ LPF ALTER_ITEM_EFFECT INT_VAR match_opcode = 6 check_headers = 1 new_opcode = 104 parameter1 = 25000 parameter2 = 0 END SET newref = RESOLVE_STR_REF (~<GABBER>has gained 25,000 experience points.~) LPF ALTER_ITEM_EFFECT INT_VAR match_opcode = 139 check_headers = 1 parameter1 = newref END IF_EXISTS ////////////////////////////////////// BG2EE //////////////////////////////////////// BEGIN ~Tome of Experience BG2EE~ REQUIRE_PREDICATE GAME IS ~bg2ee~ COPY_EXISTING ~BOOK07.ITM~ ~override/WA3BOOK.ITM~ SAY NAME1 ~Book~ SAY NAME2 ~Tome of Experience~ SAY DESC ~Studying this tome teaches the reader skills and techniques never imagined possible. As if this isn't enough, the reader also gains 25,000 experience points. Unfortunately, the tome is consumed after a single use. STATISTICS: Experience: Raised by 250,000 points permanently Special: The book is consumed upon use Usage: Place into quick item slot Weight: 5~ LPF ALTER_ITEM_EFFECT INT_VAR match_opcode = 6 check_headers = 1 new_opcode = 104 parameter1 = 250000 parameter2 = 0 END SET newref = RESOLVE_STR_REF (~<GABBER>has gained 250,000 experience points.~) LPF ALTER_ITEM_EFFECT INT_VAR match_opcode = 139 check_headers = 1 parameter1 = newref END IF_EXISTS Quote Link to comment
jmerry Posted November 29, 2022 Share Posted November 29, 2022 REQUIRE_PREDICATE takes two arguments. The second is a string, used for the error message. So WeiDU reads that, sees COPY_EXISTING where a string should be, and chokes on the syntax error. Quick fix: replace REQUIRE_PREDICATE GAME IS ~bgee~ with something like REQUIRE_PREDICATE GAME IS ~bgee~ ~This component is only available for BGEE~ Quote Link to comment
a.greene Posted November 29, 2022 Author Share Posted November 29, 2022 29 minutes ago, jmerry said: REQUIRE_PREDICATE takes two arguments. The second is a string, used for the error message. So WeiDU reads that, sees COPY_EXISTING where a string should be, and chokes on the syntax error. Quick fix: replace REQUIRE_PREDICATE GAME IS ~bgee~ with something like REQUIRE_PREDICATE GAME IS ~bgee~ ~This component is only available for BGEE~ Thank you, I appreciate your patience and your response. Quote Link to comment
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.