I recently took a interest in the game again after some years and decided to do some modding on it.
What i want to do: a script that is activated by a item or a spell that spawns (not summon) a follower creature that will fight for the player.
Thank you. It worked. But now there’s another problem.
Is there any way to make them follow the player (in and out of interiors too) without the need for me to hire them through the dialog? As soon as they spawn?
I wouldn’t consider this easiest in terms of learning curve. If it works - great, but when I need a fast & dirty way of activating test scripts, I put this as OnPlayerChat handler (in module preferences):
@Gyugas Type the script name into chat line and hit enter to make the PC execute it.
// get PC and henchman
object oPC = GetFirstPC();
object oHenchman = GetObjectByTag("MY_HENCH");
// check if oHenchman does not have a master already
if(!GetIsObjectValid(GetMaster(oHenchman)))
{
// add oHenchman as follower of oPC
AddHenchman(oPC, oHenchman);
// make henchman responsive to PC commands
SetListening(oHenchman, TRUE);
SetAssociateListenPatterns(oHenchman);
SetListenPattern(oHenchman, "inventory",101);
SetListenPattern(oHenchman, "pick",102);
SetListenPattern(oHenchman, "trap", 103);
}
You will also need a set of scripts for the creature - copy them from any built-in NPC henchman, line Linu, Tomi, etc (they are in the “other” group). If you do this, the “make henchman responsive to PC commands” part will be done for you.
The ActionForceFollowObject worked. I didn’t before because i didn’t know that you need to start a new game to see changes to the module. I added it to OnSpawn and OnHeartbeat and everything is working fine. Thank you both.