---------------------------------------------------------
Follow v0.3(beta2) Module for D2HackIt
    by Optimal Genes (optimal_genes@yahoo.com.au)

http://www.geocities.com/optimal_genes/follow.html

23 Mar 2002
---------------------------------------------------------

This module turns your character into a follow'bot, your character will follow 
another player in the game.

The main reason I wrote this is Self-leeching. This makes my 2nd character in 
the game some what useful rather then just standing by a waypoint. Besides you 
now have 7 new choices for (much more powerful) merc =)

Updates
-------
v0.1(beta) Feb   2002	(Pre)Release
v0.1	   Mar05 2002 	fixed TP code, added code from wanderer, added WP commands
v0.2       Mar09 2002 	cave/wp follow, defensive/auto attack, 
            			autoresurr, ini file, color status display	
v0.3(beta) Mar16 2002   follow into red portals, major changes to code structure.
v0.3(beta2)Mar19 2002   reset skill after tp, teleport follow, notify option,
						correct strncmp bug in wp command
v0.3	   Mar23 2002	heal command, enable whisper control

D2hackIt commands
------------------

.follow list

    *previously(v0.1) .follow info*	
    Display a list of known players, in the following format
    Player Id, Name
    New players will be added to this list when they come into 
    your character's sight (approx 1~2 screens distance).

.follow start [Id | MasterName]

    Start following the player with the given Id (refer to as the Master)
    your character will now automatically move with the given player 
    when he/she comes into sight (active range approx 1 screen)
	*NEW v0.3* you can now use the name of the master character instead of 
	id, and you can issue this even before master has joined the game. 
	As soon as the master is detected you will see "Master MasterName(Id)" 
	on the bot screen. And bot will start following right away.

.follow stop

    Stop following

.follow attack

    Toggle attacking mode.

.follow auto [ON|OFF]

    Turn on/off auto attack. 

.follow shift

    Toggle shift attack, ON means bot will shift-attack [range bot]
    OFF means bot will click-attack (run to target) [melee bot]

.follow block

    Toggle sync block
    Block attempts from client to re-sync with server. if your bot
    kept on returning to it's original location turn this on, however
    sync block can sometime cause the module to crash.
	
.follow notify

    Toggle bot overhead msg
    see if anyone will recognise it's a bot =)

.follow status

    show current status of the module

.follow reload

    reload settings from follow.ini file.

.follow save

    save bot states to follow.ini file

.follow debug [devel | packet]

    toggle debugging.
    devel add some extra debugging
    packet added packet level debugging


Verbal Commands
---------------
Verbal commands can now be redefined in follow.ini

The master can give the following commands (simply type as a text message). Only 
text command from the master will be accepted, so other players won't be able to 
control your follow bot. All the commands are non case sensitive. 

*NEW v0.3* you can now whisper to your bot so it won't be heard by anyone else. 
suggestion is to use the BIND module to do this, so you don't even have to type 
the actual command. 

stay
    Tell follow bot to stay at current position

follow
    Tell follow bot to start following again (cancel stay command)

town
    Tell follow bot to go back to town (cast tp and go to town)

go
    Tell follow bot to return to the wilderness (via previously casted tp)
	(bug?: sometimes need to repeat a few times for it to work)

take tp
    Tell follow bot to take a town portal you just casted, 
    works both in town & wilderness
*NEW v0.3* "take tp playername" to have bot take someone else's tp
	(bug?: sometimes need to repeat a few times for it to work)

wp wpname
    If the follow bot is stand close enough to a waypoint, it will
    go to the wp named by the master. follow bot must already have that wp.
    You must have the same spelling as shown on the wp for it to work.

attack 
    Toggle attack 

switch
    Switch between left and right attack, if notify is on, bot will 
    display the skill selected via overhead message.

w
    Swap weapon
    
heal npcname

	Tell bot to heal at npcname. Note: typing heal without npcname also works if 
	the last seen healer npc is the one in the current act. 


INI File
--------

You can redefined the verbal commands and the start up state of the bot via the 
ini file. Just replace the existing commands with your desired ones. To change 
the start up bot states, simpley set the values to ON or OFF. You should only 
set TELEPORT=ON if you are using a sorc bot (which must have the teleport 
skill already)

[Commands]
CMD_GOFIELD=go
CMD_RETTOWN=town
CMD_STAY=stay
CMD_FOLLOW=follow
CMD_ATTACK=attack
CMD_TAKETP="take tp"
CMD_SWITCH=switch
CMD_WAYPOINT=wp
CMD_WEAPONSWITCH=w
CMD_GETHEAL=heal
[BotState] 
ATTACK=OFF
SYNCBLOCK=OFF
SHIFTATTACK=OFF
AUTOATTACK=OFF
NOTIFY=ON
TELEPORT=OFF

Bot Behaviour & Play Suggestion
-------------------------------
Follow bot will automatically accept the master's party invite. 

Bot will follow into waypoints, caves, red portals(stony/cow/pindle/etc).

Sorc Bot with TELEPORT=ON will teleport with the master sorc. Other class bots 
will ignore teleport.

Bot will attack the monster you are attacking if set to attack mode. If auto 
attack mode is enabled, bot will attack any melee monsters that's heading for 
you or the bot. The verbal "switch" command changes between left and right 
skill, and "w" command switch to the bot's 2nd weapon, so the combination place 
4 different bot skills under your control. 

Messages which display over the bot's head
    aim     - bot targeting a monster (when master click on a monster)
    no aim  - bot targeting a location (when master click on the ground)
    auto    - bot auto targeting a monster
	swap weapon 
			- confirmation of weapon swap
	Using (shift) left/right skill : Skillname
			- confirmation of bot switching attacking skill to left/right,
			if "shift" is seen, it means shift-attack (range) is being used
			by the bot, the skill selected will also be displayed.
			
Auto attack remains in effect even if bot is not currently following master. 
This should keep the bot relative safe if you decide to leave it standing some 
where. 

If you just loaded the follow module, press "w" (weapon switch) or reselect the 
left/right attack skill to allow the module to register the current skills 
selected on the bot. You don't have to do this again if you joined a game with the 
module already loaded. (Even if you rejoin with a different char)

Necro can cast curses instead of attacking (Curse Bot). Corpse explosion does not 
seem to work yet.

The Follow bot should have same or better run speed then the master, so he/she 
won't fall too far behind. Most of the time he/she will just be a step behind 
you. (i.e. your last position) Note follow bot can get stuck in a corner or 
behind some obstacle - similar to the old problem with mercs. Simply run back to 
the bot and lead it around the obstacle. Follow bot will usually follow you in 
caves. (see FAQ)

Hundreds of new master/bot/merc/merc combinations! 
Send me your favourite combinations!

Combining this module with AutoSkill by Maulei (http://jonathan.makes.it), and 
you can have a Paladin following you around flashing auras or a Barb with his 
various cries, or Druid with Sage/HOW/minions. Other modules such as 
GameTrigger, TRainer also makes a good combination with this module. 

Use a high level character as the follow bot, have it open TP to waypoints, (use 
the "wp" command followed by the "town" command) and act as your body guard. 
(master get close enough to a group of monsters to take a swing) and watch the 
orb/multi from your bot do the killing.

Have fun in the cow level =) Ofcourse it's up to the master to protect the
follow bot. Trapsin with death sentry is a good follow bot choice.

Single/offline players - enjoy the benefit of party play without having to go online.

It is possible to follow a neutral or hostile player
    - however you can't follow them through waypoints, as bot won't know where the player 
went unless he/she is in your party.


Installation
------------
Copy follow.d2h and follow.ini to D2HackIt folder


Suggestions & Bug Report
------------------------ 
If you are reporting a bug, please describe clearly what you are attempting to 
do, best done with a step by step descriptions, so I can attempt to duplicate 
the problem.

The core follow module is nearly completed. I am working on improving the 
attacking code. I need new ideas on improvements with this module. Send me your 
suggestions.

If you are interested in helping with this Bot project let me know.
Email to optimal_genes@yahoo.com.au


Limitation & Future Plans (TODO)
-------------------------
Can't Auto Drink Potion. - use gametrigger/trainer module
Can't auto pick up corpse. - use trainer module?
Can't follow player through a town portal. - use "take tp" command
Can't follow through arcane red teleporters. - so don't go there!

Localised verbal command - Someone let me know if you put say Korean or other 
unicode language in the .ini file does the command work in the game? 

Auto Attack - currently only attacks when the master attacks
	- non targeted
        - targeted
	- Necro's corpse explosion don't seem to work

Different Attack AI
    - range
    - melee
        body guard - staying right next to you
        tank       - engage monster within a certain range.

PvP - I won't be working on PvP codes, however there's someone currently
	testing some pvp attacking codes. 

FAQ
---

Q. How do I even start the follow in game?

A. after you load the module with

	.load follow

  1) If the master is already in game, make the master take the waypoint to a
     different location and then back to the same location as the follow bot,
  2) If the master is not yet in game. when the master joins and comes into
     the follow bot's view,

You will see the player id and player name of master displayed on the follow bot
computer when your lead comes in range.
eg 
	Player 3, SomeHotshotPlayer

	.follow start 3

to start following that player. 

	*NEW v0.3*
  3) you can now issue the start command with master's name, eg
  
	.follow start SomeHotshotPlayer	

it works the same as using player id, but can also be typed in even before the 
master has joined the game, and bot will check each new player to see if its the 
master - as soon as master is detected (come into view), a message will be 
displayed on the bot client screen and bot will start following.

Q. How do I find out player Id?

A. At anytime you can use

	.follow list

to display the list of player the follow bot currently known about, and you can 
re-issue the follow start command to make the follow bot follow someone else.

Q. My follow bot don't respond to the go/taketp command!

A. There appears to be a delay that affects how the follow bot interacts with the 
tp, issue the command a couple of times and it should work. (It will generally 
works on the 2nd try)

Q. Follow bot won't take my town portal!

A. Make sure the bot is in your party and is close enough to the town portal. 
Generally you can do this by making the bot stays in the area where tp spawns, 
take wp to where you want to go, cast a tp, and then issue the take tp command 
(a couple of times), and you should see the bot coming through your tp.

Q. Follow bot does not respond to the wp command!

A. Firstly make sure your bot has the waypoint in question. If you don't have 
that wp, then you can't go there - until someone come up with a wp hack. Second 
make sure your bot is close enough to the wp. Finally check the spelling of the 
wp. Also if you are attemping to use the town wp straight after you load the 
module, the wp id may not have being captured yet. Make the bot take the wp to a 
different location and back, that should make the server resend thd wp id.

Q. Follow bot does not follow me through waypoints!

A. Follow bot can only follow you through waypoints if you are in the same 
party. Otherwise it won't know which waypoint you went to. Also see the previous 
question relating to wp id.

Q. Can you close the wp screen after it goes through the wp.

A. I am working on that - need to find the packet to send to the client side.
shopbot has the same problem I believe.

Q. Follow bot does not follow me into caves!

A. For some reason the packet(10) I am monitoring is not always send by the 
server. So you might need to move back and forth a couple of times at the 
entrance. Also make sure the bot is close enough to the entrance before you 
enter. (Standing right next to the entrance would be good :)

Q. My follow bot doesn't attack!

A. The attack animation does not show on the follow bot's screen. However it 
will show on the master or another other observer's screen. Also have you 
remember to toggle the attack mode? Currently bot will only attack melee 
monsters who are walking to you or the bot.

Q. "heal" command doesn't work.

A. Make sure you bring the bot close to the healer npc. Also if you've just 
loaded the module, the npc id won't have being captured yet, go out of town and 
back.




