Help finishing this skill's lunatic script to summon an enemy

Hello,


I am using Yanfly's Skill Core and want to add a skill that summons an enemy.


This is my partially working Lunatic script on the Notes of the skill:


<Custom Execution>
var enemy = new Game_Enemy(5, 10, 10);
$gameTroop.members().push(enemy);
</Custom Execution>




It semi works. The added enemy becomes target-able, although it is not drawn and when you actually perform an action on it, I get a type exception: undefined is not a function


I'm guessing adding it to the enemy troop is not enough, anyone else knows where else do I need to update values so the enemy is:


a. Rendered


b. Actually action-performable


Thanks in advance!
I solved it myself 🙂


I only had to refresh the BattleManager spriteset.


<Custom Execution>
var enemy = new Game_Enemy(5, 10, 10);
$gameTroop.members().push(enemy);
BattleManager.refreshSpriteset();
</Custom Execution>


RefreshSpriteset is a custom function I wrote which just redraws the enemies.

Original thread: https://forums.rpgmakerweb.com/threads/help-finishing-this-skills-lunatic-script-to-summon-an-enemy.68014/