How to check if at a specific position is an effect

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 check if at a specific position is an effect

#1 Post by MisiuPysiu »

Hi,

Is there any possibility to check if at a specific map position is a specific effect for instance:

Code: Select all

game.level.map:addEffect(self,
			self.x, self.y, duration,
			DamageType.CRIMSON_FOG, {movementSpeed=speed,staminaBack=staminaBack, dur=1   },
			radius,
			5, nil,
			engine.Entity.new{alpha=80, display='', color_br=200, color_bg=0, color_bb=0})

there are several functions which might do it but i can't figure out how to use them or if to use them in the first place:
_M:checkAllEntities (x, y, what, ...) Check all entities of the grid for a property until it finds one/returns one This will stop at the first entity with the given property (or if the property is a function, the return of the function that is not false/nil).
_M:checkAllEntitiesCount (x, y, what, ...) Check all entities of the grid for a property, counting the results This will iterate over all entities without stopping.
_M:checkAllEntitiesLayersNoStop (x, y, what, ...) Check all entities of the grid for a property This will iterate over all entities without stopping.
_M:checkAllEntitiesNoStop (x, y, what, ...) Check all entities of the grid for a property This will iterate over all entities without stopping.
_M:checkEntity (x, y, pos, what, ...) Check specified entity position of the grid for a property
_M:checkMapViewBounded ()
I would like to end an effect on the char the moment he lefts the circle with the effect by using the

Code: Select all

class:bindHook("Actor:move", function(self, data) 
hook

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

Re: How to check if at a specific position is an effect

#2 Post by darkgod »

That's how mucus works:

Code: Select all

isOnMucus = function(map, x, y)
	for i, e in ipairs(map.effects) do
		if e.damtype == DamageType.MUCUS and e.grids[x] and e.grids[x][y] then return true end
	end
end
[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 check if at a specific position is an effect

#3 Post by MisiuPysiu »

Great!
I will check this method.

Cheers:)

Post Reply