Page 1 of 1

How to create a modified poison cloud

Posted: Fri Dec 29, 2017 4:18 pm
by IngoKnieto
I am trying to create a modified posion cloud, that is bigger than the regular poison capsel explosion, moves with the wind and maybe has less damage.
I have come so far:

Code: Select all

game.surfaces['nauvis'].create_entity({
name="poison-cloud",
position=myentity.position,
color = { r = 1, g = 0.1, b = 0.1 },
affected_by_wind = true,
duration = 60 * 40,
fade_away_duration = 2 * 60,
spread_duration = 100
})
This creates a regular poison cloud at the position of the given entity, but all modified values (for example color, duration and affected_by_wind) seem to be ignored.
Can anybody tell me what I am doing wrong here? How can I create a modified poison cloud?

Thanks in advance for any help...


PS: I was using the values from the poison-cloud entity from base game:
base game entity.lua

Re: How to create a modified poison cloud

Posted: Fri Dec 29, 2017 4:27 pm
by BlakeMW
I would assume that "affected_by_wind" and other properties have to be set on the entity prototype, i.e. you have to define a new entity which works as you want it to.

Re: How to create a modified poison cloud

Posted: Sun Dec 31, 2017 11:00 am
by IngoKnieto
Ah ok, thanks. I did this - I basically copied the poison cloud entity from base game, renamed it and changed a few values. (That's how you define your own entities, right? :? :) )

However it's not completely working. The cloud is affected by wind now, but for example the modified duration has no effect. Are the properties of the poison cloud entity documented anywhere? I couldn't find anything in the Lua API.

This is my code of the modified cloud:

Code: Select all

{
	type = "smoke-with-trigger",
	name = "fallout-cloud",
	flags = {"not-on-map"},
	show_when_smoke_off = true,
	animation =
	{
		filename = "__base__/graphics/entity/cloud/cloud-45-frames.png",
		flags = { "compressed" },
		priority = "low",
		width = 256,
		height = 256,
		frame_count = 45,
		animation_speed = 0.1,
		line_length = 7,
		scale = 3,
	},
	slow_down_factor = 0,
	affected_by_wind = true,
	cyclic = true,
	duration = 60 * 40,
	fade_away_duration = 2 * 60,
	spread_duration = 50,
	color = { r = 0 g = 0, b = 0},
	action =
	{
		type = "direct",
		action_delivery =
		{
			type = "instant",
			target_effects =
			{
				type = "nested-result",
				action =
				{
					type = "area",
					radius = 20,
					entity_flags = {"breaths-air"},
					action_delivery =
					{
						type = "instant",
						target_effects =
						{
						type = "damage",
						damage = { amount = 1, type = "poison"}
						}
					}
				}
			}
		}
	},
	action_cooldown = 30
}

Re: How to create a modified poison cloud

Posted: Sun Dec 31, 2017 11:11 am
by IngoKnieto
It's working - don't mind my second post... I just realized you have to restart the game when you make changes in the entity.lua, reloading the map is not enough :roll: