//Basic Commented Combat Dummy Trainer //Rewards an average of 10 xp to lvl 1 characters per hostile action void main() { object oSelf = OBJECT_SELF; //The thing calling this, nameily the dummy itself object oAttacker = GetLastHostileActor(oSelf); //The last person to act hostilely, attacker, dammagers, spellcaster (if hostile), or disturber(in case of pickpocketing) int iPc = GetIsPC(oAttacker); //Wanna make sure it is a pc, just for good measure but we don't want wizard's pets getting lvls do we. int nXP = GetXP(oAttacker); //Easiest way to restrict via a lvl int iXp = d2();//Averages out to 10 xp, random amounts often make things feel more fluid, and organic if (iPc == TRUE){ //When the last attacker, is a pc if (nXP <= 500){ //If the pc is lvl 1, in this case left lvl 1 or lower to simplify editing for people whom want to make dumbies for higher lvl characters GiveXPToCreature(oAttacker, iXp); //Give the xp to the attacker } else{ SendMessageToPC(oAttacker,"You cannot increase your skills further by attacking this combat dummy"); }//If the attack doesn't meet the level restrictions do this, (nothing) } else{} //If the Attack isn't a pc, do this (nothing) int iDexMod = GetAbilityModifier(ABILITY_DEXTERITY, oAttacker); int nBowFocus; int nCalledShot; string nPCname = GetPCPlayerName(oSelf); { // Apply bonuses for beneficial feats if (GetHasFeat(FEAT_WEAPON_FOCUS_LONGBOW, oAttacker)) nBowFocus = 1; } { if (GetHasFeat(FEAT_WEAPON_FOCUS_SHORTBOW, oAttacker)) nBowFocus = 1; } { if (GetHasFeat(FEAT_CALLED_SHOT, oAttacker)) nCalledShot = 1; } int iHitCalc = d20()+iDexMod+nCalledShot+nBowFocus; int iRandomChance = d20(); if (iRandomChance == 20) { ActionSpeakString ("Centre Ring! (5 Points)"); return; } else if (iRandomChance == 1) { ActionSpeakString ("Scoring shot made on target edge (1 Point)"); return; } else if (iHitCalc <= 5) { ActionSpeakString ("Scoring shot made on target edge (1 Point)"); return; } else if (iHitCalc <= 12) { ActionSpeakString ("BLUE: Scoring shot made on outer circle (3 Points)"); return; } else if (iHitCalc <= 19) { ActionSpeakString ("WHITE: Scoring shot made on inner circle (4 Points)"); return; } else if (iHitCalc <= 30) { ActionSpeakString ("RED: Scoring shot made on centre circle! (5 Points)"); return; } }