Hook Actor:move - working as intended?

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

Hook Actor:move - working as intended?

#1 Post by MisiuPysiu »

Hey,

I was using the the hook

Code: Select all

self:triggerHook{"Actor:move", moved=moved, force=force, ox=ox, oy=oy}
to check if the player is still in a zone of an effect:

Code: Select all

class:bindHook("Actor:move", function(self, data)
	if data.moved and  self:hasEffect(self.EFF_CRIMSON_FOG) then				
			local isInCrimsonFog = 0
			game.logPlayer(self, "data.x: %s, data.y: %s",data.ox,data.oy)
   			for i, e in ipairs(game.level.map.effects) do


      			if e.damtype == DamageType.CRIMSON_FOG and e.grids[data.ox] and e.grids[data.ox][data.oy]  
      			then isInCrimsonFog = 1 end
      		end
      		game.logPlayer(self, "isInCrimsonFog: %s",isInCrimsonFog)
      		if isInCrimsonFog == 0 then	
      			self:removeEffect(self.EFF_CRIMSON_FOG)
      			game.logPlayer(self, "EFF_CRIMSON_FOG removed")
      		end
   	end
end)	
data.ox and data.oy are the coordinates from where the char starts his movement and not the ones where he finally arrives, am I right? If so, does it work as intended?
I assumed, the hook is used to do stuff after the movement so the new position coordinates would be more helpful.

Cheers:)

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

Re: Hook Actor:move - working as intended?

#2 Post by darkgod »

After move coords are the current coords so self.x / self.y is fine ;)
[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: Hook Actor:move - working as intended?

#3 Post by MisiuPysiu »

Yeah...

Silly me. With the hook you have access to both the source and the target coordinates.

Cheers:)

Post Reply