GammaAge/_module/nss/re_treasure0.nss
Jaysyn904 b927d0faf8 File re-organization.
File re-organization.  Added module builder & hak builder.
2021-09-16 10:15:32 -04:00

53 lines
2.3 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Name re_treasure0
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
The purpose of re_treasure# scripts are to generate
random treasure on a creature created via the BESIE
Random Encounter System by Ray Miller. These scripts
are called via an ExecuteScript() function from within
"re_rndenc". The object executing this script is passed
as the creature to be given treasure, so this creature
can be refered to as OBJECT_SELF.
*/
//:://////////////////////////////////////////////
//:: Created By: Ray Miller
//:: Created On: 10/27/02
//::////////////////////////////////////////////////////////////////////////////
/*
This is the standard treasure script for the BESIE Random Encounter System
By Ray Miller. Prior to v1.8 This script executed a series of functions to
bestow treasure upon creatures generated by the system. The problem was that
there were to many function which looped too many times and would sometimes cause
the spawner to abort with a "too many instructions error". So now we just use it
to bestow money.
Please note that the amount of treasure that should be rewarded for an encounter
or in a module is very subjective. Some will consider this amount far too generous
and some too greedy.
*/
////////////////////////////////////////////////////////////////////////////////
void main()
{
if(d100()>66) return;
object oCreature = OBJECT_SELF;
object oMarker;
if(GetRacialType(oCreature) == RACIAL_TYPE_ANIMAL
|| GetRacialType(oCreature) == RACIAL_TYPE_VERMIN) return;
float fChallengeFactor = GetChallengeRating(oCreature) * 30.0;
float fFactor = IntToFloat(Random(5) + 2);
int iTreasure = FloatToInt(fChallengeFactor / fFactor);
int iType = GetRacialType(oCreature);
CreateItemOnObject("NW_IT_GOLD001", oCreature, iTreasure);
if(iType == RACIAL_TYPE_UNDEAD || iType == RACIAL_TYPE_ABERRATION)
oMarker = CreateItemOnObject("NW_IT_MSMLMISC21", oCreature, 1);
else if(iType == RACIAL_TYPE_CONSTRUCT ||
iType == RACIAL_TYPE_ELEMENTAL ||
iType == RACIAL_TYPE_OUTSIDER)
oMarker = CreateItemOnObject("NW_IT_MSMLMISC11", oCreature, 1);
else
oMarker = CreateItemOnObject("NW_IT_MMIDMISC05", oCreature, 1);
SetLocalInt(oMarker, "bItemForGold", TRUE);
}