Jump to content

Some macro/read/write questions


Caedwyr

Recommended Posts

Ok, I've read up on a couple of tutorials so let me know if I've got his right.

 

If I want to create a macro that will turn all spells it is applied to into level 1 wizard spells, then the following is what I need:

 

DEFINE_PATCH_MACRO ~divine_to_arcane1~ BEGIN

 WRITE_SHORT 0x1C 1						 // sets spell type to wizard (1)
 WRITE_LONG  0x34 [b]1[/b]						 // sets spell level to 1
 END

 

And to set it to different levels I just need to change the 1 at the end of the WRITE_SHORT after the offset to whatever wizard spell level I want it to become, correct (different macros for each level of spell)?

 

Do I need any sort of READ type commands?

Link to comment

My current macro I'm using is as follows:

 

DEFINE_PATCH_MACRO ~divine_to_arcane1~ BEGIN

 READ_LONG  0x64 "abil_off" ELSE 0
 READ_SHORT 0x68 "abil_num" ELSE 0
 WRITE_SHORT 0x1C 1						 // sets spell type to wizard (1)
 WRITE_LONG  0x34 1						 // sets spell level to 1
 FOR ( index = 0; index < abil_num; index = index + 1 ) BEGIN
WRITE_SHORT ("%abil_off%" + 0x02 + (0x28 * "%index%")) 1 // changes ability icon location to wizard (1) */
 END
END

 

The problem of just reading the level and storing it in a variable is that on some occasions I'll want to change the spell level. Is there any way to do this in a fancy manner, or might it be better to just apply those changes to those specific spells, or use multiple macros like I am currently doing?

Link to comment

Would the following code work as advertised:

 

DEFINE_PATCH_MACRO ~divine_to_arcane~ BEGIN

 READ_LONG  0x64 "abil_off" ELSE 0
 READ_SHORT 0x68 "abil_num" ELSE 0
 READ_LONG  0x34 "spell_level" ELSE 1
 WRITE_SHORT 0x1C 1						 // sets spell type to wizard (1)
 WRITE_LONG  0x34 "spell_level"						 // sets spell level to 1
 FOR ( index = 0; index < abil_num; index = index + 1 ) BEGIN
WRITE_SHORT ("%abil_off%" + 0x02 + (0x28 * "%index%")) 1 // changes ability icon location to wizard (1) */
 END
END

//Convert to level 1 wizard spells
BEGIN
 SET "spell_level" = 1
END

COPY_EXISTING ~SPPR103.spl~ ~override/CA#DS103.spl~ /*cure light wounds*/
					 ~SPPR104.spl~ ~override/CA#DS104.spl~ /*detect evil*/
					 ~SPPR105.spl~ ~override/CA#DS105.spl~ /*entangle*/
					 ~SPPR109.spl~ ~override/CA#DS109.spl~ /*Sanctuary*/
					 ~SPPR110.spl~ ~override/CA#DS110.spl~ /*shillelagh*/
 LAUNCH_PATCH_MACRO ~divine_to_arcane~  // change priest spells to wizard spells

//Convert to level 2 wizard spells
BEGIN
 SET "spell_level" = 2
END

COPY_EXISTING ~SPPR202.spl~ ~override/CA#DS202.spl~ /*Barkskin*/
					 ~SPPR204.spl~ ~override/CA#DS204.spl~ /*Charm Person or Mammal*/
					 ~SPPR206.spl~ ~override/CA#DS206.spl~ /*Flame Blade*/
					 ~SPPR207.spl~ ~override/CA#DS207.spl~ /*Goodberries*/
					 ~SPPR210.spl~ ~override/CA#DS210.spl~ /*Resist Fire and Cold*/
					 ~SPPR211.spl~ ~override/CA#DS211.spl~ /*Silence 15' Radius*/
					 ~SPPR212.spl~ ~override/CA#DS212.spl~ /*Slow Poison*/
 LAUNCH_PATCH_MACRO ~divine_to_arcane~  // change priest spells to wizard spells

 

etc, for whatever spell levels I want to adjust, or do I need to place the SET "spell_level" = # inside my macro somehow (coded differently for the same effect).

 

Looking at it, I'd think I'd need to define the variable as a LONG prior to using it, but I can't see any documentation on doing this in the Weidu Readme.

Link to comment

should work, I think. BTW, you can use

OUTER_SET "spell_level" = 2

instead of

BEGIN

SET "spell_level" = 2

END

 

Although I'm not sure how it will interact with game mechanics. Maybe all these spells will appear in sorcerer spell selection screen, suppressing original wizard spells.

Link to comment

I thought spells had to be in the SPWIXXX namespace to show up in the sorcerer spell selection screen. There are a lot of spells flagged as wizard spells that don't show up on the sorcerer spell selection list.

 

Also, what is the difference between using OUTER_SET and SET? The Weidu documentation doesn't make this clear.

Link to comment
I thought spells had to be in the SPWIXXX namespace to show up in the sorcerer spell selection screen. There are a lot of spells flagged as wizard spells that don't show up on the sorcerer spell selection list.

than that's okay. I just didn't work with it.

 

Also, what is the difference between using OUTER_SET and SET? The Weidu documentation doesn't make this clear.

OUTER_SET is an action, SET is a patch

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...