unknownhero2827 Posted October 1, 2015 Share Posted October 1, 2015 Scriptname IFFollowerScript short doOnce short regulator ref refnpc float CurrentDay Begin OnLoad set refnpc to GetSelf set CurrentDay to GameDaysPassed SetIgnoreFriendlyHits 1 End Begin Gamemode if ( GetInSameCell player == 1 && doOnce == 0 ) AddScriptPackage IFFollowPackage AddItem IFDoNotDespawnToken 1 set doOnce to 1 endif if GetCurrentPackage == IFFollowPackage if GetDistance Player > 8000 MoveTo Player endif if GetInSameCell Player == 0 && GetDistance Player > 8000 MoveTo Player endif if Player.IsWeaponOut == 1 SetAlert 1 elseif Player.IsWeaponOut == 0 SetAlert 0 endif if Player.IsSneaking == 1 AddScriptPackage IFFollowSneakPackage endif endif if GetCurrentPackage == IFFollowSneakPackage if GetDistance player > 8000 && GetDistance Player > 8000 MoveTo Player endif if GetInSameCell Player == 0 MoveTo Player endif if Player.IsWeaponOut == 1 SetAlert 1 elseif Player.IsWeaponOut == 0 SetAlert 0 endif if Player.IsSneaking == 0 AddScriptPackage IFFollowPackage endif endif if GetCurrentPackage != IFFollowPackage if GetCurrentPackage != IFFollowSneakPackage SetAlert 0 endif endif if GetItemCount IFShareToken == 1 if regulator == 3 AddItem Torch02 1 EquipItem Torch02 RemoveItem Torch02 1 set regulator to 0 toggleActorsAI RemoveItem IFShareToken 1 endif if regulator == 2 && MenuMode == 0 set regulator to 3 IFShareChestRef.RemoveAllItems refnpc endif if regulator == 1 toggleActorsAI RemoveAllItems IFShareChestRef IFShareChestRef.Activate Player set regulator to 2 endif if regulator == 0 IFShareChestRef.MoveTo Player 0 0 -50 IFShareChestRef.setOwnership set regulator to 1 endif endif if ( GamedaysPassed >= CurrentDay + 3 ) if GetDead == 1 refnpc.MoveTo IFCleanupCellMarker RemoveItem IFDismissToken 1 RemoveItem IFDoNotDespawnToken 1 ResetInterior IFCleanupCell elseif GetItemCount IFDismissToken >= 1 refnpc.MoveTo IFCleanupCellMarker RemoveItem IFDismissToken 1 RemoveItem IFDoNotDespawnToken 1 ResetInterior IFCleanupCell endif endif End Begin OnDeath RemoveScriptPackage MessageBox "A companion has fallen." End ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; So far the script appears to work as I want it to, but I'm sure I haven't optimized it well. Link to comment Share on other sites More sharing options...
Recommended Posts