|First create your companion NPC (Click here for a tutorial on how to create an NPC).
I made a fighter/wizardl evel 1/1 and called him Melf the Elf. His Tagname is "melf" and his resref/template was gh_henchman_melf01.
Load up this new NPCs properties and select import properties->script set and load up "c_CompanionScripts.xml".
If you do not have this file you can create it by loading the properties of one of the official campaigns companions and selecting export properties->script set and save as "c_CompanionScripts.xml".
Next create a conversation. (Click here for tutorial on how to create a conversation.)
Right click the root section, select add and for the text just say "Would you like a new companion?"
Right click the line you just created and then click add and for the text use "Yes, please join my group.".
Now, find and click the "Actions" tab below and add the following global action scripts:
Once you have all the scripts added and in the order above click "refresh" for each script to see the variable options. Once you see those enter in the following values:
ga_roster_add_object sRosterName:melf sTarget:melf
ga_roster_selectable sRosterName:melf bSelectable:1
ga_reset_level sCreature:melf bUseXPMods:1
Replace "melf" with whatever tag you used for your companion (it must be 10 characters or less).
Save the conversation and then add it to your new companions conversation (under properties - behaviour).
Place the NPC somewhere in your module and go talk to him. Hit the "yes" response and he should be your new best friend!