AOC_PRC8/_module/nss/onattacked_aoc.nss
Jaysyn904 5e558169a0 Initial Commit
Initial Commit
2025-04-03 11:24:16 -04:00

225 lines
7.0 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Name x2_def_attacked
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Default On Physically attacked script
*/
//:://////////////////////////////////////////////
//:: Created By: Keith Warner
//:: Created On: June 11/03
//:://////////////////////////////////////////////
void JoinTeam(object oSelf, object oPC)
{
int iDone = 0;
object oCreature;
object oTeam;
string sSide;
int iTeam = GetLocalInt(oPC, "team_bet");
oCreature = GetFirstObjectInArea(OBJECT_SELF);
while ((GetObjectType(oCreature)!=OBJECT_TYPE_CREATURE)||
(!GetIsEnemy(oCreature, oSelf))||(GetIsPC(oCreature))||
(GetTag(oCreature)=="starfall")||(GetTag(oCreature)=="reaper"))
{
oCreature =GetNextObjectInArea(OBJECT_SELF);
}
//FloatingTextStringOnCreature(GetName(OBJECT_SELF), oPC);
//FloatingTextStringOnCreature(GetName(oCreature), oPC);
if ((GetResRef(oCreature)=="dragon1")||(GetResRef(oCreature)=="zep_halfdrafn001")||
(GetResRef(oCreature)=="zep_marilithb001")||(GetResRef(oCreature)=="bard2")||
(GetResRef(oCreature)=="zep_pitfiend001")||(GetResRef(oCreature)=="zep_balrog001")||
(GetResRef(oCreature)=="dopple")||(GetResRef(oCreature)=="mistress2")||
(GetResRef(oCreature)=="notime3")||(GetResRef(oCreature)=="notime4")||
(GetResRef(oCreature)=="darcher")||(GetResRef(oCreature)=="death"))
{
if (iTeam==2)
{
sSide = "You have breached betting protocol by assisting your team";
SetLocalInt(oPC, "pc_side", 2);
}
else if (iTeam==4)
{
sSide = "You have breached betting protocol by assisting your champion";
SetLocalInt(oPC, "pc_side", 2);
}
else
{
sSide = "You have joined the Champions of Darkness";
SetLocalInt(oPC, "pc_side", 2);
}
}
else
{
if (iTeam==1)
{
sSide = "You have breached betting protocol by assisting your team";
SetLocalInt(oPC, "pc_side", 1);
}
else if (iTeam==4)
{
sSide = "You have breached betting protocol by assisting your champion";
SetLocalInt(oPC, "pc_side", 1);
}
else
{
sSide = "You have joined the Champions of Light";
SetLocalInt(oPC, "pc_side", 1);
}
}
AdjustReputation(oPC, oCreature, 100);
SetIsTemporaryFriend(oPC, oCreature);
oTeam = GetFirstFactionMember(oCreature, FALSE);
while (GetIsObjectValid(oTeam))
{
//AdjustReputation(oPC, oTeam, 100);
SetIsTemporaryFriend(oPC, oTeam, FALSE);
oTeam = GetNextFactionMember(oCreature, FALSE);
}
FloatingTextStringOnCreature(sSide, oPC);
}
void main()
{
object oMod = GetModule();
object oPC = GetLastAttacker();
int iDamage = GetTotalDamageDealt();
string oAtt;
string oMon;
object oDest;
int oSwing;
int oHWswing;
int iSFswing;
int iFBswing;
int iFBhit;
int oMhit;
int oPCdam;
int oMiss;
int iCHswing;
int iArenaChall =GetLocalInt(oMod, "challenge");
int iSFDuel =GetLocalInt(oMod, "duel_on");
int iWarWon = GetLocalInt(oMod, "war_won");
int iJoinSwitch = GetLocalInt(oPC, "join_switch");
int iHwar = GetLocalInt(oMod, "hwar_on");
int iFinalBattle = GetLocalInt(oPC, "final_on");
int iTeam = GetLocalInt(oPC, "team_bet");
//FloatingTextStringOnCreature("duel on: "+IntToString(GetLocalInt(oMod, "duel_on")), oPC);
if (GetIsPC(oPC))
{
if ((iHwar==1)&&(iJoinSwitch!=1)&&(iWarWon!=1))
{
JoinTeam(OBJECT_SELF, oPC);
SetLocalInt(oPC, "join_switch", 1);
}
if (iArenaChall==1)
{
iCHswing = GetLocalInt(oPC, "pc_CHswing");
++iCHswing;
SetLocalInt(oPC, "pc_CHswing", iCHswing);
}
if (iSFDuel==1)
{
iSFswing = GetLocalInt(oPC, "pc_SFswing");
++iSFswing;
SetLocalInt(oPC, "pc_SFswing", iSFswing);
//FloatingTextStringOnCreature("swing "+IntToString(GetLocalInt(oPC, "pc_SFswing")), oPC);
}
if (iFinalBattle==1)
{
//FloatingTextStringOnCreature("used "+GetName(GetLastWeaponUsed(oPC)), oPC);
iFBswing = GetLocalInt(oPC, "pc_FBswing");
++iFBswing;
SetLocalInt(oPC, "pc_FBswing", iFBswing);
}
if (iHwar==1)
{
oHWswing = GetLocalInt(oPC, "pc_HWswing");
++oHWswing;
SetLocalInt(oPC, "pc_HWswing", oHWswing);
}
oSwing = GetLocalInt(oPC, "pc_swing");
++oSwing;
SetLocalInt(oPC, "pc_swing", oSwing);
//FloatingTextStringOnCreature("HWswing"+IntToString(oHWswing), oPC);
}
else
{
oAtt = GetResRef(oPC);
oAtt+="_ss";
oMiss = GetLocalInt(oMod, oAtt);
++oMiss;
SetLocalInt(oMod, oAtt, oMiss);
if (iDamage!=0)
{
oAtt = GetResRef(oPC);
oMon = oAtt+"_hh";
oMhit = GetLocalInt(oMod, oMon);
++oMhit;
SetLocalInt(oMod, oMon, oMhit);
}
}
//--------------------------------------------------------------------------
// GZ: 2003-10-16
// Make Plot Creatures Ignore Attacks
//--------------------------------------------------------------------------
if (GetPlotFlag(OBJECT_SELF))
{
return;
}
//--------------------------------------------------------------------------
// Execute old NWN default AI code
//--------------------------------------------------------------------------
ExecuteScript("nw_c2_default5", OBJECT_SELF);
}
/*void JoinTeam(object oSelf, object oPC)
{
object oCreature;
object oTeam;
string sSide;
oCreature = GetNearestCreature(CREATURE_TYPE_IS_ALIVE, PLAYER_CHAR_NOT_PC, oSelf, 1,
CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY);
if ((GetResRef(oCreature)=="dragon1")||(GetResRef(oCreature)=="zep_halfdrafn001")||
(GetResRef(oCreature)=="zep_marilithb001")||(GetResRef(oCreature)=="bard2")||
(GetResRef(oCreature)=="zep_pitfiend001")||(GetResRef(oCreature)=="zep_balrog001")||
(GetResRef(oCreature)=="dopple")||(GetResRef(oCreature)=="mistress2")||
(GetResRef(oCreature)=="notime3")||(GetResRef(oCreature)=="notime4")||
(GetResRef(oCreature)=="darcher")||(GetResRef(oCreature)=="death"))
{
sSide = "You have joined the Champions of Darkness"+GetName(oCreature);
}
else
{
sSide = "You have joined the Champions of Light"+GetName(oCreature);;
}
//if (GetIsObjectValid(oCreature))
//{
FloatingTextStringOnCreature("Valid", oPC);
AdjustReputation(oPC, oCreature, 100);
SetIsTemporaryFriend(oPC, oCreature);
oTeam = GetFirstFactionMember(oCreature, FALSE);
while (!GetIsDead(oTeam))
{
FloatingTextStringOnCreature(GetName(oTeam), oPC);
AdjustReputation(oPC, oTeam, 100);
SetIsTemporaryFriend(oPC, oTeam);
oTeam = GetNextFactionMember(oCreature, FALSE);
}
// }
FloatingTextStringOnCreature(sSide, oPC);
}