generated from Jaysyn/ModuleTemplate
Initial Commit
Initial Commit.
This commit is contained in:
53
_module/nss/s_genloot.nss
Normal file
53
_module/nss/s_genloot.nss
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
s_genloot - generate loot
|
||||
*/
|
||||
|
||||
#include "X_O2_CONINCLUDE"
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
int bDestroyed = (GetCurrentHitPoints() <= 0);
|
||||
|
||||
|
||||
if (GetIsRefillReady()) {
|
||||
|
||||
int iTreasureTable = GetTreasureTable();
|
||||
|
||||
object oLastOpener = GetLastOpener();
|
||||
if (iTreasureTable != TREASURE_BOSS) {
|
||||
|
||||
GenerateTreasure(iTreasureTable, oLastOpener, OBJECT_SELF);
|
||||
|
||||
} else {
|
||||
|
||||
object oMember = GetFirstFactionMember(oLastOpener, TRUE);
|
||||
while (GetIsObjectValid(oMember) == TRUE) {
|
||||
|
||||
GenerateTreasure(TREASURE_BOSS, oMember, OBJECT_SELF);
|
||||
oMember = GetNextFactionMember(oLastOpener, TRUE);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ShoutDisturbed();
|
||||
|
||||
if (!bDestroyed) {
|
||||
|
||||
SetLocalInt(OBJECT_SELF, GT_REFILL_NOT_READY, TRUE);
|
||||
|
||||
if (GetIsRefillable())
|
||||
DelayCommand(GetRefillDelay(), SetLocalInt(OBJECT_SELF, GT_REFILL_NOT_READY, FALSE));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (bDestroyed && GetIsRespawnable()) {
|
||||
|
||||
SetLocalFloat(OBJECT_SELF, "RESPAWN_DELAY", GetRespawnDelay());
|
||||
ExecuteScript("s_respawnself", OBJECT_SELF);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user