Added CCOH and missing areas Changed some areas to be craftable, Fixed some on death issues, Fixed the Gaurd
312 lines
16 KiB
Plaintext
312 lines
16 KiB
Plaintext
/*
|
|
By DAVIDBEOULVE
|
|
Sets the Lineage of a new vampire... their maker and
|
|
up to four generations beyond.
|
|
*/
|
|
#include "prc_inc_racial"
|
|
|
|
void vamp_setlineage(object oPC, object oTarget)
|
|
{
|
|
string lineage1 = GetCampaignString("Vampire","Lineage",oPC);
|
|
string lineage2 = GetCampaignString("Vampire","Lineage_1",oPC);
|
|
string lineage3 = GetCampaignString("Vampire","Lineage_2",oPC);
|
|
string lineage4 = GetCampaignString("Vampire","Lineage_3",oPC);
|
|
string sTargetName =GetName(oTarget);
|
|
|
|
PrintString("vamp_blooddrain: vamp_setlineage() |PC|" + GetName(oPC) + " |Target|" + sTargetName);
|
|
|
|
//Set their maker
|
|
SetCampaignString("Vampire","Lineage",GetName(oPC),oTarget);
|
|
PrintString("vamp_blooddrain: vamp_setlineage() |Target|"+sTargetName+" L="+GetName(oPC)+" L1="+lineage1+" L2="+lineage2+" L3="+lineage3+" L4="+lineage4);
|
|
|
|
if (lineage1 != "")
|
|
{
|
|
SetCampaignString("Vampire","Lineage_1",lineage1,oTarget);
|
|
PrintString("vamp_blooddrain: vamp_setlineage() |Target|"+sTargetName+" L1="+lineage1+".");
|
|
}
|
|
if (lineage2 != "")
|
|
{
|
|
SetCampaignString("Vampire","Lineage_2",lineage2,oTarget);
|
|
PrintString("vamp_blooddrain: vamp_setlineage() |Target|"+sTargetName+" L2="+lineage2+".");
|
|
}
|
|
if (lineage3 != "")
|
|
{
|
|
SetCampaignString("Vampire","Lineage_3",lineage3,oTarget);
|
|
PrintString("vamp_blooddrain: vamp_setlineage() |Target|"+sTargetName+" L3="+lineage3+".");
|
|
}
|
|
if (lineage4 != "")
|
|
{
|
|
SetCampaignString("Vampire","Lineage_4",lineage4,oTarget);
|
|
PrintString("vamp_blooddrain: vamp_setlineage() |Target|"+sTargetName+" L4="+lineage4+".");
|
|
}
|
|
// here is where we set the power of the vampire in its clan...
|
|
// the lower the number the higher the power.
|
|
// Vampires who are iVampMasterDifference numbers lower than another
|
|
// can be destroyed by the higher member.
|
|
int iMaster = GetCampaignInt("Vampire","VampLevel",oPC);
|
|
SetCampaignInt("Vampire","VampLevel",iMaster+1,oTarget);
|
|
|
|
// Tell everyone all about it.
|
|
PrintString("vamp_blooddrain: vamp_setlineage() - "
|
|
+GetName(oPC)+"'s Vampire Level is "
|
|
+IntToString(iMaster)+". "+GetName(oTarget)+"'s Vampire Level is set to "
|
|
+IntToString(iMaster+1)+".");
|
|
SendMessageToPC(oPC,"You have made "+GetName(oTarget)+" a Vampire. They are "+IntToString(iMaster+1)+" in the line of vampires that created you.");
|
|
SendMessageToAllDMs(GetName(oPC)+" has made "+GetName(oTarget)+" a Vampire. They are "+IntToString(iMaster+1)+" in the line of vampires.");
|
|
SendMessageToPC(oTarget,GetName(oPC)+" has made you into a Vampire. You are "+IntToString(iMaster+1)+" in the line of vampires. Any vampire that your creator makes will be the same generation, and any you may create, the lesser.");
|
|
}
|
|
|
|
// Adjust alignment
|
|
void adjust_alignment(object oPC, object oTarget)
|
|
{
|
|
// If target is animal -1 hit.
|
|
if (GetObjectType(oTarget) == RACIAL_TYPE_ANIMAL || GetObjectType(oTarget) == RACIAL_TYPE_BEAST || RACIAL_TYPE_ABERRATION)
|
|
{
|
|
AdjustAlignment(oPC, ALIGNMENT_EVIL, 1);
|
|
}
|
|
else
|
|
{
|
|
// If target is evil. No hit at all.
|
|
if (GetAlignmentGoodEvil(oTarget) == ALIGNMENT_EVIL)
|
|
{
|
|
return;
|
|
}
|
|
// If target is neutral or good. Adjust alignment 10 to evil.
|
|
else AdjustAlignment(oPC, ALIGNMENT_EVIL, 10);
|
|
}
|
|
}
|
|
|
|
#include "vamp_subrace"
|
|
|
|
//ADDED BY DAVIDBEOULVE:EDITED BY SEYMOR-OMNIS////////
|
|
#include "vamp_friends"
|
|
//////////////////////////////////////////////////////
|
|
|
|
// Blood Drain ability.
|
|
void vamp_blooddrain(object oPC,object oTarget)
|
|
{
|
|
string dr_TargetIsDead;
|
|
string dr_TargetIsPC;
|
|
|
|
object oMod = GetModule();
|
|
|
|
int iHourLength = GetLocalInt(oMod, "HourLength");
|
|
float fDrain = IntToFloat(iHourLength*24);
|
|
float fTemphealth = IntToFloat(iHourLength);
|
|
|
|
|
|
PrintString("vamp_blooddrain(): - PC|" + GetName(oPC) + " TARGET|" + GetName(oTarget) + " - Function called.");
|
|
// If target is undead, elemental, ooze, plant or construct skip everything.
|
|
if ((GetObjectType(oTarget) == OBJECT_TYPE_CREATURE) && (MyPRCGetRacialType(oTarget)!= RACIAL_TYPE_ELEMENTAL) &&
|
|
(MyPRCGetRacialType(oTarget)!= RACIAL_TYPE_UNDEAD) &&
|
|
(MyPRCGetRacialType(oTarget)!= RACIAL_TYPE_CONSTRUCT) &&
|
|
(MyPRCGetRacialType(oTarget)!= RACIAL_TYPE_PLANT) &&
|
|
(MyPRCGetRacialType(oTarget)!= RACIAL_TYPE_OOZE) &&
|
|
GetSubRace(oTarget) != "Vampire")
|
|
{
|
|
PrintString("vamp_blooddrain(): - PC|" + GetName(oPC) + " TARGET|" + GetName(oTarget) + " - Target is not an invalid racial victim.");
|
|
// Checks is target allready dead. Will be needing later.
|
|
int iDead = GetIsDead(oTarget);
|
|
// Get distance to target. If distance is < 2m attempt bite
|
|
if (GetDistanceBetween(oPC,oTarget)<2.0f)
|
|
{
|
|
PrintString("vamp_blooddrain(): - PC|" + GetName(oPC) + " TARGET|" + GetName(oTarget) + " - Target is in range.");
|
|
// If target is not dead nor sleeping make bite attempt
|
|
// This section also checks for effects that would leave a person helpless in dodging
|
|
effect eEffect = GetFirstEffect(oTarget);
|
|
int iDominated = FALSE;
|
|
int iParalyzed = FALSE;
|
|
int iStunned = FALSE;
|
|
int iSleep = FALSE;
|
|
while(GetIsEffectValid(eEffect))
|
|
{
|
|
int iType = GetEffectType(eEffect);
|
|
if(iType == EFFECT_TYPE_DOMINATED)
|
|
iDominated = TRUE;
|
|
else if(iType == EFFECT_TYPE_PARALYZE)
|
|
iParalyzed = TRUE;
|
|
else if(iType == EFFECT_TYPE_STUNNED)
|
|
iStunned = TRUE;
|
|
else if(iType == EFFECT_TYPE_SLEEP)
|
|
iSleep = TRUE;
|
|
eEffect = GetNextEffect(oTarget);
|
|
}
|
|
if ( GetIsDead(oTarget)==FALSE && iDominated==FALSE && iParalyzed==FALSE && iStunned==FALSE && iSleep==FALSE && GetIsResting(oTarget)==FALSE)
|
|
{
|
|
PrintString("vamp_blooddrain(): - PC|" + GetName(oPC) + " TARGET|" + GetName(oTarget) + " - Target is not dead or sleeping.");
|
|
SendMessageToPC(oPC, "You attempt to bite victim");
|
|
// If target is PC send message to him.
|
|
if (GetIsPC(oTarget) == TRUE)
|
|
{
|
|
SetPCDislike(oPC,oTarget);
|
|
SendMessageToPC(oTarget,GetName(oPC)+" attempts to bite you!");
|
|
}
|
|
// If target is NPC change target hostile.
|
|
else
|
|
{
|
|
PrintString("vamp_blooddrain: NPC ["+GetName(oTarget)+"] attacked by ["+GetName(oPC)+"].");
|
|
// This following command is buggy because it means that
|
|
// if there are any Defenders or Commoners or Merchants
|
|
// or factions hostile to Faction Hostile, they will
|
|
// attack the victim.
|
|
// ChangeToStandardFaction(oTarget,STANDARD_FACTION_HOSTILE);
|
|
|
|
// If the victim does not consider their attacker an enemy...
|
|
// (don't do this if they are already in combat it might
|
|
// interfere with the NPC's thought process)
|
|
if (!GetIsEnemy(oPC,oTarget))
|
|
{
|
|
PrintString("vamp_blooddrain: NPC ["+GetName(oTarget)+"] will now be the enemy of ["+GetName(oPC)+"].");
|
|
// make them hate the PC Vampire
|
|
AdjustReputation(oPC, oTarget, -100);
|
|
SetIsTemporaryEnemy(oPC, oTarget);
|
|
// Have them attack!
|
|
AssignCommand(oTarget, ActionAttack(oPC));
|
|
// Depreciated?
|
|
// AssignCommand(oTarget, DetermineCombatRound(oPC));
|
|
}
|
|
}
|
|
// Attempt bite. Base Attack +d20 against target AC & an accurate grapple check
|
|
int iCreatureSizePC = 0;
|
|
int iCreatureSizeTarget = 0;
|
|
|
|
if (GetCreatureSize(oPC) == CREATURE_SIZE_TINY)
|
|
iCreatureSizePC = -8;
|
|
else if (GetCreatureSize(oPC) == CREATURE_SIZE_SMALL)
|
|
iCreatureSizePC = -4;
|
|
else if (GetCreatureSize(oPC) == CREATURE_SIZE_LARGE)
|
|
iCreatureSizePC = 4;
|
|
else if (GetCreatureSize(oPC) == CREATURE_SIZE_HUGE)
|
|
iCreatureSizePC = 8;
|
|
|
|
if (GetCreatureSize(oTarget) == CREATURE_SIZE_TINY)
|
|
iCreatureSizeTarget = -8;
|
|
else if (GetCreatureSize(oTarget) == CREATURE_SIZE_SMALL)
|
|
iCreatureSizeTarget = -4;
|
|
else if (GetCreatureSize(oTarget) == CREATURE_SIZE_LARGE)
|
|
iCreatureSizeTarget = 4;
|
|
else if (GetCreatureSize(oTarget) == CREATURE_SIZE_HUGE)
|
|
iCreatureSizeTarget = 8;
|
|
|
|
if ((GetBaseAttackBonus(oPC)+d20(1)) >= GetAC(oTarget) && (GetBaseAttackBonus(oPC)+GetAbilityModifier(ABILITY_STRENGTH,oPC)+iCreatureSizePC) > (GetBaseAttackBonus(oTarget)+GetAbilityModifier(ABILITY_STRENGTH,oTarget)+iCreatureSizeTarget))
|
|
{
|
|
PrintString("vamp_blooddrain(): - PC|" + GetName(oPC) + " TARGET|" + GetName(oTarget) + " - Bit target!!!.");
|
|
SendMessageToPC(oPC, "You bite victim");
|
|
if (GetIsPC(oTarget) == TRUE)
|
|
{
|
|
SendMessageToPC(oTarget,GetName(oPC)+" bites you!");
|
|
}
|
|
// Apply effects to target. -1d4 CON damage.
|
|
if (GetAbilityScore(oTarget,ABILITY_CONSTITUTION) == 3)
|
|
{
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_HIT_NEGATIVE),oTarget);
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(), oTarget);
|
|
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY,EffectVisualEffect(VFX_COM_BLOOD_LRG_RED),GetLocation(oTarget),10.0f);
|
|
}
|
|
else
|
|
{
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, ExtraordinaryEffect(EffectAbilityDecrease(ABILITY_CONSTITUTION, d4(1))), oTarget, fDrain);
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_HIT_NEGATIVE),oTarget);
|
|
}
|
|
// Heal vampire. +5 temp. hit points if the person the vampire bit is alive
|
|
if (GetIsDead(oTarget)==FALSE)
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectTemporaryHitpoints(5),oPC,fTemphealth);
|
|
|
|
SendMessageToPC(oPC, "You drink blood.");
|
|
// Reset hungry system.
|
|
SetLocalInt(oPC,"VampHungry",0);
|
|
SetLocalInt(oPC,"VampHungryCounter",0);
|
|
// Adjust alignment
|
|
adjust_alignment(oPC, oTarget);
|
|
// If vampire killed target and target is pc. Target will begome vampire himself
|
|
|
|
}
|
|
// If bite attempt failed
|
|
else
|
|
{
|
|
SendMessageToPC(oPC, "Victim dodged your bite attempt.");
|
|
if (GetIsPC(oTarget) == TRUE)
|
|
{
|
|
SendMessageToPC(oTarget,"You succesfully dodged "+GetName(oPC)+" bite attempt!");
|
|
}
|
|
}
|
|
}
|
|
// Target is dead or sleeping. No difficult dc.
|
|
else
|
|
{
|
|
PrintString("vamp_blooddrain(): - PC|" + GetName(oPC) + " TARGET|" + GetName(oTarget) + " - Target is dead... vampire bites victim.");
|
|
|
|
SendMessageToPC(oPC, "You bite victim.");
|
|
SendMessageToPC(oTarget,GetName(oPC)+" bites you!");
|
|
if (GetAbilityScore(oTarget,ABILITY_CONSTITUTION) == 3 )
|
|
{
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_HIT_NEGATIVE),oTarget);
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(), oTarget);
|
|
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY,EffectVisualEffect(VFX_COM_BLOOD_LRG_RED),GetLocation(oTarget),10.0f);
|
|
SetLocalInt(oTarget,"JustDied",1); //this was added so when the bite kills someone and they are turned into a vampire they don't explode and die forever
|
|
}
|
|
else
|
|
{
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, ExtraordinaryEffect(EffectAbilityDecrease(ABILITY_CONSTITUTION, d4(1))), oTarget, fDrain);
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_HIT_NEGATIVE),oTarget);
|
|
}
|
|
// If target is sleeping adjust alignment
|
|
// iDead = GetIsDead(oTarget);
|
|
if (GetIsDead(oTarget) && GetLocalInt(oTarget,"JustDied")==0) //this makes sure the target was dead when the bite was used on the victim
|
|
{
|
|
adjust_alignment(oPC, oTarget);
|
|
|
|
if (GetIsDead(oTarget) == TRUE) dr_TargetIsDead = "TRUE";
|
|
else dr_TargetIsDead = "FALSE";
|
|
|
|
if (GetIsPC(oTarget) == TRUE) dr_TargetIsPC = "TRUE";
|
|
else dr_TargetIsPC = "FALSE";
|
|
|
|
PrintString("vamp_blooddrain(): - PC|" + GetName(oPC) + " TARGET|" + GetName(oTarget) + " - SLEEPING OR DEAD - Target is Dead: " + dr_TargetIsDead + " - Target is a PC: " + dr_TargetIsPC);
|
|
|
|
// If vampire killed target and target is pc. Target will begome vampire himself
|
|
if (GetIsDead(oTarget) == TRUE && GetIsPC(oTarget) == TRUE)
|
|
{
|
|
// A NEW VAMPIRE IS CREATED!!!!!
|
|
PrintString(GetName(oPC) + " just made " + GetName(oTarget) + " a vampire!!!!");
|
|
//PrintString("vamp_blooddrain(): - PC|" + GetName(oPC) + " TARGET|" + GetName(oTarget) + "| Subrace of target was: " + GetSubRace(oTarget));
|
|
SetSubRace(oTarget, "Vampire");//## uncommented
|
|
//ExportSingleCharacter(oTarget);
|
|
//Create campaign int. Needed in OnRespawn event
|
|
SetCampaignInt("Vampire","NewVamp",1,oTarget);// shouldn't this be oTarget?
|
|
//Set the Lineage up...
|
|
vamp_setlineage(oPC,oTarget);
|
|
|
|
//PrintString("vamp_blooddrain(): - PC|" + GetName(oPC) + " TARGET|" + GetName(oTarget) + "| Subrace of target is now: " + GetSubRace(oTarget));
|
|
//DAVIDBEOULVE: make sure the Faction bug gets reset...
|
|
vamp_friends(oPC);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
PrintString("vamp_blooddrain(): - PC|" + GetName(oPC) + " TARGET|" + GetName(oTarget) + "| Target is not iDead (dead) so nothing happened.");
|
|
}
|
|
SetLocalInt(oTarget,"JustDied",0);
|
|
// And heal vampire +5 temporary hit points only if the victim is alive
|
|
if (GetIsDead(oTarget)==FALSE)
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectTemporaryHitpoints(5),oPC,fTemphealth);
|
|
SendMessageToPC(oPC, "You drink blood.");
|
|
// Reset hungry system.
|
|
SetLocalInt(oPC,"VampHungry",0);
|
|
SetLocalInt(oPC,"VampHungryCounter",0);
|
|
}
|
|
|
|
}
|
|
// PC is too far to bite.
|
|
else SendMessageToPC(oPC, "You are too far to bite victim.");
|
|
|
|
}
|
|
// Target does not have blood.
|
|
else
|
|
{
|
|
PrintString("vamp_blooddrain(): - PC|" + GetName(oPC) + " TARGET|" + GetName(oTarget) + " - Target is dead and can not be sucked.");
|
|
SendMessageToPC(oPC, "Target is not living being.");
|
|
}
|
|
}
|
|
|