Hi,
I'm trying to find a way to use a javascript to add new enemies into the battle. The idea is that I have a status which, when it expires a new enemy gets added into the battle. I'm using Visustella's "skills and states core" plugin and "On Expire State" notetag.
Currently I have this code:
<JS On Expire State>
const NewEnemy = new Game_Enemy(2,200,200);
$gameTroop.members().push(NewEnemy);
const sprite = new Sprite_Enemy();
sprite.setBattler(NewEnemy);
const spriteset = SceneManager._scene._spriteset;
spriteset._battlefield.addChild(sprite);
spriteset._enemySprites.push(sprite);
</JS On Expire State>
It only manages to create an enemy that only appears in target menu and it is killable, but it doesn't do anything and it isn't visible.
If I can get this to work I can continue to develop this mechanic further and make it find an empty spot on the battlefield and spawn an enemy there and which enemy appears depends on various conditions.
I'm trying to find a way to use a javascript to add new enemies into the battle. The idea is that I have a status which, when it expires a new enemy gets added into the battle. I'm using Visustella's "skills and states core" plugin and "On Expire State" notetag.
Currently I have this code:
<JS On Expire State>
const NewEnemy = new Game_Enemy(2,200,200);
$gameTroop.members().push(NewEnemy);
const sprite = new Sprite_Enemy();
sprite.setBattler(NewEnemy);
const spriteset = SceneManager._scene._spriteset;
spriteset._battlefield.addChild(sprite);
spriteset._enemySprites.push(sprite);
</JS On Expire State>
It only manages to create an enemy that only appears in target menu and it is killable, but it doesn't do anything and it isn't visible.
If I can get this to work I can continue to develop this mechanic further and make it find an empty spot on the battlefield and spawn an enemy there and which enemy appears depends on various conditions.