Jump to content

Photo

How to make a bound prisoner whom is freeable?

prisoner help assistance script papyrus scripting code npc bound scripts

  • Please log in to reply
No replies to this topic

#1
Byeoh

Byeoh

    Stranger

  • Members
  • Pip
  • 2 posts

I would like to make an NPC who is stationary with bound hands, and able to be freed, much like a Stormcloak prisoner whom is being escorted by the Imperials. I would also like to make it so that this is only possible during a certain stage of the quest, while also not allowing the player to give items to the NPC, unlike with the Stormcloak prisoner. After freeing the prisoner, I would like them to follower the player, until leaving the dungeon which they were inside, and then once making to the outside of the dungeon, to travel to a certain location on the map and then stay there. I took this script from the WE09 (Wilderness Encounter of the Stormcloak Soldier being escorted by the Imperials) quest, which I have been looking at, thinking about how I would modify it to get it to work, with no progress, as I am a novice to coding and do not know where to start and how to make this work. This is the script:

 

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 Auto
idle Property OffsetStop  Auto
 
Message Property WEPrisonerMessageBox Auto
Faction Property WEPrisonerFreedFaction Auto
 
Faction Property WEPrisonerFreedCombatCaptorFaction Auto
Faction Property WEPrisonerFreedCombatPrisonerFaction Auto
 
ReferenceAlias Property Captor1 Auto
ReferenceAlias Property Captor2 Auto
ReferenceAlias Property Captor3 Auto
ReferenceAlias Property Captor4 Auto
ReferenceAlias Property Captor5 Auto
 
bool bound = True
 
int iDoNothing = 0
int iSetFree = 1
int iSetFreeShareItems = 2
 
 
Event OnLoad()
if bound
GetActorReference().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
 
EndIf
EndEvent
 
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)
endif
endEvent
 
 
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 playerIsLiberator
Game.GetPlayer().AddToFaction(WEPrisonerFreedCombatPrisonerFaction)
EndIf
 
if OpenInventory
ActorRef.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






Also tagged with one or more of these keywords: prisoner, help, assistance, script, papyrus, scripting, code, npc, bound, scripts

Page loaded in: 1.013 seconds