Triggering Sparky Spawner Additional Times

I woke up with several scripts I’m trying to figure out today.

I’m using Sparky Spawner system. I have a item when used that I would like to trigger the area that the PC is in to run the Sparkey_Enter script again. Resulting in the area spawns triggering again. This is to make the zone more difficult or lucrative by however many times that item is used.

I think my issue currently is that it’s not applying the the area correctly.

The area OnEnter script is using:

object oPC = GetEnteringObject();
object oArea = OBJECT_SELF;

And my item’s script is using:

object oPC = GetItemActivator();
object oArea = GetArea(OBJECT_SELF);

How else can I get the object oArea for the area that the PC is in when using the item?

Additionally the on_enter script locates a object with variables set on it which it pulls from a case statement in another script. But I’m just now noticing it may be deleting that object after it runs for the first time?

// Find encounters-holding placeable
  object oEncVars = GetFirstObjectInArea(oArea);
  while (oEncVars != OBJECT_INVALID)
      {
      if (GetTag(oEncVars) == "sparky_variables") { break; }
      oEncVars = GetNextObjectInArea(oArea);
      }
  if (oEncVars != OBJECT_INVALID)
      {
      LoadEncounterVariables(oArea, GetLocalInt(oEncVars, "enc01"));
      LoadEncounterVariables(oArea, GetLocalInt(oEncVars, "enc02"));
      LoadEncounterVariables(oArea, GetLocalInt(oEncVars, "enc03"));
      LoadEncounterVariables(oArea, GetLocalInt(oEncVars, "enc04"));
      LoadEncounterVariables(oArea, GetLocalInt(oEncVars, "enc05"));
      LoadEncounterVariables(oArea, GetLocalInt(oEncVars, "enc06"));
      LoadEncounterVariables(oArea, GetLocalInt(oEncVars, "enc07"));
      LoadEncounterVariables(oArea, GetLocalInt(oEncVars, "enc08"));
      LoadEncounterVariables(oArea, GetLocalInt(oEncVars, "enc09"));
      LoadEncounterVariables(oArea, GetLocalInt(oEncVars, "enc10"));
      DestroyObject(oEncVars, 1.0); // <----- this guy
      }

I’ve commented out the destroyobject on this and the main onenter script as a test. But still I don’t think I’m defining the oArea correctly for the item on use script above.

GetArea(oPC); ?

1 Like

Yea that did it! Thought I tried that a few times! Guess not. TY