Yeah. Alternatively, for a more complex effect, something like this works...
void DoBuff(int nRDD, object oPC);
void main()
{
object oPC = OBJECT_SELF;
object oCB = GetObjectByTag("CLASSBONUS");//placeable in the mod marked as plot and usable
//Before applying any new effects, clear the previous ones
effect e = GetFirstEffect(oPC);
while( GetIsEffectValid(e) )
{
if( GetEffectCreator(e) == oCB ) {
//I should add, I never see this message, but I can't see what I'm doing wrong
SendMessageToPC(oPC,"class bonus effect removed");//DEBUG
RemoveEffect(oPC,e);
}
e = GetNextEffect(oPC);
}
int nRDD = GetLevelByClass(CLASS_TYPE_DRAGONDISCIPLE,oPC);
if( nRDD > 0 && nRDD < 20 )
{
AssignCommand(oCB,DoBuff(nRDD, oPC));
}
}
void DoBuff(int nRDD, object oPC)
{
effect eFire = EffectDamageImmunityIncrease(DAMAGE_TYPE_FIRE,nRDD*5);
ApplyEffectToObject(DURATION_TYPE_PERMANENT,eFire,oPC);
}
And if you changed the line from
AssignCommand(oCB,DoBuff(nRDD, oPC));
to
AssignCommand(oCB,DoBuff(nRDD, OBJECT_SELF));
then the effect would be applied to oCB -- since it becomes OBJECT_SELF within the AssignCommand.