Kaedrin's Stuff and Companions

Maybe …

Or …

Bottom line: Skins/Hides for PCs do not work.

2 Likes

yes. and I believe there may be one more thread where i reproduced the bug :)

1 Like

@Lance_Botelle,

I read your comments related to skill increases effects leaving icons you didn’t want shown:

Thankfully, many of the ideas I had that involved using a skin can now be coded using new functions allowing us to directly alter attributes. One aspect that did still need consideration, however, was if a new feat altered a PC’s skills in some way. The problem is that while it is possible to alter PCs skills directly, the same process leaves small icons showing the changes as spell effects, which is not wanted.

I was able to remove the icons with the following code, you just need to find the icon number for skill increase:

        eSpellResistance = EffectSpellResistanceIncrease(maxItemSpellResistance);
        eSpellResistance = SupernaturalEffect(eSpellResistance);
        eSpellResistance = SetEffectSpellId(eSpellResistance, HENCH_SPELL_RESISTANCE_SPELL_ID);
        ApplyEffectToObject(DURATION_TYPE_PERMANENT, eSpellResistance, oTarget);
        // get rid of icon
		effect eIcon = EffectEffectIcon(41);	// spell resistance increase
		ApplyEffectToObject(DURATION_TYPE_INSTANT, eIcon, oTarget);
		RemoveEffect(oTarget, eIcon);

1 Like

@TonyK

what if the character has a SpellResistanceIncrease effect (eg) already, for which the icon should show to the player? Wouldn’t that code (potentially) remove a legit icon ?

1 Like

@kevL_s ,

It appears that it removes the last effect icon effect created and leaves others in place. I think the icon shown on the screen shows only one effect icon per type. I have not noticed it failing in the AI routine added to work around the spell resistance bug. I also experimented with other effect types in unreleased code and that seemed to work.

1 Like

@TonyK

(*) See edit below.

Yes, a few years later, I think I finally grasped this as a way of resolving that issue too, as I have a number of places where I now also use the SetEffectSpellId and EffectEffectIcon combination with good effect. Although, I have not yet replaced the “Skill Book” system with such yet, as that serves me in other ways. However, it has certainly helped me in a number of other system setups where certain conditions need more flexibility. E.g. AI on and off, lycanthropy, etc. As an example …

// PREPARE LYCANTHROPY EFFECT ICON
	effect eLYC = EffectEffectIcon(143); 
    eLYC = SetEffectSpellId(eLYC, SPELLID_LYCANTHROPY);  		
	eLYC = EffectLinkEffects(eLYC, SupernaturalEffect(EffectPolymorph(iFORM, TRUE)));

And removed using similar function calls as you mention here.

This was one of those moments of discovery that helped out a great deal. I’m not sure when I learned of it, but it was somewhere between that post of 2010 and a few years back now. :wink: It’s good to mention that again here though, as I had forgotten about it. I have used this method in around a dozen places now, and it seems pretty solid.

Like you say, it appears to me to be a fairly robust way of us being able to build an effect that is “boxed” into its own identity which we can then add or remove reasonably easily.

At least, I assume this is what you mean … :slight_smile:

(*) Edit: Actually, I just realized you were highlighting the removal of the icon here, so now I see what you meant. :+1: Good to know!

P.S. Every time I need to build a new one, I have to keep reminding myself how it is done. I.e. Edit the effecticons.2da etc. But once understood, it does add a great benefit for us as builders.

@kevL_s I thought this may have been something you helped me with once? I’ll see if I can find the original post where someone helped explain it to me. I mean I don’t recall it being something I figured myself. :thinking:

Yes, I think it was here you helped me … Scroll down a few posts.

I have not found this one yet, but I do recall you doing that.

1 Like

ok sounds good enough :)

i hope to try it out on some custom penalties i have …

 
@TonyK

Very interesting … your code wiped out an icon-of-type if its effect was applied as DURATION_TYPE_PERMANENT but not if it was applied as DURATION_TYPE_TEMPORARY …!

 
(console) code to apply the initial penalty →

// 'applyreflexdecr'
void main()
{
	object oTarget = GetPlayerCurrentTarget(OBJECT_SELF);
	if (GetIsObjectValid(oTarget) && GetObjectType(oTarget) == OBJECT_TYPE_CREATURE)
	{
		effect eReflexDecrease = EffectSavingThrowDecrease(SAVING_THROW_REFLEX, 3);
//			   eReflexDecrease = SupernaturalEffect(eReflexDecrease);
//			   eReflexDecrease = SetEffectSpellId(eReflexDecrease, -999);

//		ApplyEffectToObject(DURATION_TYPE_PERMANENT, eReflexDecrease, oTarget); // don't work
		ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eReflexDecrease, oTarget, 30.f); // works
	}
	else SendMessageToPC(GetFirstPC(FALSE), "applyreflexdecr : <c=red>Target a creature</c>");
}

and the code run on Equip/Unequip (after a 0.0 delay) →

		effect eReflexDecrease = EffectSavingThrowDecrease(SAVING_THROW_REFLEX, iAcp);
		eReflexDecrease = SupernaturalEffect(eReflexDecrease);
		eReflexDecrease = SetEffectSpellId(eReflexDecrease, SPELLID_REFLEX_PENALTY);

		ApplyEffectToObject(DURATION_TYPE_PERMANENT, eReflexDecrease, oPC);

		// Tony - get rid of icon
		effect eIcon = EffectEffectIcon(40); // SAVING_THROW_DECREASE
		ApplyEffectToObject(DURATION_TYPE_INSTANT, eIcon, oPC);
		RemoveEffect(oPC, eIcon);

/o.O

1 Like

@kevL_s

I suppose the icon removal is more useful for permanent effects anyway. For if the effect is only temporary, then the icon plays its part for the effect duration.

It’s good to know we can remove the icon on newly appointed permanent effects, as that effectively offers a new means to add “combined” permanent effects if I understand you correctly. Or does this only work if removing a single icon type at a time only? (See example where both an attribute and a skill boost icon may be present.)

So … just so I’m clear here, if it is only the icon that is removed by this method, and the effect otherwise left intact, is it still now possible to remove the new effect, or would the only way to remove it be to reverse the effect using a negative application?

E.g. We have a permanent “boon” effect we call “Lucky” that gives +1 to charisma and +1 to appraise. We apply the new “permanent” benefit and use this method to remove any icons.

Now can we still remove “Lucky” as its own single named group effect, or do we have to apply a new permanent negative effect with its own icon removal?

(Not at main computer.)

PS Are your “works” comments the right way around, as it sounds contradictory to your post?

@TonyK

EDIT: As you say … Pretty cool! I did a quick test with Spell Resistance, and casting the same spell between a permanent effect this method, and the icon did behave as desired. :slight_smile: I.e. It appeared when the scroll was cast and remained when applying the additional permanent award, and disappeared when its time was up, leaving the appropriate permanent 2 points I had selected. :+1: (I’m going to try with a couple of other scenarios with multiple icons.)

“don’t work” means … using Tony’s code to keep a pre-existing icon when an effect-for-which-you-don’t-want-to-apply-an-icon is applied doesn’t work, if the pre-existing icon’s effect is PERMANENT – the pre-existing icon got removed.
“works” means … a pre-existing icon remains visible as desired when an effect-for-which-you-don’t-want-to-apply-an-icon is applied, if the pre-existing icon’s effect is TEMPORARY.

/hope that made sense ;)

1 Like

I am trying to get my head around what you have written here and will answer in a bit … :grin: :thinking:

OK …

My brain is really slowing up lately :grimacing: … so let me try clearing my understanding this way …

What situation is there where an icon is present for a permanent effect? (This, I suppose, my main question.)

Because, I thought we wanted no icons for “permanent effects”, or what I would call “permanent adjustments”? At least, that was my understanding.

Or, let me try explaining my logic this way …

I thought by “worked” you meant the icon was not shown for a permanent effect (which is also what I understood as “working”). So when you say …

… That sounds like you also pointed out how it “worked” when applied permanently. But in your comments in the script, where you say …

… it is the other way around.

I’m just going to look into a mirror now, to see if that helps me reverse my logical understanding. :wink:

EDIT: Here is my working example, which I just tested again, which I believe may help explain …

    1. Used a lever to add a “permanent” +2 spell resistance to a PC, and used “no icon” code to ensure the permanent effect did not add an icon. “No icon: Worked.”
    1. Used Spell Resistance scroll on same PC and their SR increased and an icon (for the temporary spell duration) applied as expected. “Icon: Worked.”
    1. I passed time, and the icon went at spell end, and the SR dropped to the 2 permanent points without any icon present. “No icon: Worked.”

@Lance_Botelle ,

This idea works for removing multiple icons. I found the code that I worked on over a decade ago for multiple summons to rework how incorporeal effects are applied. I did various tests at the time dumping out all effects before and after and the effects were retained without the icons.

		effect eConceal = EffectConcealment(50, MISS_CHANCE_TYPE_NORMAL);
		effect eGhost = EffectCutsceneGhost();
		effect eImmuneToNonMagicWeapons = EffectDamageReduction(1000, DAMAGE_POWER_PLUS_ONE, 0, DR_TYPE_MAGICBONUS);
			
		eConceal = EffectLinkEffects(eConceal, eGhost);
		eConceal = EffectLinkEffects(eConceal, eImmuneToNonMagicWeapons);
		eConceal = ExtraordinaryEffect(eConceal);
		ApplyEffectToObject(DURATION_TYPE_PERMANENT, eConceal, OBJECT_SELF);
		
		int nDeflection = GetAbilityModifier(ABILITY_CHARISMA);
		if (nDeflection < 1)
		{
			nDeflection = 1;
		}
		effect eDeflectionBonus = EffectACIncrease(nDeflection, AC_DEFLECTION_BONUS);
		eDeflectionBonus = ExtraordinaryEffect(eDeflectionBonus);
		ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDeflectionBonus, OBJECT_SELF);
		
		// get rid of icons	
		effect eIcons = EffectEffectIcon(3);	// immunity
		eIcons = EffectLinkEffects(EffectEffectIcon(108), eIcons);	// concealment
		eIcons = EffectLinkEffects(EffectEffectIcon(35), eIcons);	// AC	
		ApplyEffectToObject(DURATION_TYPE_INSTANT, eIcons, OBJECT_SELF);
		RemoveEffect(OBJECT_SELF , eIcons);

This year I started to rework this code to fix incorporeal creatures in their spawn script - fixing lack of move silently skill, defection bonus instead of natural AC, and the icons not showing. I might add it as an optional thing to download as part of the AI.

2 Likes

@TonyK

That’s good to know! :+1:

So basically, we can just link the effect icons and remove them as a a set of linked icons in a similar manner.

I just did some testing of my own, and I was pleasantly surprised to find that this does still appear to work even when a temporary version is applied after a combined permanent, even without using SetEffectSpellId.

Neat! :slight_smile:

I tested setup of the initial permanent effect with …

effect eDeflectionBonus = EffectACIncrease(3, AC_DEFLECTION_BONUS);
		effect eSpellResistance = EffectSpellResistanceIncrease(2);
		eSpellResistance = EffectLinkEffects(eDeflectionBonus, eSpellResistance);
        eSpellResistance = SupernaturalEffect(eSpellResistance);
        //eSpellResistance = SetEffectSpellId(eSpellResistance, 1001);
        ApplyEffectToObject(DURATION_TYPE_PERMANENT, eSpellResistance, oPlayer);
        // get rid of icon
		effect eIcon = EffectEffectIcon(41);	// spell resistance increase
		eIcon = EffectLinkEffects(EffectEffectIcon(35), eIcon);	// AC Deflection	
		ApplyEffectToObject(DURATION_TYPE_INSTANT, eIcon, oPlayer);
		RemoveEffect(oPlayer, eIcon);

And then tested to see if this setup could be broken/exploited with this …

effect eDeflectionBonus = EffectACIncrease(1, AC_DEFLECTION_BONUS);
		eDeflectionBonus = ExtraordinaryEffect(eDeflectionBonus);
		ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDeflectionBonus, oPlayer, 3.0);

After the temporary effect was applied, it had its icon present for 3 secs, and then disappeared leaving the permanent effect in place without icons.

I also just tested with a temporary of 4 AC increase, and it applied the extra 1 for the 3 seconds and then dropped back to the permanent 3 without icon.

well, you see, i applied a permanent effect, for which I wanted to keep an icon visible. Then I applied another permanent effect (of the same type), for which I did not want to keep a visible icon. But unfortunately when the second effect was applied it wiped not only its own icon but the one I wanted to keep.

If, however, the first effect was applied as temporary, then applying the second effect indeed kept the original icon as desired.

Ah, so that is how I first understood it … I just removed an edit how I thought you may have otherwise meant it. :slight_smile:

So what situation do you have where you need a permanent icon for a permanent effect?

I.e. I thought icons would only want to be shown for temporary effects anyway?

none offhand. But it’s conceivable that an effect might be applied as permanent, but only be designed to be temporary. Such as if a builder applied a certain effect (as permanent) on entering an area, but for it to be removed on exiting that area. You might want the icon to stay visible (and not risk being removed) while in that area …

2 Likes

Ah, I see. :+1: Actually, I have that very situation in my module, and in this instance, I apply it as a permanent effect with a unique icon … But for such situations, I have also designed my own effect icons for that effect, so that accidental removal of the icon does not happen. So maybe that is the answer for such situations, i.e. We use our own effect icons for our special effect situations.

EDIT: We could, I suppose, also duplicate some icons, but give them our own effecticon row number so that we control its appearance that way too.

1 Like

@kevL_s ,
You could search effects for EFFECT_TYPE_EFFECT_ICON, permanent duration, and a matching icon using GetEffectInteger before applying the original effect. If matching, don’t remove the icon. Still wouldn’t work right if the first permanent effect was removed. I don’t see this as an important issue for spell resistance increase or the incorporeal effects.

@Lance_Botelle ,
I don’t think there are any issues with linked effects, the icons are simply removed with the other linked effects left in place. Adding test code to print out all of the effects should show this. This is how I tested, and I think how I found the icon ids. Still should get tested with whatever effect combination since this is a hack workaround.

I have not noticed or don’t remember the encumbrance icon issue. It’s possible that some other effect with the same icon id is applied and removed like in this workaround. You could try and see if it is shown in the effects list and add it back if needed.

2 Likes

This is the route I started down to fix it, but just ended up with similar problems. If my wife encounters it on another run through, I’ll see if I can look again, especially now I am a little better at sorting some stuff. :wink:

Since the gang’s all here apparently, I have another companion-related question:

Many of the heartbeat effects I am working with require a combat mode to be activated. Most commonly expertise/parry. When my companions leave combat, however, they cancel their active combat modes immediately. I have mode usage disabled on all of them, and the strange thing is as soon as I click one of them and take direct control, the mode icon is still flashing and the heartbeat effects resume in short order.

I know this is happening though because the bonuses disappear (they are 24h effects that only get stripped off when the mode is disabled) and the vfx on a hellfire warlock companion’s shield I tested with disappears as soon as combat ends.

Any thoughts?

@ebonfowl

Sorry, I have no experience with Kaedrin’s stuff, and so cannot comment. I reckon someone like KevL may know more though.

However, this would sound like normal and expected behaviour to me. And don’t forget that the script being fired changes when you possess a companion.