generated from Jaysyn/ModuleTemplate
68 lines
2.5 KiB
Plaintext
68 lines
2.5 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Default: On Spell Cast At
|
|
//:: NW_C2_DEFAULTB
|
|
//:: Copyright (c) 2001 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
This determines if the spell just cast at the
|
|
target is harmful or not.
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: Preston Watamaniuk
|
|
//:: Created On: Dec 6, 2001
|
|
//:://////////////////////////////////////////////
|
|
|
|
#include "NW_I0_GENERIC"
|
|
|
|
void main()
|
|
{
|
|
object oCaster = GetLastSpellCaster();
|
|
if(GetLastSpellHarmful())
|
|
{
|
|
if(
|
|
!GetIsObjectValid(GetAttackTarget()) &&
|
|
!GetIsObjectValid(GetAttemptedSpellTarget()) &&
|
|
!GetIsObjectValid(GetAttemptedAttackTarget()) &&
|
|
GetIsObjectValid(GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN))
|
|
)
|
|
{
|
|
//If a PC is attacking a commoner or defender they are a criminal. Go to jail when you die.
|
|
if (GetIsPC(oCaster))
|
|
SetLocalInt(oCaster,"lv_criminal",1);
|
|
if(GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL))
|
|
{
|
|
DetermineSpecialBehavior(oCaster);
|
|
}
|
|
else
|
|
{
|
|
DetermineCombatRound(oCaster);
|
|
}
|
|
switch (d10()) {
|
|
case 1:
|
|
SpeakString("GUARDS!", TALKVOLUME_SHOUT);
|
|
break;
|
|
case 2:
|
|
SpeakString("HELP! HELP!", TALKVOLUME_SHOUT);
|
|
break;
|
|
case 3:
|
|
SpeakString("BY THE GODS! WHAT ARE YOU DOING?!", TALKVOLUME_SHOUT);
|
|
break;
|
|
case 4:
|
|
SpeakString("YOU WON'T GET AWAY WITH THIS!", TALKVOLUME_SHOUT);
|
|
break;
|
|
default:
|
|
SpeakString("SEND HELP! I'M BEING ATTACKED!!!", TALKVOLUME_SHOUT);
|
|
break;
|
|
}
|
|
//Shout Attack my target, only works with the On Spawn In setup
|
|
SpeakString("NW_ATTACK_MY_TARGET", TALKVOLUME_SILENT_TALK);
|
|
//Shout that I was attacked
|
|
SpeakString("NW_I_WAS_ATTACKED", TALKVOLUME_SILENT_TALK);
|
|
}
|
|
}
|
|
if(GetSpawnInCondition(NW_FLAG_SPELL_CAST_AT_EVENT))
|
|
{
|
|
SignalEvent(OBJECT_SELF, EventUserDefined(1011));
|
|
}
|
|
}
|