Tassadar Posted July 29, 2020 Group: Members Topic Count: 52 Topics Per Day: 0.02 Content Count: 107 Reputation: 5 Joined: 07/21/16 Last Seen: January 27 Share Posted July 29, 2020 guys. does anyone know how I get a monster to walk from position x to position y. if he finds a player he stops walking and fights with the player. if the player teleports or dies he moves from x to y again. thank you. Quote Link to comment Share on other sites More sharing options...
0 Kreustoo Posted July 29, 2020 Group: Members Topic Count: 34 Topics Per Day: 0.01 Content Count: 216 Reputation: 45 Joined: 05/03/13 Last Seen: March 9 Share Posted July 29, 2020 (edited) Hello, I think you have to use uid to move (unitwalk) and check if there's any player in the area around the monster and make it attack the player (unitattack). As long as you make the unit walk he won't attack automatically. To ge the monster uid you can catch the id return by the monster command. The doc: *unitwalk <GID>,<x>,<y>{,"<event label>"}; *unitwalkto <GID>,<Target GID>{,"<event label>"}; This command will tell a <GID> to walk to a position, defined either as a set of coordinates or another object. The command returns a 1 for success and 0 upon failure. If coordinates are passed, the <GID> will walk to the given x,y coordinates on the unit's current map. While there is no way to move across an entire map with 1 command use, this could be used in a loop to move long distances. If an object ID is passed, the initial <GID> will walk to the <Target GID> (similar to walking to attack). This is based on the distance from <GID> to <Target ID>. This command uses a hard walk check, so it will calculate a walk path with obstacles. Sending a bad target ID will result in an error. An optional Event Label can be passed as well which will execute when the <GID> has reached the given coordinates or <Target GID>. Examples: // Makes player walk to the coordinates (150,150). unitwalk getcharid(3),150,150; // Performs a conditional check with the command and reports success or failure to the player. if (unitwalk(getcharid(3),150,150)) dispbottom "Walking you there..."; else dispbottom "That's too far away, man."; // Makes player walk to another character named "WalkToMe". unitwalkto getcharid(3),getcharid(3,"WalkToMe"); --------------------------------------- *unitattack <GID>,<Target ID>{,<action type>}; *unitattack <GID>,"<Target Name>"{,<action type>}; This command will make a <GID> attack the specified target. It returns true upon success and false for all failures. If <GID> is a player and a non-zero <action type> is given, the unit will perform a continuous attack instead of a single attack. Note: Using unitattack with <GID> 0 means that it will use the currently attached unit. For players any attack requests will fail, because talking to an NPC prevents attacking a monster. Therefore you need to detach the player from the NPC before using this command. Edited July 29, 2020 by Kreustoo 1 Quote Link to comment Share on other sites More sharing options...
0 Sehrentos Posted July 30, 2020 Group: Members Topic Count: 6 Topics Per Day: 0.00 Content Count: 91 Reputation: 22 Joined: 10/24/14 Last Seen: November 1, 2024 Share Posted July 30, 2020 Yes, unit commands and you can also use a timer to check for nearby players to get players GID 1 Quote Link to comment Share on other sites More sharing options...
Question
Tassadar
guys. does anyone know how I get a monster to walk from position x to position y. if he finds a player he stops walking and fights with the player. if the player teleports or dies he moves from x to y again. thank you.
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.