#include "jump_include"
#include "jump_inc_pattern"

void main()
{
    float fDelay = 1.0;
    int bTurnToTarget = TRUE;
    
    // Check if the jumper can be activated.
    if (ActivateJumper(fDelay, bTurnToTarget))
    {
        // Apply a lightning effect to the jumping character.
        ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(1790), oPC);
        
        int iInterval = 15;
        int iEffect = 253;
        
        // Trail effect for the jumping character.
        Jump_JumperTrail(iInterval, iEffect, fDelay = 0.05);
        
        // NPC spawning logic
        string sNPCResRef = "cas_raccoon"; // Replace with the resref of the NPC to spawn
        int iNPCCount = 3; // Number of NPCs to spawn
        int i; // Loop variable defined outside the loop

        for (i = 0; i < iNPCCount; i++)
        {
            // Spawn NPC at the target location
            object oNPC = CreateObject(OBJECT_TYPE_CREATURE, sNPCResRef, lTarget);
            
            // Apply a visual effect to the spawned NPC
            ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(473), oNPC);
            
            // Optional: Apply any additional effects or logic to the NPCs
            // DelayCommand(0.5, AssignCommand(oNPC, ActionMoveToLocation(lTarget))); // Example to move NPCs to the target location
        }

        // Apply a visual effect at the destination location after the jump.
        DelayCommand(fDelay, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(473), lTarget));

        // Optional: Additional visual effects or gameplay logic can be added here.
    }
}
