Page 1 of 1

How can I make a spawned Poison Cloud last longer?

Posted: Mon Oct 29, 2012 10:26 pm
by Komag
I can't seem to find any location in the spells about the duration of the poison_cloud item. I want a spawner to spawn a poison cloud and for it to last 15 seconds - where should I start on this, some sort of custom spell item?

Re: How can I make a spawned Poison Cloud last longer?

Posted: Tue Oct 30, 2012 12:05 pm
by Komag
I found a poison_cloud.lua under assets/particles but I don't see any duration section (there is a "lifetime" for each particle type, but it's always 0.5 or 1 or 2, probably just how long each little graphic effect within the poison cloud hangs around)

Re: How can I make a spawned Poison Cloud last longer?

Posted: Tue Oct 30, 2012 5:10 pm
by aaneton
Maybe at spawn also creating a poison damagetile and destroy it after 15 sec?
Just speculating, I have not used damagetiles myself.
damageTile(level, x, y, direction, flags, damageType, power)
...
Flags:
"bit 1: ongoing damage such as poison cloud"
http://www.grimrock.net/modding/scripting-reference/

Re: How can I make a spawned Poison Cloud last longer?

Posted: Tue Oct 30, 2012 5:37 pm
by Komag
I was looking into that idea too, but I'm not sure how it would work out - the appearance (particles, clouds, etc) need to last 15 sec too. Maybe I could completely fake it, not spawn the spell, but just fake particles and stuff that look like the spell, and also a damageTile. But would I be able to make the particles fade out correctly like the spell does?

Jeesh, this would be a lot easier if I could just tell the poison_cloud to last x seconds!

Re: How can I make a spawned Poison Cloud last longer?

Posted: Tue Oct 30, 2012 9:59 pm
by aaneton
Komag wrote:I was looking into that idea too, but I'm not sure how it would work out - the appearance (particles, clouds, etc) need to last 15 sec too. Maybe I could completely fake it, not spawn the spell, but just fake particles and stuff that look like the spell, and also a damageTile. But would I be able to make the particles fade out correctly like the spell does?

Jeesh, this would be a lot easier if I could just tell the poison_cloud to last x seconds!
If you looked at my Onkalo Project mod there is a freezer that has fog (a cloud) in it. That is actually a invisible floor object with particle spray "attached" to it.
If constantly emits fog, If I destory the object the fog disappears (possible fade out if already sprayed particles stays alive their short lifetime even when object is destroyed?).
So basically you could just spawn a poisoncloud object and damagetile, then after 15sec remove both.

my freezer fog code:

Objects.lua:

Code: Select all

defineObject{
	name = "freezer_floor",
	class = "LightSource",
	lightPosition = vec(0.5, 0.5, 0),
	lightRange = 1,
	lightColor = vec(1, 1, 1),
	brightness = 1,
	castShadow = true,
	particleSystem = "freeze_fog",
	placement = "floor",
	editorIcon = 88,
}
Particles.lua

Code: Select all

defineParticleSystem{
	name = "freeze_fog",
	emitters = {
	
		-- fog
		{
			emissionRate = 1.3,
			emissionTime = 0,
			maxParticles = 100,
			boxMin = {-1, 0.1, -1},
			boxMax = { 1, 0.1,  1},
			sprayAngle = {0,35},
			velocity = {0,0},
			texture = "assets/textures/particles/smoke_01.tga",
			lifetime = {10,20},
			color0 = {1, 1, 1},
			opacity = 0.1,
			fadeIn = 9,
			fadeOut = 9,
			size = {4, 8},
			gravity = {0,0,0},
			airResistance = 0.1,
			rotationSpeed = 0.1,
			blendMode = "Translucent",
			objectSpace = false,
		}
	}
}
Basically you could take the code, modify it and change name to e.g permanent_poison_cloud. Note: you can also define multiple separate emitters into same object, or you can basically copy poison_cloud.lua partical code here.

Re: How can I make a spawned Poison Cloud last longer?

Posted: Tue Oct 30, 2012 10:16 pm
by Komag
Thanks for that!

I'll have to look into it over the next day or two - it's a bit complex but I'm ready to tackle it I think :)

Re: How can I make a spawned Poison Cloud last longer?

Posted: Fri Nov 02, 2012 10:19 pm
by Komag
I can make the poison cloud particles stay now for the 15 seconds I want, by setting up a custom particles for it (a copy of the poison_cloud but with "emissionTime = 15" instead of "emissionTime = 0" (not sure why it ended after 6sec when 0 means forever)

Now I'm working on the damageTile portion, which turns out is very tricky

Re: How can I make a spawned Poison Cloud last longer?

Posted: Sat Nov 03, 2012 12:20 am
by Neikun
Good luck, Komag!
I know I've been quiet, but I've had my eye on this thread since the beginning.

Re: How can I make a spawned Poison Cloud last longer?

Posted: Sat Nov 03, 2012 12:50 am
by Komag
I have it set up with a ticking timer set to 0.6 seconds, so to get to 15 seconds that's 25 ticks:

Code: Select all

tombTick1 = 1
function poisonTile1()
  if tombTick1 < 25 then
     for i = 1,5 do damageTile(11, 16, 20+i, 0, 2, "poison", 26/(2+tombTick1)) end
    else
     tombPoisonTimer1:deactivate()
     tombTick1 = 1
     return
  end
  tombTick1 = tombTick1 + 1
end
The math part with 26/(2+tombTick1) is to recreate a quickly diminishing damage I observed in the game. Over time, the denominator grows, so that by the second to last tick (24), it's 26/26, or just one. Quite a few ticks before the end it's close to 1. It starts around 8 and goes down fast, sort of a reverse exponential.

There's actually a second set that can operate at the same time after 10 seconds if you step on the plate again, so they "overlap" for a bit if you do that.