Is it possible to deploy a destroyer capsule as actual follow robots with the API?
You can do a surface.create_entity on a "destroyer-capsule", but that just leaves them hanging in the air.
You can also make a group with surface.create_unit_group, but then you're just implementing your own follower AI (might also be fun?)
Is there a way to deploy a destroyer capsule like an actual player would by "throwing" a capsule?
Deploy capsules as real follower robots?
Deploy capsules as real follower robots?
My mod: "Auto Deploy Destroyers" (follower robots) viewtopic.php?f=97&t=24545
Re: Deploy capsules as real follower robots?
There's additional parameter field to .create_entity: target.
Code: Select all
game.player.surface.create_entity{name="defender",position=game.player.position, force=game.player.force, target=game.player.character}
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
I also update mods, some of them even work.
Recently I did a mod tutorial.
Re: Deploy capsules as real follower robots?
Aha, that seems to work. If you create a capsule it spawns the 5 bots, but not as followers.
This way the single destroyer becomes a real followers...thanks!
This is what i had created myself, but like i said...it spawns 5 non follower destroyers???
This way the single destroyer becomes a real followers...thanks!
This is what i had created myself, but like i said...it spawns 5 non follower destroyers???
/c player = game.local_player;
surface = game.surfaces.nauvis;
deployed = surface.create_entity({
name="destroyer-capsule",
amount=1,
position={player.position.x,player.position.y},
force=player.force,
source=player.character,
target=player.character,
speed=1
});
My mod: "Auto Deploy Destroyers" (follower robots) viewtopic.php?f=97&t=24545
Re: Deploy capsules as real follower robots?
The target field seems not to be accessible after entity is created already.
If you want five followers, use create_entity five times.
If you want capsule projectile first, create dummy copy of that in your data lua, and use trigger_created_entity event to detect when it's time to spawn five followers. Off the top of the head, the example of trigger_created_entity can be seen in my DroneHome mod, albeit there it is used for despawning of drones.
If you want five followers, use create_entity five times.
If you want capsule projectile first, create dummy copy of that in your data lua, and use trigger_created_entity event to detect when it's time to spawn five followers. Off the top of the head, the example of trigger_created_entity can be seen in my DroneHome mod, albeit there it is used for despawning of drones.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
I also update mods, some of them even work.
Recently I did a mod tutorial.