PWE_PRC8/_module/nss/rtg_spawner_htbt.nss
Jaysyn904 ee1dc35889 Initial Commit
Initial Commit
2025-04-03 10:29:41 -04:00

71 lines
3.1 KiB
Plaintext

//::///////////////////////////////////////////////
//:: TRUE Random Task Generator
//:: rtg_spawner_hrtbt
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
This file is used in the OnHeartbeat event of all RTG task related
spawners. Hopefully this will not strain the CPU cycles too much as I've
tried to optimise it as much as possible.
*/
//:://////////////////////////////////////////////
//:: Created By: Nathan 'yibble' Reynolds
//:: Created On: 10/11/2002
//:://////////////////////////////////////////////
#include "rtg_i0_const"
void main()
{
object oPC = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC);
if(!GetIsObjectValid(oPC))
return;
else if(!GetLocalInt(oPC, "RTG_TaskActive"))
return;
else if(GetDistanceToObject(oPC) > 20.0)
return;
else if(GetLocalInt(oPC, "RTG_TaskCR") == RTG_CHALLENGE_RATING_VERY_EASY)
{
if(OBJECT_SELF == GetObjectByTag("RTG_VEASY_SPWN_HOS", GetLocalInt(oPC, "RTG_SpawnerInstance")))
{
if(GetLocalInt(oPC, "RTG_TaskType") == RTG_TASK_TYPE_KILLNSTEAL)
{
object oAntagonist;
oAntagonist = CreateObject(OBJECT_TYPE_CREATURE, GetLocalString(oPC, "RTG_AntagonistRef"), GetLocation(OBJECT_SELF));
CreateItemOnObject(GetLocalString(oPC, "RTG_ItemRef"), oAntagonist);
SetLocalInt(oPC, "RTG_TaskActive", FALSE);
}
else if(GetLocalInt(oPC, "RTG_TaskType") == RTG_TASK_TYPE_HARVEST)
{
object oAntagonist;
if(Random(100) <= 25)
{
switch(Random(2))
{
case 0: oAntagonist = CreateObject(OBJECT_TYPE_CREATURE, GetLocalString(oPC, "RTG_AntagonistRef"), GetLocation(OBJECT_SELF));
CreateItemOnObject(GetLocalString(oPC, "RTG_ItemRef"), oAntagonist);
break;
case 1: oAntagonist = CreateObject(OBJECT_TYPE_CREATURE, GetLocalString(oPC, "RTG_AntagonistRef"), GetLocation(OBJECT_SELF));
CreateItemOnObject(GetLocalString(oPC, "RTG_ItemRef"), oAntagonist);
oAntagonist = CreateObject(OBJECT_TYPE_CREATURE, GetLocalString(oPC, "RTG_AntagonistRef"), GetLocation(OBJECT_SELF));
CreateItemOnObject(GetLocalString(oPC, "RTG_ItemRef"), oAntagonist);
break;
}
}
}
}
if(OBJECT_SELF == GetObjectByTag("RTG_VEASY_SPWN_FRE", GetLocalInt(oPC, "RTG_SpawnerInstance")) && GetIsObjectValid(GetItemPossessedBy(oPC, GetLocalString(oPC, "RTG_ItemTag"))))
{
if(GetLocalInt(oPC, "RTG_TaskType") == RTG_TASK_TYPE_DELIVERY)
{
object oProtagonist;
oProtagonist = CreateObject(OBJECT_TYPE_CREATURE, GetLocalString(oPC, "RTG_ProtagonistRef"), GetLocation(OBJECT_SELF));
SetLocalInt(oPC, "RTG_TaskActive", FALSE);
}
}
}
}