Caedwyr Posted September 29, 2007 Share Posted September 29, 2007 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
igi Posted September 29, 2007 Share Posted September 29, 2007 Don't have 1 macro per level, instead store the level in a variable and read it from the macro - then you only need 1 macro, rather than 9. Link to comment
Caedwyr Posted September 29, 2007 Author Share Posted September 29, 2007 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
igi Posted September 29, 2007 Share Posted September 29, 2007 Set the variable to e.g. 1, then run the macro for all the spells you want to set to level 1. Then, set the variable to 2, and run the maco for all the spells you want to set to level 2. And so on... Link to comment
Caedwyr Posted October 1, 2007 Author Share Posted October 1, 2007 Are there any good examples of this that you could recommend? Link to comment
Guest erik Posted October 1, 2007 Share Posted October 1, 2007 Caedwyr: See my post in your other thread, I think that demonstrates igi's approach... Link to comment
igi Posted October 1, 2007 Share Posted October 1, 2007 The only macros I know are in my mods, though I am sure there are others. I know iiItem uses a macro with the same concepts (setting a variable, and using 1 macro to do things with that variable). Link to comment
Caedwyr Posted October 1, 2007 Author Share Posted October 1, 2007 Thanks, I'll take a look at that. Link to comment
Caedwyr Posted October 1, 2007 Author Share Posted October 1, 2007 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
Gort Posted October 2, 2007 Share Posted October 2, 2007 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
Caedwyr Posted October 2, 2007 Author Share Posted October 2, 2007 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
Gort Posted October 2, 2007 Share Posted October 2, 2007 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
Caedwyr Posted October 2, 2007 Author Share Posted October 2, 2007 Heh, that still doesn't tell me a whole lot. Its been about 6 years since I did any sort of serious programming so I've forgotten the distinctions/definitions or a patch versus an action. Link to comment
Gort Posted October 2, 2007 Share Posted October 2, 2007 patch is performed on file(s), action is performed by itself. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.