// Wild magic spell-script: // all spells are // jw_nun_wild #include "x2_inc_switches" #include "prc_inc_spells" // Checks whether to run wild magic or not. Returns TRUE if wildmagic does fire // Else returns FALSE int jw_check_wildmagic(); int jw_check_wildmagic() { /// Sanity check - The caster must have the local int jw_nun_wildm set to TRUE for this // script to complete. DEBUG - must make sure it is the caster and not casting item // that is checked if(GetStringLeft(GetTag(GetArea(OBJECT_SELF)),9)!= "jw_nun_wm") { //SpeakString("You are not in a wild magic area"); return FALSE; } int nSpell = PRCGetSpellId(); object oItem = PRCGetSpellCastItem(); if(GetBaseItemType(oItem) == BASE_ITEM_POTIONS) return FALSE; if(nSpell == SPELL_RESURRECTION || nSpell == SPELL_RAISE_DEAD) return FALSE; int nRand = Random(100); if(nRand <= 80) { // Wild magic affects us. No to check if we beat it // DC is 22. Can only even be tried if the skill is trained if (GetSkillRank(SKILL_SPELLCRAFT,OBJECT_SELF)>0) { int nSkill=GetIsSkillSuccessful(OBJECT_SELF,SKILL_SPELLCRAFT,30); if (nSkill==TRUE) { //FloatingTextStringOnCreature("Spellcraft success", OBJECT_SELF); return FALSE; } } FloatingTextStrRefOnCreature(84829, OBJECT_SELF); ExecuteScript("jw_nun_wild_eff", OBJECT_SELF); return TRUE; } return FALSE; }