Page 1 of 1

how to remove effects on map

Posted: Wed Dec 18, 2013 1:26 pm
by MisiuPysiu
Hi,

Is there a possibility to remove certain effects on the map. For instance - after using a water based talent, the burning on the floor would dissapear.
In the code reference only the add_Effect function is mentioned.

Cheers.

Re: how to remove effects on map

Posted: Wed Dec 18, 2013 2:30 pm
by darkgod

Code: Select all

for i = #game.level.map.effects, 1, -1 do
	local e = game.level.map.effects
	if e.damtype == DamageType.WHATEVER and e.grids[x] and e.grids[x][y] then
		table.remove(game.level.map.effects, i)
	end
end
Untested :)

Re: how to remove effects on map

Posted: Wed Dec 18, 2013 3:35 pm
by MisiuPysiu
Untested
Will be tested shortly :)

Re: how to remove effects on map

Posted: Tue Jan 14, 2014 3:49 pm
by MisiuPysiu
Ok,

When I use

Code: Select all

table.remove(game.level.map.effects, i)
the whole effect is removed. So if my effect is an AOE effect of radius 3, the whole effect will be removed.
But what if i want only to remove the effect from a specific tile on the map?

Re: how to remove effects on map

Posted: Wed Jan 15, 2014 3:46 am
by HousePet
Its either too much effort to get working, or I may have coded Whistling Winds in the Druid class to do it. Can't remember which.

Re: how to remove effects on map

Posted: Wed Jan 15, 2014 4:36 am
by lukep
MisiuPysiu wrote:So if my effect is an AOE effect of radius 3, the whole effect will be removed.
Is there any reason you couldn't have a bunch of effects, each one tile in a radius of 3 instead?

Re: how to remove effects on map

Posted: Wed Jan 15, 2014 10:41 am
by MisiuPysiu
Is there any reason you couldn't have a bunch of effects, each one tile in a radius of 3 instead?
Actually no particular reason. I'm just using the methods available when creating AOE effects. I could write an own function to do it differently of course.
Well, i guess i will come back to this problem later. Right now ill try to finish my first class addon.

Cheers:)

Re: how to remove effects on map

Posted: Thu Feb 20, 2014 10:36 pm
by Nagyhal
Misiu,

Each effect lists the area it covers under its "grids" attribute. If you iterate over all the effects, and within that iteration you iterate over the grids for those effects (first x, then y), then, when the x and y value matches that of your ability, you can trim down your effects grid-by-grid. If your ability is an AoE, you will have to add another iteration to the three already described, as you'll need to run the check for every grid within the AoE.

I'm a little tight for time at the moment, but I can flesh out the code later in case I haven't described it well enough.

A mam nadzieję, że moja propozycja będzie cieszyć się powodzeniem :P