Jump to content

Patching spells to use a resource


temnix

Recommended Posts

I would like to patch all spells that use the Play Sound effect and play a particular sound so that they use a different sound. I have an "alter effect" function in my mod:

COPY_EXISTING_REGEXP GLOB ~.*\.SPL~ ~override~

LPF ~ALTER_EFFECT~ INT_VAR match_opcode = 174 STR_VAR match_resource = ~EFF_M02~ resource = ~EFFM02_#~ END
BUT_ONLY

This should go through all of the spells and change them on a match, but Weidu gives me warnings because there are many spells that don't match and aren't changed as a result. How do I direct Weidu to only look at spells with that combination?

Link to post
3 hours ago, temnix said:

COPY_EXISTING_REGEXP GLOB ~.*\.SPL~ ~override~

You will want to at least use this structure:

COPY_EXISTING_REGEXP GLOB ~^.+\.spl$~ ~override~
  PATCH_IF (SOURCE_SIZE > 0x113) THEN BEGIN		// protects against invalid files
...
END

 

Link to post
COPY_EXISTING_REGEXP GLOB ~.*\.SPL~ ~override~

PATCH_IF (SOURCE_SIZE > 0x113) THEN BEGIN		// protects against invalid files
  LPF ~ALTER_EFFECT~ INT_VAR match_opcode = 174 silent = 1 STR_VAR match_resource = ~EFF_M02~ resource = ~EFFM02_#~ END
END
BUT_ONLY 

Per the WeiDU readme you can use the "silent = 1" int var to suppress messages when you know they're only happening due to spells lacking the opcode you're trying to alter.

Edited by Endurium
Link to post
1 hour ago, Endurium said:

COPY_EXISTING_REGEXP GLOB ~.*\.SPL~ ~override~

PATCH_IF (SOURCE_SIZE > 0x113) THEN BEGIN		// protects against invalid files
  LPF ~ALTER_EFFECT~ INT_VAR match_opcode = 174 silent = 1 STR_VAR match_resource = ~EFF_M02~ resource = ~EFFM02_#~ END
END
BUT_ONLY 

Per the WeiDU readme you can use the "silent = 1" int var to suppress messages when you know they're only happening due to spells lacking the opcode you're trying to alter.

Excellent! Will try.

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