UW2_PRC8/_module/nss/sc_npc_spelled.nss
Jaysyn904 5197ad9a4d Initial upload
Initial upload
2023-09-25 20:24:01 -04:00

99 lines
2.6 KiB
Plaintext

//Script Name: sc_npc_spelled
//////////////////////////////////////////
//Created By: Genisys (Guile)
//Created On: 8/19/08
/////////////////////////////////////////
/*
This will spawn in the Super Cop on
the PC for casting a spell at the NPC
*/
////////////////////////////////////////
//This include is used to penalize the PC
#include "setxp_inc"
//Main Script
void main()
{
//Declare Major Variables..
object oPlayer = GetLastSpellCaster();
object oTarget;
object oSpawn;
location lTarget;
//Let's make sure we define just who killed the NPC clearly..
if(!GetIsPC(oPlayer))
{
//if It's a DM stop here..
if(GetIsDMPossessed(GetLastSpellCaster()))
{ return; }
if(GetIsDM(oPlayer))
{ return; }
//IF It truly was an associate who attacked..
if(GetMaster(GetLastSpellCaster())!=OBJECT_INVALID)
{
oPlayer = GetMaster(oPlayer);
}
else
{
oPlayer = GetLastSpellCaster();
}
}
if(GetIsPC(oPlayer))
{
//Only Once Ever 30 Seconds!
int Do1Time = GetLocalInt(oPlayer, GetTag(OBJECT_SELF) + "SC");
if (Do1Time==TRUE) {return;}
SetLocalInt(oPlayer, GetTag(OBJECT_SELF) + "SC", TRUE);
DelayCommand(30.0, SetLocalInt(oPlayer, GetTag(OBJECT_SELF) + "SC", FALSE));
//Penalize the player!
ApplyRespawnPenalty(oPlayer);
oTarget = oPlayer;
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "supercop", lTarget);
oTarget = oSpawn;
int nInt;
nInt = GetObjectType(oTarget);
if (nInt != OBJECT_TYPE_WAYPOINT) DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_UNDEAD), oTarget));
else DelayCommand(0.5, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_UNDEAD), GetLocation(oTarget)));
AssignCommand(oPlayer, ClearAllActions());
//Clear Reputation of PC
if (GetStandardFactionReputation(STANDARD_FACTION_COMMONER, oPlayer) <= 10)
{ SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_COMMONER, 80, oPlayer);
}
if (GetStandardFactionReputation(STANDARD_FACTION_MERCHANT, oPlayer) <= 10)
{ SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_MERCHANT, 80, oPlayer);
}
if (GetStandardFactionReputation(STANDARD_FACTION_DEFENDER, oPlayer) <= 10)
{ SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_DEFENDER, 80, oPlayer);
}
}
//Otherwise protect the NPC from monsters!
else
{
ExecuteScript("nw_c2_defaultb", OBJECT_SELF);
}
//Main Script End
}