Lightfoot, thanks a bunch! you were right about the logic, it was only spawning treasure once. I have changed the script to:
location lTarget;
object oSpawn;
object oTarget;
//Put this script OnOpen
#include "nw_i0_generic"
#include "x0_i0_treasure"
void main()
{
object oPC = GetLastOpenedBy();
if (!GetIsPC(oPC)) return;
if (GetLocalInt(OBJECT_SELF,"NW_DO_ONCE") != 0) return;
SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",1);
int nInt;
nInt = d12();
if (nInt==1)
{
SendMessageToPC(oPC, "Nothing here.");
}
if (nInt==2)
{
CTG_CreateTreasure(TREASURE_TYPE_LOW, GetLastOpener(), OBJECT_SELF);
}
if (nInt==3)
{
oTarget = oPC;
ActionSpeakString("From the dust within, rotting flesh comes forth.");
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "s_zombie001", lTarget);
CTG_CreateTreasure(TREASURE_TYPE_LOW, GetLastOpener(), OBJECT_SELF);
oTarget = oSpawn;
SetIsTemporaryEnemy(oPC, oTarget);
AssignCommand(oTarget, ActionAttack(oPC));
AssignCommand(oTarget, DetermineCombatRound(oPC));
}
if (nInt==4)
{
oTarget = oPC;
ActionSpeakString("From the dust within, rotting flesh comes forth.");
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "s_zombie002", lTarget);
CTG_CreateTreasure(TREASURE_TYPE_LOW, GetLastOpener(), OBJECT_SELF);
oTarget = oSpawn;
SetIsTemporaryEnemy(oPC, oTarget);
AssignCommand(oTarget, ActionAttack(oPC));
AssignCommand(oTarget, DetermineCombatRound(oPC));
}
if (nInt==5)
{
oTarget = oPC;
ActionSpeakString("From the dust within, rotting flesh comes forth.");
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "s_zombie003", lTarget);
CTG_CreateTreasure(TREASURE_TYPE_LOW, GetLastOpener(), OBJECT_SELF);
oTarget = oSpawn;
SetIsTemporaryEnemy(oPC, oTarget);
AssignCommand(oTarget, ActionAttack(oPC));
AssignCommand(oTarget, DetermineCombatRound(oPC));
}
if (nInt==6)
{
oTarget = oPC;
ActionSpeakString("From the dust within, rotting flesh comes forth.");
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "s_zombie004", lTarget);
CTG_CreateTreasure(TREASURE_TYPE_LOW, GetLastOpener(), OBJECT_SELF);
oTarget = oSpawn;
SetIsTemporaryEnemy(oPC, oTarget);
AssignCommand(oTarget, ActionAttack(oPC));
AssignCommand(oTarget, DetermineCombatRound(oPC));
}
if (nInt==7)
{
oTarget = oPC;
ActionSpeakString("From the dust within, rotting flesh comes forth.");
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "s_zombie005", lTarget);
CTG_CreateTreasure(TREASURE_TYPE_LOW, GetLastOpener(), OBJECT_SELF);
oTarget = oSpawn;
SetIsTemporaryEnemy(oPC, oTarget);
AssignCommand(oTarget, ActionAttack(oPC));
AssignCommand(oTarget, DetermineCombatRound(oPC));
}
if (nInt==8)
{
oTarget = oPC;
ActionSpeakString("From the dust within, rotting flesh comes forth.");
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "s_zombie006", lTarget);
CTG_CreateTreasure(TREASURE_TYPE_LOW, GetLastOpener(), OBJECT_SELF);
oTarget = oSpawn;
SetIsTemporaryEnemy(oPC, oTarget);
AssignCommand(oTarget, ActionAttack(oPC));
AssignCommand(oTarget, DetermineCombatRound(oPC));
}
if (nInt==9)
{
oTarget = oPC;
ActionSpeakString("From the dust within, rotting flesh comes forth.");
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "s_zombie007", lTarget);
CTG_CreateTreasure(TREASURE_TYPE_LOW, GetLastOpener(), OBJECT_SELF);
oTarget = oSpawn;
SetIsTemporaryEnemy(oPC, oTarget);
AssignCommand(oTarget, ActionAttack(oPC));
AssignCommand(oTarget, DetermineCombatRound(oPC));
}
if (nInt==10)
{
oTarget = oPC;
ActionSpeakString("From the dust within, rotting flesh comes forth.");
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "s_zombie008", lTarget);
CTG_CreateTreasure(TREASURE_TYPE_LOW, GetLastOpener(), OBJECT_SELF);
oTarget = oSpawn;
SetIsTemporaryEnemy(oPC, oTarget);
AssignCommand(oTarget, ActionAttack(oPC));
AssignCommand(oTarget, DetermineCombatRound(oPC));
}
if (nInt==11)
{
oTarget = oPC;
ActionSpeakString("From the dust within, rotting flesh comes forth.");
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "s_zombie009", lTarget);
CTG_CreateTreasure(TREASURE_TYPE_MED, GetLastOpener(), OBJECT_SELF);
oTarget = oSpawn;
SetIsTemporaryEnemy(oPC, oTarget);
AssignCommand(oTarget, ActionAttack(oPC));
AssignCommand(oTarget, DetermineCombatRound(oPC));
}
if (nInt==12)
{
oTarget = oPC;
ActionSpeakString("From the dust within, Stinking Insects comes forth.");
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "carrionbeetle01", lTarget);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "carrionbeetle01", lTarget);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "carrionbeetle01", lTarget);
CTG_CreateTreasure(TREASURE_TYPE_LOW, GetLastOpener(), OBJECT_SELF);
oTarget = oSpawn;
SetIsTemporaryEnemy(oPC, oTarget);
AssignCommand(oTarget, ActionAttack(oPC));
AssignCommand(oTarget, DetermineCombatRound(oPC));
}
DelayCommand(600.0f, CTG_SetIsTreasureGenerated(OBJECT_SELF, FALSE));
DelayCommand(600.0, SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",0))}
In the old, it was respawning treasure, but it was not always giving the message there is nothing, or it was spawning the critters and not spawning the treasure. I also did not like the 30% nothing as it turned out to be to limited in the over all treasure distibrution.
Genisys, thanks, but I do not think the switch case is the way I want to do this.