entity.damage() use

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

entity.damage() use

Post by TheSAguy »

What is the correct syntex/implementation for entity.damage()?

I want to give a small initial damage to a unit I'm creating.
Something like:

Code: Select all

	if event.created_entity.name == "unit-cluster" then
	entity.damage(1)
	end
Thanks.
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5410
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: entity.damage() use

Post by Klonan »

TheSAguy wrote:What is the correct syntex/implementation for entity.damage()?

I want to give a small initial damage to a unit I'm creating.
Something like:

Code: Select all

	if event.created_entity.name == "unit-cluster" then
	entity.damage(1)
	end
Thanks.
almost:

Code: Select all

	if event.created_entity.name == "unit-cluster" then
	event.created_entity.damage(1, game.forces.neutral)
	end
source: http://lua-api.factorio.com/0.12.30/Lua ... tml#damage
TheSAguy
Smart Inserter
Smart Inserter
Posts: 1456
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Re: entity.damage() use

Post by TheSAguy »

Thanks Klonan!
Appreciate it.
Post Reply

Return to “Modding help”