Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

The part which applies the move is the part (starting at line 671) which begins:

//Apply to all target(s) individually
for(var c = 0; c < array_length(a_targ); c++){

Currently it doesn't do anything special to detect targets not existing, it checks if the number of hits is 0 and the number of misses is also 0 to conclude that there was no target after the fact. (Done immediately after this loop)

So what I'd do is insert a check before this loop, which checks if the original target remains, otherwise gets a random one based on the move (using the function enemies use to pick random targets):

found_targets = 0;
for(var c = 0; c < array_length(a_targ); c++){
     var trg = a_targ[c];
     if(battle_is_alive(trg)){
         found_targets++
     } 
}
if(found_targets == 0){
     a_targ = battle_get_random_targets(a_user, a_comm); 
}
(+1)

Perfect thanks! Works like a charm :D