Grandma, where are you? (SOLVED)

The title says it all. Just finishing my module for my granddaughter (8yrs old) and have come to the last scene where it is necessary to destroy old gran and spawn in new one. (Don’t ask - we all have to make sacrifices) !

The destroying goes great - sorry, gran - but the clone fails to spawn in. I feel somehow the original grandma isn’t happy with me . . .

From SG, the code on a trigger is

void main()
{
    object oTarget;
    object oSpawn;
    effect eVFX;

    // Get the creature who triggered this event.
    object oPC = GetEnteringObject();

    // Only fire for (real) PCs.
    if ( !GetIsPC(oPC)  ||  GetIsDMPossessed(oPC) )
        return;

    // Only fire once.
    if ( GetLocalInt(GetModule(), "DO_ONCE__" + GetTag(OBJECT_SELF)) )
        return;
    SetLocalInt(GetModule(), "DO_ONCE__" + GetTag(OBJECT_SELF), TRUE);

    // Spawn "grandma_clone".
    eVFX = EffectVisualEffect(VFX_FNF_SMOKE_PUFF);
    oTarget = GetWaypointByTag("wp_grandmaspawn");
    oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "grandma_clone", GetLocation(oTarget));
    DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oSpawn));
}

Both tag and ResRef are “grandma_clone” and I’ve checked the WP tag is “wp_grandmaspawn”. Original grandma tag and ResRef were “grandma” - not that that should matter.

And, yes, I know the puff of smoke is gratuitous but the wee lass is only 8 !

Any help would be appreciated.

Well, there seams to be no error in the script itself. Try the following:

//**************************************************
void main()
{
object oTarget, object oSpawn;
effect eVFX;

object oPC = GetEnteringObject();
if (!GetIsPC(oPC)  ||  GetIsDMPossessed(oPC)) return;

AssignCommand (oPC, SpeakString (“fired”));

if (GetLocalInt(GetModule(), "DO_ONCE__" + GetTag(OBJECT_SELF))) return;
SetLocalInt(GetModule(), "DO_ONCE__" + GetTag(OBJECT_SELF), TRUE);

AssignCommand (oPC, SpeakString (“not done so far …”));

// Spawn "grandma_clone".
eVFX = EffectVisualEffect(VFX_FNF_SMOKE_PUFF);
oTarget = GetWaypointByTag("wp_grandmaspawn");

if (!GetIsObjectValid (oTarget)) AssignCommand (oPC, SpeakString (“Waypoint invalid”));

oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "grandma_clone", GetLocation(oTarget));

if (!GetIsObjectValid (oSpawn)) AssignCommand (oPC, SpeakString (“Granny isn’t there!!”));

DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oSpawn));

}

//**************************************************
is, by any chance, the tag of the trigger not unique??

1 Like

Thanks, @Mmat ! Spotted it in one. I’d left the tags as Generic trigger for both. Working now. Silly error caused by a heat oppressed brain . . .