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

92 lines
2.3 KiB
Plaintext

//Script Name: sc_npc_attacked
//////////////////////////////////////////
//Created By: Genisys (Guile)
//Created On: 8/19/08
/////////////////////////////////////////
/*
This will spawn in the Super Cop on
the PC for attacking the NPC.
NOTE: this cannot go in any other
events for the NPC!
*/
////////////////////////////////////////
#include "setxp_inc"
//Main Script
void main()
{
//Declare Major Variables
object oPlayer = GetLastAttacker(OBJECT_SELF);
object oTarget;
object oSpawn;
object oMe = OBJECT_SELF;
location lTarget;
int nInt;
lTarget = GetLocation(oTarget);
//Let's make sure we define just who killed the NPC clearly..
if(!GetIsPC(oPlayer))
{
//if It's a DM stop here..
if(GetIsDMPossessed(oPlayer))
{ return; }
if(GetIsDM(oPlayer))
{ return; }
//IF It truly was an associate who attacked..
if(GetMaster(oPlayer)!=OBJECT_INVALID)
{
oPlayer = GetMaster(oPlayer);
}
}
if(GetIsPC(oPlayer))
{
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);
}
//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);
}
//Otherwise protect the NPC from monsters!
else
{
ExecuteScript("nw_c2_default5", OBJECT_SELF);
}
//Main Script End
}