// Stake vampire. void vamp_stake(object oPC, object oTarget) { // If distance is < 2m. if (GetDistanceBetween(oPC,oTarget)<2.0f) { // If target is vampire. if (GetSubRace(oTarget)=="Vampire") { // If target is not resting if (GetIsResting(oTarget) == FALSE) { // Attempt hit SendMessageToPC(oPC,"You attempt to stake vampire."); // Make a hit. int iAttack = GetBaseAttackBonus(oPC)+d20(1); // Ac is target ac + 10 int iAC = GetAC(oTarget)+10; // If target is pc, set him hostile and send him message. if (GetIsPC(oTarget) == TRUE) { SetPCDislike(oPC,oTarget); SendMessageToPC(oTarget,GetName(oPC)+" attempts to stab you with wooden stake!"); } // If target is npc set him hostile else ChangeToStandardFaction(oTarget,STANDARD_FACTION_HOSTILE); // If hit was success if (iAttack > iAC) { // Kill target SendMessageToPC(oPC,"You succesfully hit wooden stake to vampires heart."); if (GetIsPC(oTarget) == TRUE) { SendMessageToPC(oTarget,GetName(oPC)+" succesfully stabs you. You are dead."); PrintString("vamp_stake: " + GetName(oPC) + " succesfully stabs you. You are dead. 1"); SetCampaignInt("Vampire","VampIsDead",1,oPC); } ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDeath(),oTarget); } // Hit was not success else { SendMessageToPC(oPC,"You missed your hit."); SendMessageToPC(oTarget,GetName(oPC)+" you managed to dodge "+GetName(oPC)+" attack."); } } // Target is resting. Kill target else { SendMessageToPC(oPC,"You succesfully hit wooden stake to vampires heart."); if (GetIsPC(oTarget) == TRUE) { SendMessageToPC(oTarget,GetName(oPC)+" succesfully stabs you. You are dead."); PrintString("vamp_stake: " + GetName(oPC) + " succesfully stabs you. You are dead. 2"); SetCampaignInt("Vampire","VampIsDead",1,oPC); } ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDeath(),oTarget); } } } // Too far to stake. else SendMessageToPC(oPC, "You are too far to stab vampire."); }