Here's our Get and Send messages to get you started. I imagine you'll be able to find some tlk values for them that fit. The PC Filter option you can ignore - we use it, combined with NWNX, to allow players to only see some messages in combat, instead of the superscroll of normal combat.
struct SubString GetSpellResistanceMessage (object oCaster, object oTarget, int nRoll, int nSP, int nSR) {
struct SubString ss;
int bCasterBrief = GetPCFilter(oCaster, PCFILTER_BRIEF);
int bTargetBrief = GetPCFilter(oTarget, PCFILTER_BRIEF);
string sCaster = (bCasterBrief ? "SP" : "Spell Penetration");
string sTarget = (bTargetBrief ? "SR" : "Spell Resistance");
if (nSR == -2) {
ss.first = C_TEAL + GetName(oTarget) + " : " + sCaster + " : *immune*" + C_END;
ss.rest = C_TEAL + GetName(oCaster) + " : " + sTarget + " : *immune*" + C_END;
} else if (nSR == -3) {
ss.first = C_TEAL + GetName(oTarget) + " : " + sCaster + ": *absorbed*" + C_END;
ss.rest = C_TEAL + GetName(oCaster) + " : " + sTarget + ": *absorbed*" + C_END;
} else {
string sCasterRoll = "(" + IntToString(nRoll) + " + " + IntToString(nSP) +
" = " + IntToString(nRoll + nSP) + (bCasterBrief ? " / " : " vs. SR: " ) +
IntToString(nSR) + ")";
string sTargetRoll = "(" + IntToString(nRoll) + " + " + IntToString(nSP) +
" = " + IntToString(nRoll + nSP) + (bTargetBrief ? " / " : " vs. SR: " ) +
IntToString(nSR) + ")";
if (nSP + nRoll >= nSR) {
ss.first = C_TEAL + GetName(oTarget) + " : " + sCaster + " : *success* : " + sCasterRoll + C_END;
ss.rest = C_TEAL + GetName(oCaster) + " : " + sTarget + " : *defeated* : " + sTargetRoll + C_END;
} else {
ss.first = C_TEAL + GetName(oTarget) + " : " + sCaster + " : *failure* : " + sCasterRoll + C_END;
ss.rest = C_TEAL + GetName(oCaster) + " : " + sTarget + " : *resisted* : " + sTargetRoll + C_END;
}
}
return ss;
}
void SendSpellResistanceMessage (object oCaster, object oTarget, int nRoll, int nSP, int nSR, float fDelay=0.0) {
struct SubString ss = GetSpellResistanceMessage(oCaster, oTarget, nRoll, nSP, nSR);
switch (GetPCFilter(oCaster, PCFILTER_SPELLPEN)) {
case 0: DelayCommand(fDelay, SendMessageToPC(oCaster, ss.first)); break;
case 1: DelayCommand(fDelay, SendSystemMessage(oCaster, ss.first)); break;
case 2: DelayCommand(fDelay, FloatingTextStringOnCreature(ss.first, oCaster, FALSE)); break;
}
switch (GetPCFilter(oTarget, PCFILTER_SPELLPEN)) {
case 0: DelayCommand(fDelay, SendMessageToPC(oTarget, ss.rest)); break;
case 1: DelayCommand(fDelay, SendSystemMessage(oTarget, ss.rest)); break;
case 2: DelayCommand(fDelay, FloatingTextStringOnCreature(ss.rest, oTarget, FALSE)); break;
}
}
Funky