Page 1 of 1

entity.damage() use

Posted: Tue Apr 26, 2016 5:25 pm
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.

Re: entity.damage() use

Posted: Tue Apr 26, 2016 5:46 pm
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

Re: entity.damage() use

Posted: Tue Apr 26, 2016 6:45 pm
by TheSAguy
Thanks Klonan!
Appreciate it.