Sorry. I was out of town for several days and lost track of this thread.
I suggest creating a hidden activator with the following script attached:
Begin THM_CellScriptshort doOncefloat timerif ( doOnce == 1 ) returnendifset timer to ( timer + GetSecondsPassed )if ( timer < 1 ) returnendifset doOnce to 1"THM_skltn escort"->ForceGreetingEnd THM_CellScript
This code has not been tested. You can change the duration of the timer delay.
The greeting you want your skeleton to use must be very narrowly filtered - you want it to be used only once. If there it a journal associated with these events, filter the greeting for the expected journal index and then update that the journal in the greeting's dialog results. That will prevent it from being used again. Also in dialog results you will assign the AIPackage. AIEscort requires the destination coordinates that I do not know so I will illustrate using variables. You will need to determine the coordinates of the destination and update the instructions:
AIEscort player 0 x y zYou describe that the other skeletons will follow the player (escorting from behind). To achieve this you need lines in dialog results that look like this:
"THM_skltn_ID" AIFollow player 0 0 0 0I do not know how far a journey this is or if there are any obstructions. A pathgrid will greatly improve the chances of success. Since this appears to be a new interior cell you can add a pathgrid without concern for how it would be affected by other mods.
The attack AI is also difficult for me to construct for you since I do not know the exact circumstances that you would have this happen. Detecting combat is problematic as I first posted. Also if combat should break out between the player and the escorting skeleton the other skeletons (because they are following the player) will ally with the player against the escorting skeleton.
You might dabble with
OnPCHitMe,
GetAttacked and
GetTarget. A script on the escorting skeleton would need to include code like this:
short OnPCHitMeif ( OnPCHitMe == 1 ) ; player has attacked skeleton set OnPCHitMe to 0 ; makes this action do-once SetFight 100 ; for skeleton that is attacked SetFlee 0 ; for skeleton that is attacked StartCombat player ; for skeleton that is attacked "THM_skltn_ID"->SetFight 100 ; for each other skeleton "THM_skltn_ID"->SetFlee 0 ; for each other skeleton "THM_skltn_ID"->StartCombat player ; for each other skeletonendif
or…
short doOnceif ( doOnce == 0 ) if ( GetAttacked == 1 ) ; player has attacked skeleton set doOnce to 1 ; do not repeated start combat SetFight 100 ; for skeleton that is attacked SetFlee 0 ; for skeleton that is attacked StartCombat player ; for skeleton that is attacked "THM_skltn_ID"->SetFight 100 ; for each other skeleton "THM_skltn_ID"->SetFlee 0 ; for each other skeleton "THM_skltn_ID"->StartCombat player ; for each other skeleton endifendif
or…
short doOnceif ( doOnce == 0 ) if ( ( GetTarget player ) == 1 ) ; skeleton has targeted player (presumably attacked) set doOnce to 1 ; do not repeated start combat SetFight 100 ; for skeleton that is attacked SetFlee 0 ; for skeleton that is attacked StartCombat player ; for skeleton that is attacked "THM_skltn_ID"->SetFight 100 ; for each other skeleton "THM_skltn_ID"->SetFlee 0 ; for each other skeleton "THM_skltn_ID"->StartCombat player ; for each other skeleton endifendif
None of these scripts have been tested. You may require a version of whichever one of the three scripts you choose to be attached to the 'guard' skeletons since the player could attack on of them first. Otherwise the remaining skeletons will not react to the player's attack.