Help with teleport spell?
Posted: Wed Nov 12, 2014 7:18 am
So, like the title suggests, I'm working on a spell that teleports the party a short distance in the direction they're facing. It shouldn't function exactly like a teleport, because I want them to be stopped by walls/doors, but I don't want it to be stopped by monsters. The idea is to give some more spells to a kind of "support mage", so moving through monsters is pretty important to the concept.
The problem is, Map:isBlocked() and Map:isObstacle() both return true for tiles with a monster on it (I really don't know what the difference is between these functions). checkLineofFire() (which is necessary to detect doors) also catches on monsters (as you would expect), but checkLineOfSight() DOESN'T catch on a bunch of things, including trees.
I've tried coding my own checkLineOfFire(), but I really don't know how that's done, because I can't figure out how to access component lists and I'm not even sure how I would check what kind of components an entity held even if I could access them dynamically.
So, to reiterate, the spell should check some number of tiles in front of the party based on the direction they're facing. If it finds any kind of obstacle besides a monster, it should stop and try to teleport the party to the tile farthest before the obstacle, otherwise it moves them to the farthest checked tile. Some checks to stop the party from teleporting on top of a monster should also be done (no free tele-frags).
Does anyone have any ideas how, really, any of this could be done? It really seems like a custom checkLineOfFire() is the key, but maybe I'm missing something far simpler?
The problem is, Map:isBlocked() and Map:isObstacle() both return true for tiles with a monster on it (I really don't know what the difference is between these functions). checkLineofFire() (which is necessary to detect doors) also catches on monsters (as you would expect), but checkLineOfSight() DOESN'T catch on a bunch of things, including trees.
I've tried coding my own checkLineOfFire(), but I really don't know how that's done, because I can't figure out how to access component lists and I'm not even sure how I would check what kind of components an entity held even if I could access them dynamically.
So, to reiterate, the spell should check some number of tiles in front of the party based on the direction they're facing. If it finds any kind of obstacle besides a monster, it should stop and try to teleport the party to the tile farthest before the obstacle, otherwise it moves them to the farthest checked tile. Some checks to stop the party from teleporting on top of a monster should also be done (no free tele-frags).
Does anyone have any ideas how, really, any of this could be done? It really seems like a custom checkLineOfFire() is the key, but maybe I'm missing something far simpler?