help i dont know what this error means
error:
___________________________________________
############################################################################################
ERROR in
action number 1
of Step Event0
for object oBattle:
Unable to find instance for object index -4
at gml_Script_BattleStatePerformAction_gml_Object_oBattle_Create_0 (line 95) - instance_create_depth(currentTargets[i].x, currentTargets[i].y, currentTargets[i].depth-1, oBattleEffect ,{sprite_index : currentAction.effectSprite});
############################################################################################
gml_Script_BattleStatePerformAction_gml_Object_oBattle_Create_0 (line 95)
gml_Object_oBattle_Step_0 (line 1) - battleState();
code:
oBattle create event
function BattleStatePerformAction()
{
//if animation etc is still playing
if (currentUser.acting)
{
//when it ends, perform action effect if it exists
if (currentUser.image_index >= currentUser.image_number -1)
{
with (currentUser)
{
sprite_index = sprites.idle;
image_index = 0;
acting = false;
}
if (variable_struct_exists(currentAction, "effectSprite"))
{
if (currentAction.effectOnTarget == MODE.ALWAYS) || ((currentAction.effectOnTarget == MODE.VARIES) && (array_length(currentTargets) <= 1) )
{
for (var i = 0; i < array_length(currentTargets); i++)
{
instance_create_depth(currentTargets[i].x, currentTargets[i].y, currentTargets[i].depth-1, oBattleEffect ,{sprite_index : currentAction.effectSprite});
}
}
else //play it at 0,0
{
var _effectSprite = currentAction.effectSprite
if (variable_struct_exists(currentAction, "effectSpriteNoTarget")) _effectSprite = currentAction.effectSpriteNoTarget;
instance_create_depth(x,y,depth-100, oBattleEffect, {sprite_index: _effectSprite});
}
} currentAction.func(currentUser, currentTargets);
}
}
else //wait for delay and then end the turn
{
if (!instance_exists(oBattleEffect))
{
battleWaitTimeRemaining--
if (battleWaitTimeRemaining == 0)
{
battleState = BattleStateVictoryCheck;
}
}
}
}```
oBattle Step event:
```gml
battleState();```