But the problem or unexpected effect is that the player receives immediatly both damages from the poison. Does anyone have any idea about how can I procced?
Your braces were all over the place. In places you had too many, in others not enough. I’ve tidied it up the best I can. Is this what you were aiming for?
No, it does the same thing without unneeded braces.
The problem is that if the player fails all saving throw (reflex and fortitude), he receives in the same moment 1d6 piercing damage (ok), 1d6 dex decrease (ok) and again the second damage of the poison, 1d6 dex decrease (nok).
I’m not sure if I can work with the standard poisons or do manually (scripting) the first poison’s damage and after that the second
Looked at your code and added comments where I noticed some things.
#include "x0_i0_spells"
//::////////////////////////////////////////////////////////////////////////////
void main()
{
object oPC= GetEnteringObject();
effect ePoison= EffectPoison(POISON_GIANT_WASP_POISON);
effect eDamage;
int nDamage = d6(1);
if(!MySavingThrow(SAVING_THROW_REFLEX, oPC, 15, SAVING_THROW_TYPE_TRAP))
{
if (GetHasFeat(FEAT_IMPROVED_EVASION, oPC)) //If they have that feat the else won't be used
nDamage /= 2;
else
{
if (GetHasFeat(FEAT_IMPROVED_EVASION, oPC)) // so why have got this a second time when the else says they don't have that feat?
nDamage = 0;
else
nDamage /= 2;
}
}
if(nDamage)
{
eDolor = EffectDamage(nDamage, DAMAGE_TYPE_PIERCING); // you should be getting an error here for undeclared variable
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oPC);
if (!MySavingThrow(SAVING_THROW_FORT, oPC, 14, SAVING_THROW_TYPE_POISON))
{
VoicePoisoned();
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, ePoison, oPC);
}
}
}
I believe the issue is that you’re applying the poison with a temporary duration of 0.0f, and it ticks twice. Try using DURATION_TYPE_PERMANENT. See also here EffectPoison(int) - NWN Lexicon where it advises to never use temporary durations on poisons and diseases.
In my opinion you need to read - TR’s Basics - Mostly Operators, but that is your choice. Too many braces is like having too many full-stops at the end of sentence. It can confuse the hell out of the reader (well it obviously did to me! )..........