Jump to content

Global script to change a wand's charge abilities based on who wields it


Recommended Posts

I would like to create a quick item (e.g. wand) which will have a specific charge ability based on the character's class. For example, if a priest equips the wand, the ability could be "Cure Light Wounds"; if a mage equips the wand, the ability could be "Magic Missile".

How would one create a global script that's tied to the item?

I noticed there is the "BALDUR.BCS" file which has a lot of global variables, would this be the best place to store the logic (if the logic is indeed possible)?

Link to comment

CheckItemSlot() triggers and TransformItem() actions to swap out different versions of your item based on class. I don't see any way to do it based on a single ITM. One block for each combination of ITM and player number.

What's the point of baldur.bcs? It's a script that's always active in the BG1 and SoA campaigns, and it's the only such script. For SoD, bdbaldur.bcs fills that role. For ToB, baldur25.bcs does.

Oddly, a self-targeted ability that varies based on the caster's class can be easily done with no scripting at all - opcode 326 for the win.

Link to comment

Really?

...

(checks IESDP)

Unlike opcode #146, when targeting Self or Original Caster, the resource is still cast on the ability target, not the caster.

Now that's convenient. OK, that's the best way to do it. Set up an ability targeting any creature, then the ability has several opcode 326 effects targeting self, each testing the caster's class and casting a spell on the original target if the class matches.

Link to comment

@jmerry@subtledoctor

Brilliant, the suggestion of using opcode 326 works (so many conditions to choose from...). Thank you both!

The last thing is to update the tooltip and icon dynamically using the CheckItemSlot() and TransformItem() functions as was suggested earlier. I'll do a search on this forum and see if there's any existing examples of using these functions and how the scripts should be activated.

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