Jump to content

Creating and setting new portrait icons for spells?


Recommended Posts

I have been working on correcting the way projectiles and portrait icons are set in my mod to be more compatible with other mods, and I have run into a snag.  I have been able to get all the projectiles working correctly, but the portrait icons are another story.  I'm sure its probably a syntax issue, but I havent been able to get past it.  I am hoping someone could look at the code below for one of my spells, and tell me what I am doing wrong with trying to alter opcode 142.  I referenced the IWDification mod for this, but what was done there doesn't seem to be working for me:

 

Quote

LAF cd_new_portrait_icon INT_VAR string = RESOLVE_STR_REF(@4000) STR_VAR bam_file = dtkshrdd RET icon END   // adding portrait icon for spell
COPY ~SoD2BG2_IU/spl/dtkshrdb.spl~ ~override~
LPF ALTER_SPELL_HEADER INT_VAR projectile = EVAL "%dtkshrod%" END
LPF ALTER_EFFECT INT_VAR match_opcode = 142 match_parameter2 = 94 parameter2 = icon END

 

Link to comment
2 hours ago, Daeros_Trollkiller said:

I have been working on correcting the way projectiles and portrait icons are set in my mod to be more compatible with other mods, and I have run into a snag.  I have been able to get all the projectiles working correctly, but the portrait icons are another story.  I'm sure its probably a syntax issue, but I havent been able to get past it.  I am hoping someone could look at the code below for one of my spells, and tell me what I am doing wrong with trying to alter opcode 142.  I referenced the IWDification mod for this, but what was done there doesn't seem to be working for me:

 

 

I'm not sure what might be wrong, but I do have working code. Let's see... Okay, I got help from Kjeron and Argent77 with is, so it is solid:

 

https://github.com/UnearthedArcana/B_Spells/blob/master/B_Spells/lib/fnp_new_spells.tpa#L870

 

Edit: I think this should also work in iwdee by now. I think the update I was waiting for has happened

Edited by Grammarsalad
Link to comment

Cam's documentation of cd_new_portrait_icon includes this tip:

On 1/2/2018 at 5:02 PM, CamDawg said:

As above, it returns 'icon' with the value of the new entry for usage in your spells or items, and you still need to copy your BAM.

Are you copying the BAM file to the override?

Edit: Regarding the ALTER_EFFECT function, based on the parameters provided, it will alter effects in the SPL that are using opcode 142 and have parameter 2 (icon) set to 94.  In the latest version of your mod, dtkshrdb.spl has a 142 effect with parameter 2 set to 204, so it won't match.

Edited by Mike1072
Link to comment

Mike, I figured it out about 30 seconds before reading this :) .  You were absolutely right, but it does pose another question:

 

Does it matter which number parameter 2 is set to on the effect I am changing?  By that, I mean would it mess up other portrait icons if the effect started with the portrait icon something common like confusion or stun?   I'm just wondering is there is a "best practice" here when it comes to setting the initial parameter to be changed by ALTER_EFFECT

 

 

Link to comment
26 minutes ago, Daeros_Trollkiller said:

Does it matter which number parameter 2 is set to on the effect I am changing?  By that, I mean would it mess up other portrait icons if the effect started with the portrait icon something common like confusion or stun?   I'm just wondering is there is a "best practice" here when it comes to setting the initial parameter to be changed by ALTER_EFFECT

The reason you might want to match on parameter 2 is if the resource (spl/itm/cre) has multiple 142 effects that display different icons.  It lets you target the effects that reference a specific icon and leave the effects that reference other icons alone.

If you are using it to modify your .spl file that has only a single 142 effect, you could get rid of match_parameter2 entirely.

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