• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Monster move direction

adrenyslopez

Member
Joined
Dec 22, 2015
Messages
201
Reaction score
15
Someone help me with a script of a monster that only walks in one direction and when it reaches another monster heals it and disappears?

Me using OTBR tfs 1.3

Here is a video so that you understand more or less



When a monster with the name "rat" appears in the red circle, just walk towards the blue circle, by touching the monster "Training Monk" in the blue circle, heal it and the rat disappears
SCRIPT.png
 
Last edited:
Yes, its possible, but it would require some code and logic to do this.
First off create monster as summon and setFollowCreature to nil, then you have to find the direction to your target creature (can be done with creature:getPathTo(position) and a loop of addEvents to iterate returned container. After every step you need to check if you are near the target (position distance == 1) and then you can execute your code to heal and delete the summon.
 
Yes, its possible, but it would require some code and logic to do this.
First off create monster as summon and setFollowCreature to nil, then you have to find the direction to your target creature (can be done with creature:getPathTo(position) and a loop of addEvents to iterate returned container. After every step you need to check if you are near the target (position distance == 1) and then you can execute your code to heal and delete the summon.
Will you have a script? I'm barely learning
 
I did something similar in my free services thread, but instead of healing it was to do damage in the area
I will look for it and inform you if I can make it heal, for you

This is what I meant, if this is similar to what you are looking for, then you can tell me that it is and I do you the favor of converting it as a healing
 
Last edited:
I did something similar in my free services thread, but instead of healing it was to do damage in the area
I will look for it and inform you if I can make it heal, for you

This is what I meant, if this is similar to what you are looking for, then you can tell me that it is and I do you the favor of converting it as a healing
I want something like this, see how the pink ball gets closer to the boss, if it gets completely close to the boss it heals it


Or simply that the monster walks only in one direction as in the video
 
Perfect, it looks even easier, I will do it for you, right now I can not, but you will be first on the list when I am answering things here in the forum
If someone else does it for you I will not have problems, then I can help you in other littlethings
 
Perfect, it looks even easier, I will do it for you, right now I can not, but you will be first on the list when I am answering things here in the forum
If someone else does it for you I will not have problems, then I can help you in other littlethings
thaanks, wait for youu if nobody else helps me hahaha
 
up!
Sorry to revive the topic but I have the same problem, I can't do this code
I invite you to check that GIF the guy sent where he explains what he wants it to do and think of the problem as simple as you can, in that picture there is no complex code of monsters moving, its far easier than that, you can simply just set actions ids on the tiles around "the path" in which the monster should walk, all the tiles with ids should just not allow the monster to step out which is super easy, after that just set the monster to retarget often in the monster xml.

Doing those 2 things solves 90% of the problem, since the monster will be constantly trying to find a path to his target which will force the monster to walk eventually into the boss which he is meant to heal, last but not least the final part would be to create probably just a simple spell which checks the distance between itself and the boss, if its equal to 1 then just heals the boss and removes the creature (it would be easy if the boss if the one casting this spell as a check every 1/2 seconds, so it can heal itself, that way you avoid making the code a little harder)
 
I invite you to check that GIF the guy sent where he explains what he wants it to do and think of the problem as simple as you can, in that picture there is no complex code of monsters moving, its far easier than that, you can simply just set actions ids on the tiles around "the path" in which the monster should walk, all the tiles with ids should just not allow the monster to step out which is super easy, after that just set the monster to retarget often in the monster xml.

Doing those 2 things solves 90% of the problem, since the monster will be constantly trying to find a path to his target which will force the monster to walk eventually into the boss which he is meant to heal, last but not least the final part would be to create probably just a simple spell which checks the distance between itself and the boss, if its equal to 1 then just heals the boss and removes the creature (it would be easy if the boss if the one casting this spell as a check every 1/2 seconds, so it can heal itself, that way you avoid making the code a little harder)
I agree with the part of using a spell as check, so if there's a rat in the spell area, it removes the monster and heals itself. About the targeting, is there a way to make an specific monster only attack creatures with "x" name?

To avoid all the player related code, it could be just a monster summoned by pilar (monster with item id as outfit, would be even better if this "summoner monster" is permanently invisible so it doesn't interfere player path); and than this monster summoned by the pilar doesn't need a convince creature rune (like happens with hellgorak on inquisiton quest), it just spawns and automatically attacks target with name "x".

Just tried to push the post with some ideas, but I don't really know how to code all this haha
Regards!
 
I invite you to check that GIF the guy sent where he explains what he wants it to do and think of the problem as simple as you can, in that picture there is no complex code of monsters moving, its far easier than that, you can simply just set actions ids on the tiles around "the path" in which the monster should walk, all the tiles with ids should just not allow the monster to step out which is super easy, after that just set the monster to retarget often in the monster xml.

Doing those 2 things solves 90% of the problem, since the monster will be constantly trying to find a path to his target which will force the monster to walk eventually into the boss which he is meant to heal, last but not least the final part would be to create probably just a simple spell which checks the distance between itself and the boss, if its equal to 1 then just heals the boss and removes the creature (it would be easy if the boss if the one casting this spell as a check every 1/2 seconds, so it can heal itself, that way you avoid making the code a little harder)
How do I set the monster to just walk? because he keeps trying to reach the player and doesn't move


videogif.gif
 
Back
Top