I'm trying to make an enemy spawn another enemy from time to time, redirecting the target from the first enemy to itself.
Having issues with adding the enemy, not as much with the redirection.
Some custom scripts i have are: YANFLY_CORE, Yanfly_Battle, Yanfly_Aftermath, Yanfly_Battle Commands, Yanfly_HP_Bar, Yanfly_Spawn_Event, Yanfly_Nofail, Yanfly_Lunatic_States, Yanfly_Passive_States, Yanfly State Animations, Yanfly Party.
As mentioned in the title, i don't know how to add the sprite. Here are script segments that add the enemy:
Having issues with adding the enemy, not as much with the redirection.
Some custom scripts i have are: YANFLY_CORE, Yanfly_Battle, Yanfly_Aftermath, Yanfly_Battle Commands, Yanfly_HP_Bar, Yanfly_Spawn_Event, Yanfly_Nofail, Yanfly_Lunatic_States, Yanfly_Passive_States, Yanfly State Animations, Yanfly Party.
As mentioned in the title, i don't know how to add the sprite. Here are script segments that add the enemy:
Ruby:
# Game_Enemy
def make_protector(enemyid) # enemyid is the id of the enemy being created
return if @protectedby
$game_troop.add_protector(@index, enemyid)
$game_troop.make_unique_names
end
# Game_Troop
#--------------------------------------------------------------------------
# * Add Protector of Enemy
# - index - the index of the enemy to protect in the troop.
# - enemy_id - the enemy index to create.
#--------------------------------------------------------------------------
def add_protector(index, enemy_id)
enemy = Game_Enemy.new(@enemies.size, enemy_id)
enemy.screen_x = @enemies[index].screen_x + (rand(7) - 4) * 4
enemy.screen_y = @enemies[index].screen_y + 4
@enemies.push(enemy)
@enemies[index].protectedby = enemy
@enemies[index].add_state(108)
enemy.protecting = @enemies[index]
# ▼ not sure what to do after this comment, trying to do something to give enemy a sprite
SceneManager.scene.update_basic
end