Jump to content

[QUESTION] Weidu SAY 0xDE


a.greene

Recommended Posts

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

Link to comment

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 */

 

Link to comment

@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

 

Link to comment

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~

 

Link to comment
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.

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...