Not sure exactly what the companion command does. Obviously it sets npc as companion but this seems redundant to me.
That script youve got up there is attached to the npc and will ensure it keeps pace with you
All that script needs is a "Begin script_name" at the top and an "End" command at the end.
As for the actual following aspect:
Could arrange it like this:
1. [talking to the npc, for whatever reason they decide to follow you.]
2. In the conditions box at the bottom for THAT end dialogue, simply put in this command
AIFollow "player" 0 0 0 0. This will direct that npc to follow the player. I am not 100% sure if they will act as a companion and defend you, etc; but i strongly suspect that they will defend and generally aid you in battle when they are following you.
3. The tricky bit is at the destination. Personally, i would knock up a simple script that only runs ONCE. This script would be attached to an invisible (ingame) marker which would detect when you are within range of it. Basically to detect that you have arrived. This script would also include a check to make sure the relevent journal entry is there, assuming you are doing this all through a quest, which you should. I assume you know about that side of it. Also, this script basically will confirm your distance and immediately update the quest to the next stage and engage the NPC to talk to you. (and then we'll discuss what to do after)
Begin script_name if ( GetJournalIndex "quest_id" == 10 ) if ( GetDistance player < 200 ) Journal "quest_id" 20 NPC->Forcegreeting endif endif End
4. At this stage the NPC should be talking to you. Because the journal has been updated, you can use this as a 'requirement' for the new dialogue options you want. Lets assume you now want the npc to stay at the location. In the condition box for the dialogue, simply put
AiWander 0 0 0 0 0 0 0 0 0 0 0 0. This will make the npc stay still and not move around. By changing the numbers at the end, you can configure this in your own time. (i just stick with this generally, stop them wandering off
)
And there you go.
This is how i manage my "follow" scenarios. I realise this may be slightly different to how most people do it but i do it because it gives me very precise control over when and how npc's follow me, and also because i have no idea how to organise "destinations" or anything more precise than general cells.
This method has never failed me, and i have had no reason to investigate any other way of doing it.
Hope that helps. Not 100% sure i answered what you wanted, but im too tired to check ^_^