how to remove effects on map

All development conversation and discussion takes place here

Moderator: Moderator

Post Reply
Message
Author
MisiuPysiu
Archmage
Posts: 379
Joined: Tue Nov 11, 2003 10:54 am
Location: Wroclaw/Poland

how to remove effects on map

#1 Post 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.

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: how to remove effects on map

#2 Post 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 :)
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

MisiuPysiu
Archmage
Posts: 379
Joined: Tue Nov 11, 2003 10:54 am
Location: Wroclaw/Poland

Re: how to remove effects on map

#3 Post by MisiuPysiu »

Untested
Will be tested shortly :)

MisiuPysiu
Archmage
Posts: 379
Joined: Tue Nov 11, 2003 10:54 am
Location: Wroclaw/Poland

Re: how to remove effects on map

#4 Post 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?

HousePet
Perspiring Physicist
Posts: 6215
Joined: Sun Sep 09, 2012 7:43 am

Re: how to remove effects on map

#5 Post 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.
My feedback meter decays into coding. Give me feedback and I make mods.

lukep
Sher'Tul Godslayer
Posts: 1712
Joined: Mon Mar 14, 2011 10:32 am
Location: Canada

Re: how to remove effects on map

#6 Post 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?
Some of my tools for helping make talents:
Melee Talent Creator
Annotated Talent Code (incomplete)

MisiuPysiu
Archmage
Posts: 379
Joined: Tue Nov 11, 2003 10:54 am
Location: Wroclaw/Poland

Re: how to remove effects on map

#7 Post 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:)

Nagyhal
Wyrmic
Posts: 282
Joined: Tue Feb 15, 2011 12:01 am

Re: how to remove effects on map

#8 Post 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

Post Reply