There’s no such thing as an immunity to a specific ability decrease, so you can link them safely.
Is it worth it considering dex penalties aren’t supposed to be active unless it’s a failed save? (and vice versa for cha buffs)
If it’s a question of computing power having more effects on at the same time then I understand it, but otherwise I can’t really see what linking the effects accomplishes.
Save VFX choice is simply because it’s a success and in terms of good things it does halve the damage, negate the dex damage and buff cha. It literally makes the character feel good. It also lets another person you’re having a drinking contest with know that you succeeded (can’t remember if they see the save.)
Read this…https://nwnlexicon.com/index.php/EffectLinkEffects, note this blurb near the end of the Description: “Always link effects you want to be removed or dispelled at the same time.”
Also, linking effects makes the script leaner and reduces overhead.
Hm, once again the DC is 0. I suspect something is going wrong with the local int placed on the item. Currently the value “Proof” is on the item(s) set with various values from 8-20. Do I need to create the local int elsewhere than on the item itself for it to work? Or is there some fault in the script?
Will worry about linking it when it actually works, heh.
Summary
void main()
{
object oA = GetItemActivator();
object oB = GetItemActivated();
int nA = GetLocalInt(oB, “Proof”);
int nB = FortitudeSave(oA, nA / 2, SAVING_THROW_TYPE_POISON);
int nC = 1; if (nB == 0) {nC = nA / 5;}
int nD = GetAbilityScore(oA, ABILITY_CONSTITUTION, FALSE);
float fA = IntToFloat(nC * 60);
effect eA = EffectAbilityDecrease(ABILITY_DEXTERITY, nC);
effect eB = EffectAbilityDecrease(ABILITY_CONSTITUTION, nC);
effect eC = EffectAbilityDecrease(ABILITY_INTELLIGENCE, nC);
effect eD = EffectAbilityDecrease(ABILITY_WISDOM, nC);
effect eE = EffectAbilityIncrease(ABILITY_CHARISMA, nC);
AssignCommand(oA, ClearAllActions());
if (nB == 0)
{
if (nD < 4)
{
int nE = FortitudeSave(oA, nA / 2, SAVING_THROW_TYPE_POISON);
if (nE = 0)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(), oA);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(9999), oA);
return;
}
}
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eA, oA, fA);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eB, oA, fA);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eC, oA, fA);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eD, oA, fA);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectDazed(), oA, fA/20);
if (nD < 4)
{
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectKnockdown(), oA, fA/20);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectDazed(), oA, fA);
SendMessageToPC(oA, "Consuming any more alcohol right now could prove fatal!");
}
else
{
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectDazed(), oA, fA/20);
}
}
else if (nC == 1)
{
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eB, oA, fA);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eC, oA, fA);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eD, oA, fA);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eE, oA, fA);
if (nD < 4)
{
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectKnockdown(), oA, fA/20);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectDazed(), oA, fA);
SendMessageToPC(oA, "Consuming any more alcohol right now could prove fatal!");
}
else
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_FORTITUDE_SAVING_THROW_USE), oA);
}
}
else
{
SendMessageToPC(oA, "The alcohol has little effect on you.");
}
}
Well you are setting nE to 0 instead of comparing it.
But how are you getting the item? If it’s an infinite item in a store the variable may get lost if I remember. Try putting
SendMessageToPC(GetFirstPC(), "Got proof = " + IntToString(nA));
right after you read out the variable. Also check the case of your variable on the item.
nE is the second fortitude save you only have to roll if your con is below 4 and you failed the first roll… It gets defined right before it gets used, not sure what you’re referring to? Edit: nevermind, found it
You were right about the amounts for sale, though. Innkeeper sold alcohol in stacks of 1, but infinite amounts. Tried changing some while keeping others as infinite and that was the difference between dc 0 and na/2
Can it really be that shops only let you choose between max stack size and infinite?
Everything seems to be working now. Thanks for helping me finish it!
Script.
void main()
{
object oPC = GetItemActivator();
int nProof = GetLocalInt(GetItemActivated(), “Proof”);
int nSave = FortitudeSave(oPC, nProof / 2, SAVING_THROW_TYPE_POISON);
int nDamage = nProof / 10; if (nSave == 0) {nDamage = nProof / 5;}
int nCon = GetAbilityScore(oPC, ABILITY_CONSTITUTION, FALSE);
float fDuration = IntToFloat(nDamage * 60);
effect eDex = EffectAbilityDecrease(ABILITY_DEXTERITY, nDamage);
effect eCon = EffectAbilityDecrease(ABILITY_CONSTITUTION, nDamage);
effect eInt = EffectAbilityDecrease(ABILITY_INTELLIGENCE, nDamage);
effect eWis = EffectAbilityDecrease(ABILITY_WISDOM, nDamage);
effect eCha = EffectAbilityIncrease(ABILITY_CHARISMA, nDamage);
effect eFail = EffectLinkEffects(eDex, eCon); eFail = EffectLinkEffects(eInt, eFail); eFail = EffectLinkEffects(eWis, eFail);
effect eSave = EffectLinkEffects(eCon, eInt); eSave = EffectLinkEffects(eWis, eSave); eSave = EffectLinkEffects(eCha, eSave);
AssignCommand(oPC, ClearAllActions());
if (nSave == 0)
{
if (nCon < 4)
{
int nDeath = FortitudeSave(oPC, nProof / 2, SAVING_THROW_TYPE_POISON);
if (nDeath == 0)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(), oPC);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(9999), oPC);
return;
}
}
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eFail, oPC, fDuration);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectDazed(), oPC, fDuration/20);
if (nCon - nDamage < 4)
{
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectKnockdown(), oPC, fDuration/20);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectDazed(), oPC, fDuration);
FloatingTextStringOnCreature("Consuming any more alcohol right now could prove fatal!", oPC);
}
else
{
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectDazed(), oPC, fDuration/20);
}
}
else if (nSave == 1)
{
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eSave, oPC, fDuration);
if (nCon - nDamage < 4)
{
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectKnockdown(), oPC, fDuration/20);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectDazed(), oPC, fDuration);
FloatingTextStringOnCreature("Consuming any more alcohol right now could prove fatal!", oPC);
}
else
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_FORTITUDE_SAVING_THROW_USE), oPC);
}
}
else
{
SendMessageToPC(oPC, "The alcohol has little effect on you.");
}
}
Feedback and ideas are very welcome!
Charles.