generated from Jaysyn/ModuleTemplate
Initial Commit
Initial Commit
This commit is contained in:
170
_module/nss/aoc_onspellcast.nss
Normal file
170
_module/nss/aoc_onspellcast.nss
Normal file
@@ -0,0 +1,170 @@
|
||||
|
||||
|
||||
|
||||
void CastJoinTeam(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
|
||||
{
|
||||
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
|
||||
{
|
||||
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 oDamager = GetLastDamager();
|
||||
int oSpell = GetLastSpell();
|
||||
object oPC = GetLastSpellCaster();
|
||||
object oMod = GetModule();
|
||||
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(IntToString(oSpell)+" by "+GetName(oPC), oPC);
|
||||
|
||||
|
||||
if (GetIsPC(oPC))
|
||||
{
|
||||
if ((GetLastSpellHarmful()==TRUE)&&(oDamager==oPC))
|
||||
{
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
if ((iHwar==1)&&(iJoinSwitch!=1)&&(iWarWon!=1)&&(GetLastSpellHarmful()==TRUE))
|
||||
{
|
||||
CastJoinTeam(OBJECT_SELF, oPC);
|
||||
SetLocalInt(oPC, "join_switch", 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetLastSpellHarmful()==TRUE)
|
||||
{
|
||||
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_defaultb", OBJECT_SELF);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user