MesaSolar Posted October 3, 2020 Share Posted October 3, 2020 NPC is in Captive FactionUsing SitTarget AI package linked to a ShackleWallMarker ShackleWallMarker and NPC both linked to an Xmarker But when I get too close to the NPC they just fall out of the shackles and stand up. Need to do 2 things: 1st make them stay in the damn shackles and 2nd free them from the shackles after clicking on them. Thoughts? Link to comment Share on other sites More sharing options...
MesaSolar Posted October 4, 2020 Author Share Posted October 4, 2020 I found this script in FO4 and wonder if it could be adjusted for skyrim? Scriptname DefaultCaptiveActor extends Actor ;This script pops a message box when activating the prisoner;if player frees, adds captors, himself, and prisoner to factions to make people hate each other;You should make sure elsewhere that the captors have aggression high enough to attack their enemies Group MainPropertiesbool Property DisableOnUnload = false Auto Const{after being freed, this actor will disable when unloaded}bool Property AlsoRemoveFromCaptiveFaction = false Auto Const{after being freed, this actor will also be removed from the CaptiveFactionUse this for actors that will be attacked while fleeing}int Property AggressionAfterFreed = -1 Auto Const{freed actor will be set with this aggression}EndGroup Group SetStagePropertiesQuest Property myQuest Auto{ If this is set, set the stage on this quest if StageToSetWhenFreed is not -1If myQuest is NOT set, it will try to set the stage on the owning quest}int Property StageToSetWhenFreed = -1 auto const{ this stage will be set when the prisoner is freed }int Property StageToSetOnCleanUp = -1 Auto Const{ this stage will be set when we try to clean up the actor }bool Property bSetStageOnlyIfPlayerFreed = true auto const{ false is always set stage when prisoner is freed } EndGroup Group CleanUpPropertiesFloat Property CleanUpTime = 180.0 Auto{ Timer is started after freeing this prisoner, then once it has expired, clean up is viable when possible}EndGroup Group AutoFillPropertiesKeyword Property RESharedDialoguePrisonerSetFree Auto const Message Property REPrisonerMessageBox Auto constFaction Property BoundCaptiveFaction Auto constFaction Property CaptiveFaction Auto Const RefCollectionAlias Property Captors Auto const{ Try to get this from quest script REScript }EndGroup bool bound = True int iDoNothing = 0int iSetFree = 1int iSetFreeShareItems = 2int CleanupTimerID = 999bool ReadyToCleanup = false Event OnInit()AddToFaction(BoundCaptiveFaction)EndEvent Event OnLoad()if bound; TODO when we have it;playIdle(OffsetBoundStandingStart) ;DL added this for short term useSetRestrained()SetFactionRank(BoundCaptiveFaction, 0)EndIfRegisterForHitEvent(self, Game.GetPlayer())EndEvent Event OnUnload()if DisableOnUnload && ReadyToCleanupClearFactions()Disable()DeleteWhenAble()endifEndEvent Event OnTimer(int aiTimerID)if aiTimerID == CleanupTimerIDReadyToCleanup = trueendifEndEvent Event OnActivate(ObjectReference akActionRef) if IsDead() || IsinCombat() debug.trace(self + "OnActivate() IsDead() or IsInCombat() so not showing message box") Elseif Bound == true debug.trace(self + "OnActivate() will call show message box") Actor ActorRef = self int result = REPrisonerMessageBox.show() if result == iDoNothingdebug.Notification("DO NOTHING") elseif result == iSetFreedebug.Notification("SET FREE") FreePrisoner(ActorRef, OpenPrisonerInventory = False) elseif result == iSetFreeShareItemsdebug.Notification("SET FREE SHARE ITEMS") FreePrisoner(ActorRef, OpenPrisonerInventory = True) EndIf EndIfEndEvent Event OnHit(ObjectReference akTarget, ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked, string asMaterialName) if AkAggressor == game.getPlayer();Game.GetPlayer().AddToFaction(REPrisonerFreedCombatPrisonerFaction);AddRemoveCaptorFaction(REPrisonerFreedCombatCaptorFaction)endifRegisterForHitEvent(self, Game.GetPlayer())endEvent Function FreePrisoner(Actor ActorRef, bool playerIsLiberator= true, bool OpenPrisonerInventory = False) debug.trace(self + "FreePrisoner(" + ActorRef + "," + playerIsLiberator + ", " + OpenPrisonerInventory +")") ActorRef.SetFactionRank(BoundCaptiveFaction, 1) if AlsoRemoveFromCaptiveFactionActorRef.RemoveFromFaction(CaptiveFaction)endif ;DL added this for short term useSetRestrained(false) ActorRef.EvaluatePackage()if playerIsLiberator;Game.GetPlayer().AddToFaction(REPrisonerFreedCombatPrisonerFaction)EndIf if OpenPrisonerInventoryActorRef.openInventory(True)EndIf ActorRef.SayCustom(RESharedDialoguePrisonerSetFree)bound = False ;AddRemoveCaptorFaction(REPrisonerFreedCombatCaptorFaction) if StageToSetWhenFreed > -1if playerIsLiberator || bSetStageOnlyIfPlayerFreed == falseif myQuestmyQuest.SetStage(StageToSetWhenFreed)else;GetOwningQuest().SetStage(StageToSetWhenFreed)endifendifendifActorRef.EvaluatePackage() ;Start The clean up timer, actor will not be clean up till after thisStartTimer(CleanUpTime, CleanupTimerID)EndFunction ;call when quest shuts downFunction ClearFactions() ;Game.GetPlayer().RemoveFromFaction(REPrisonerFreedCombatPrisonerFaction)RemoveFromFaction(BoundCaptiveFaction);TryToRemoveFromFaction(REPrisonerFreedCombatCaptorFaction) ;AddRemoveCaptorFaction(REPrisonerFreedCombatCaptorFaction, false) if StageToSetOnCleanUp > -1if bSetStageOnlyIfPlayerFreed == falseif myQuestmyQuest.SetStage(StageToSetOnCleanUp)else;GetOwningQuest().SetStage(StageToSetOnCleanUp)endifendifendifEndFunction The only change I could see to make would be from this: RESharedDialoguePrisonerSetFree to THIS: WESharedDialogue where WESharedDialogue is the dialogue used by freed captives. So I tried making that small adjustment and creating a new script but I go the following error message: Starting 1 compile threads for 1 files...Compiling "APWDefaultCaptiveActorScript"...G:\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\APWDefaultCaptiveActorScript.psc(10,6): Unknown user flag ConstG:\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\APWDefaultCaptiveActorScript.psc(12,6): Unknown user flag ConstG:\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\APWDefaultCaptiveActorScript.psc(15,5): Unknown user flag ConstG:\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\APWDefaultCaptiveActorScript.psc(17,8): no viable alternative at input '\\r\\n'G:\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\APWDefaultCaptiveActorScript.psc(23,5): Unknown user flag constG:\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\APWDefaultCaptiveActorScript.psc(25,5): Unknown user flag ConstG:\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\APWDefaultCaptiveActorScript.psc(27,6): Unknown user flag constG:\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\APWDefaultCaptiveActorScript.psc(30,8): no viable alternative at input '\\r\\n'G:\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\APWDefaultCaptiveActorScript.psc(35,8): no viable alternative at input '\\r\\n'G:\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\APWDefaultCaptiveActorScript.psc(38,9): Unknown user flag constG:\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\APWDefaultCaptiveActorScript.psc(40,9): Unknown user flag constG:\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\APWDefaultCaptiveActorScript.psc(41,9): Unknown user flag ConstG:\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\APWDefaultCaptiveActorScript.psc(43,20): Unknown user flag constG:\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\APWDefaultCaptiveActorScript.psc(45,8): no viable alternative at input '\\r\\n'G:\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\APWDefaultCaptiveActorScript.psc(115,0): mismatched input 'Function' expecting ENDEVENTNo output generated for APWDefaultCaptiveActorScript, compilation failed. Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on APWDefaultCaptiveActorScript Link to comment Share on other sites More sharing options...
Evangela Posted October 4, 2020 Share Posted October 4, 2020 SetRestrained() is the key here. They need to be linked to the shackles and have SetRestrained() called so they stay put. To release them, SetRestrained(false) needs to be set in the OnActivate() event. Link to comment Share on other sites More sharing options...
MesaSolar Posted October 4, 2020 Author Share Posted October 4, 2020 SetRestrained() is the key here. They need to be linked to the shackles and have SetRestrained() called so they stay put. To release them, SetRestrained(false) needs to be set in the OnActivate() event.Do you mean to add that to the above script? Or make an entirely new one with just those two parameters? Link to comment Share on other sites More sharing options...
MesaSolar Posted October 5, 2020 Author Share Posted October 5, 2020 I managed to find WEPrisonerAliasScript and attached it to my NPC's alias. Autofilled the properties. This appears to be similar to what I found in FO4. But even with this attached nothing happens when I click on the NPC. Sometimes they even just fall out of the shackles after killing their "captor" So not sure what the problem is: Scriptname WEPrisonerAliasScript extends ReferenceAlias ;This script pops a message box when activating the prisoner;if player frees, adds captors, himself, and prisoner to factions to make people hate each other;You should make sure elsewhere that the captors have aggression high enough to attack their enemies Topic Property WESharedDialoguePrisonerSetFree Auto idle Property OffsetBoundStandingStart Autoidle Property OffsetStop Auto Message Property WEPrisonerMessageBox AutoFaction Property WEPrisonerFreedFaction Auto Faction Property WEPrisonerFreedCombatCaptorFaction AutoFaction Property WEPrisonerFreedCombatPrisonerFaction Auto ReferenceAlias Property Captor1 AutoReferenceAlias Property Captor2 AutoReferenceAlias Property Captor3 AutoReferenceAlias Property Captor4 AutoReferenceAlias Property Captor5 Auto bool bound = True int iDoNothing = 0int iSetFree = 1int iSetFreeShareItems = 2 Event OnLoad()if boundGetActorReference().playIdle(OffsetBoundStandingStart)EndIf EndEvent Event OnActivate(ObjectReference akActionRef) if GetActorReference().IsDead() || GetActorReference().IsinCombat(); debug.trace(self + "OnActivate() IsDead() or IsInCombat() so not showing message box") Elseif Bound == true ; debug.trace(self + "OnActivate() will call show message box") Actor ActorRef = GetActorReference() int result = WEPrisonerMessageBox.show() if result == iDoNothing;debug.Notification("DO NOTHING") elseif result == iSetFree;debug.Notification("SET FREE") FreePrisoner(ActorRef, OpenInventory = False) elseif result == iSetFreeShareItems;debug.Notification("SET FREE SHARE ITEMS") FreePrisoner(ActorRef, OpenInventory = True) EndIf EndIfEndEvent Event OnHit(objectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)if AkAggressor == game.getPlayer()Game.GetPlayer().AddToFaction(WEPrisonerFreedCombatPrisonerFaction)Captor1.TryToAddToFaction(WEPrisonerFreedCombatCaptorFaction)Captor2.TryToAddToFaction(WEPrisonerFreedCombatCaptorFaction)Captor3.TryToAddToFaction(WEPrisonerFreedCombatCaptorFaction)Captor4.TryToAddToFaction(WEPrisonerFreedCombatCaptorFaction)Captor5.TryToAddToFaction(WEPrisonerFreedCombatCaptorFaction)endifendEvent Function FreePrisoner(Actor ActorRef, bool playerIsLiberator= true, bool OpenInventory = False); debug.trace(self + "FreePrisoner(" + ActorRef + "," + playerIsLiberator + ", " + OpenInventory +")") ActorRef.AddToFaction(WEPrisonerFreedFaction)ActorRef.AddToFaction(WEPrisonerFreedCombatPrisonerFaction)ActorRef.EvaluatePackage()if playerIsLiberatorGame.GetPlayer().AddToFaction(WEPrisonerFreedCombatPrisonerFaction)EndIf if OpenInventoryActorRef.openInventory(True)EndIf ActorRef.Say(WESharedDialoguePrisonerSetFree)bound = False Captor1.TryToAddToFaction(WEPrisonerFreedCombatCaptorFaction)Captor2.TryToAddToFaction(WEPrisonerFreedCombatCaptorFaction)Captor3.TryToAddToFaction(WEPrisonerFreedCombatCaptorFaction)Captor4.TryToAddToFaction(WEPrisonerFreedCombatCaptorFaction)Captor5.TryToAddToFaction(WEPrisonerFreedCombatCaptorFaction) ActorRef.EvaluatePackage() EndFunction Function ClearFactions();call when quest shuts down; debug.trace(self + "FreePrisoner") Game.GetPlayer().RemoveFromFaction(WEPrisonerFreedCombatPrisonerFaction) TryToRemoveFromFaction(WEPrisonerFreedCombatCaptorFaction)Captor1.TryToRemoveFromFaction(WEPrisonerFreedCombatCaptorFaction)Captor2.TryToRemoveFromFaction(WEPrisonerFreedCombatCaptorFaction)Captor3.TryToRemoveFromFaction(WEPrisonerFreedCombatCaptorFaction)Captor4.TryToRemoveFromFaction(WEPrisonerFreedCombatCaptorFaction)Captor5.TryToRemoveFromFaction(WEPrisonerFreedCombatCaptorFaction) EndFunction Link to comment Share on other sites More sharing options...
NexusComa2 Posted October 5, 2020 Share Posted October 5, 2020 You keep mentioning "they just fall out of the shackles". Leads me to believe there is something set wrong with the havok in the placement.. Link to comment Share on other sites More sharing options...
MesaSolar Posted October 5, 2020 Author Share Posted October 5, 2020 You keep mentioning "they just fall out of the shackles". Leads me to believe there is something set wrong with the havok in the placement..So I checked "don't havok settle" and they stay in the shackles after killing their captor. Now the only thing I need to fix is getting the message box to pop up to free them from the shackles and get them to return to the quest giver. Link to comment Share on other sites More sharing options...
NexusComa2 Posted October 6, 2020 Share Posted October 6, 2020 I seem to remember a quest involving the Thalmor. Maybe you are already aware of it. I forget the name. It was one where you had to go to a dinner party as a "spy". You end up freeing a NPC in the basement. It has pretty much everything you are looking to do in it. Link to comment Share on other sites More sharing options...
MesaSolar Posted October 6, 2020 Author Share Posted October 6, 2020 I seem to remember a quest involving the Thalmor. Maybe you are already aware of it. I forget the name. It was one where you had to go to a dinner party as a "spy". You end up freeing a NPC in the basement. It has pretty much everything you are looking to do in it.Thank you so much! That finally fixed it! Link to comment Share on other sites More sharing options...
Recommended Posts