Unit Launcher (Worm) - Best way to do this?

Place to get help with not working mods / modding interface.
TheSAguy
Smart Inserter
Smart Inserter
Posts: 1455
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Unit Launcher (Worm) - Best way to do this?

Post by TheSAguy »

Hi,

So I gave worms the ability to launch units at you.

I did this by adding a a create entity to the projectile:

Code: Select all

 {
	type = "create-entity",
	trigger_created_entity = "true",
	entity_name = "unit-cluster"
 },

The entity that gets created,"unit-cluster", is a biter with 1 life and a negative life re-gen of -2, so it will die.

Using "defines.events.on_entity_died" I then spawn units when "unit-cluster" dies.

Code: Select all

	if (event.entity.name == "unit-cluster") then
		SpawnLaunchedUnits(event.entity)
	end
Where "SpawnLaunchedUnits()" will create units based on the evolution factor.

Was just wondering if anyone saw any issue doing this?
Thanks.

Control Code
Unit Cluster Code
Projectile Code
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5410
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Unit Launcher (Worm) - Best way to do this?

Post by Klonan »

Following what i did in here might help:

viewtopic.php?f=93&t=23559
Post Reply

Return to “Modding help”