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

70 lines
2.1 KiB
Plaintext

/*--------------------------------------------------------
Script Name: sc_object_attked
----------------------------------------------------------
Created By: Genisys(Guile)
Created On: 4/23/09
----------------------------------------------------------
This script spawns in the Justice to tell the PC of
their abomidable offenses, the second time he attacks
and kills them, and the last time he just jails them..
----------------------------------------------------------*/
//Spawn in supercop OnPhysicalAttack
void main()
{
object oPC = GetLastAttacker(OBJECT_SELF);
if (!GetIsPC(oPC))
{
//if It's a DM stop here..
if(GetIsDMPossessed(oPC))
{ return; }
if(GetIsDM(oPC))
{ return; }
//IF It truly was an associate who attacked..
if(GetMaster(oPC)!=OBJECT_INVALID)
{
oPC = GetMaster(oPC);
}
}
object oPlayer = oPC;
// * make friendly to Each of the 3 common factions
AssignCommand(oPlayer, ClearAllActions());
// * Note: waiting for Sophia to make SetStandardFactionReptuation to clear all personal reputation
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);
}
//Do Only Once / 30 Seconds
int DoOnce = GetLocalInt(oPC, GetTag(OBJECT_SELF));
if (DoOnce==TRUE) return;
SetLocalInt(oPC, GetTag(OBJECT_SELF), TRUE);
DelayCommand(30.0, SetLocalInt(oPC, GetTag(OBJECT_SELF), FALSE));
object oSpawn;
location lTarget;
lTarget = GetLocation(oPlayer);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "supercop", lTarget);
}