Jump to content

Looking for help with a piece of code


Recommended Posts

This bit of code is supposed to add a cure, Cure Disease (SPPR317), to temples, if they don't already have it. But it ends up messing STO files up. Does anyone see a problem? I'll credit you in my mod.

PATCH_IF (("%flags%" BAND 0b00010000) = 0b00010000) BEGIN
  READ_LONG 0x70 "cure_off"  ELSE 0
  READ_LONG 0x74 "cure_num"  ELSE 0
  SET "sppr317" = 0 // cure light wounds
    // check if cures already available
  FOR (index = 0; index < cure_num; index = index + 1) BEGIN
    READ_ASCII ("%cure_off%" + ("%index%" * 0x0c)) "resref"
    PATCH_IF ("%resref%" STRING_COMPARE_CASE "sppr317" = 0) BEGIN
      SET "sppr317" = 1
  // add cures if not already present
  PATCH_IF ("%sppr317%" = 0) BEGIN // if cure not already available
    INSERT_BYTES  ("%cure_off%" +        ("%cure_num%" * 0x0c)) 0x0c
      WRITE_ASCII ("%cure_off%" +        ("%cure_num%" * 0x0c)) ~sppr317~ // resref
      WRITE_LONG  ("%cure_off%" + 0x08 + ("%cure_num%" * 0x0c)) 200        // price


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.

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...