4
Fork 0

Cleared CWScript to avoid dependency on a bunch of Skyrim civil war scripts

steam-1.6.1130
Eddoursul 5 months ago
parent 11cef498a8
commit 3647ad6dd0
  1. 9
      _build/Used Skyrim scripts.txt
  2. BIN
      scripts/cwalliesscript.pex
  3. BIN
      scripts/cwcampaignpollformissionacceptscript.pex
  4. BIN
      scripts/cwcampaignscript.pex
  5. BIN
      scripts/cwcatapultoffscreenfirecontrolscript.pex
  6. BIN
      scripts/cwcatapultscript.pex
  7. BIN
      scripts/cwreinforcementcontrollerscript.pex
  8. BIN
      scripts/cwscript.pex
  9. BIN
      scripts/cwsiegescript.pex
  10. BIN
      scripts/cwthreatcombatbarksscript.pex
  11. 537
      source/scripts/cwalliesscript.psc
  12. 61
      source/scripts/cwcampaignpollformissionacceptscript.psc
  13. 1627
      source/scripts/cwcampaignscript.psc
  14. 82
      source/scripts/cwcatapultoffscreenfirecontrolscript.psc
  15. 399
      source/scripts/cwcatapultscript.psc
  16. 1328
      source/scripts/cwreinforcementcontrollerscript.psc
  17. 5287
      source/scripts/cwscript.psc
  18. 1596
      source/scripts/cwsiegescript.psc
  19. 529
      source/scripts/cwthreatcombatbarksscript.psc

@ -20,16 +20,9 @@ craftingactivatelinker.*
crimeguardsscript.*
critterspawn01.*
curediseasescript.*
cwalliesscript.*
cwcampaignpollformissionacceptscript.*
cwcampaignscript.*
cwcatapultoffscreenfirecontrolscript.*
cwcatapultscript.*
cwcatapultstrikescript.*
cwreinforcementcontrollerscript.*
cwcatapultstrikespawnerscript.*
cwscript.*
cwsiegescript.*
cwthreatcombatbarksscript.*
darkbrotherhood.*
darksanctuarydialoguescript.*
darttrap.*

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -1,537 +0,0 @@
Scriptname CWAlliesScript extends Quest
;This script handles adding new allies, and getting allies for use with sieges.
;To add an ally to be available in future sieges:
;*Use function AddPotentialAlly()
;*Note: - there are optional parameters which allow this ally to show up at sieges in various holds. Make sure you set at least one of these paramters to true or you will never see the ally show up for any battles.
;To get Allies to show up to sieges:
;1) Register markers for phase1/2/3/4/5 so allies have some place to go if the player isn't nearby call RegisterAllyPhaseMarkers() -- note this is MANDATORY
;2) Call ProcessAlliesForSiege() which finds appropriate allies, disables them, and then and moves them to Phase0Marker
;3) When it's appropriate stage in the siege quest, you then need to call EnableActiveAllies() which enables them causing them to appear at phase0marker.
;After sieges, to get allies to go home:
;*Call DeactivateAllies()
;*!!! NOTE !!!! This assumes the allies have standard packages that take them home some place. If this is not true, I will need to revisit this system.
CWScript Property CWs Auto
ReferenceAlias Property Phase0Marker Auto
ReferenceAlias Property Phase1Marker Auto
ReferenceAlias Property Phase2Marker Auto
ReferenceAlias Property Phase3Marker Auto
ReferenceAlias Property Phase4Marker Auto
ReferenceAlias Property Phase5Marker Auto
ReferenceAlias Property Phase6Marker Auto
ReferenceAlias Property PotentialAlly1 Auto
ReferenceAlias Property PotentialAlly2 Auto
ReferenceAlias Property PotentialAlly3 Auto
ReferenceAlias Property PotentialAlly4 Auto
ReferenceAlias Property PotentialAlly5 Auto
ReferenceAlias Property PotentialAlly6 Auto
ReferenceAlias Property PotentialAlly7 Auto
ReferenceAlias Property PotentialAlly8 Auto
ReferenceAlias Property PotentialAlly9 Auto
ReferenceAlias Property PotentialAlly10 Auto
ReferenceAlias Property ActiveAlly1 Auto
ReferenceAlias Property ActiveAlly2 Auto
ReferenceAlias Property ActiveAlly3 Auto
ReferenceAlias Property ActiveAlly4 Auto
ReferenceAlias Property ActiveAlly5 Auto
ReferenceAlias Property ActiveAlly6 Auto
ReferenceAlias Property ActiveAlly7 Auto
ReferenceAlias Property ActiveAlly8 Auto
ReferenceAlias Property ActiveAlly9 Auto
ReferenceAlias Property ActiveAlly10 Auto
Faction Property CWAlliesHaafingarFaction Auto
Faction Property CWAlliesReachFaction Auto
Faction Property CWAlliesHjaalmarchFaction Auto
Faction Property CWAlliesWhiterunFaction Auto
Faction Property CWAlliesFalkreathFaction Auto
Faction Property CWAlliesPaleFaction Auto
Faction Property CWAlliesWinterholdFaction Auto
Faction Property CWAlliesEastmarchFaction Auto
Faction Property CWAlliesRiftFaction Auto
Faction Property CWAlliesImperialsOnlyFaction Auto
Faction Property CWAlliesSonsOnlyFaction Auto
Location Property HaafingarHoldLocation Auto
Location Property ReachHoldLocation Auto
Location Property HjaalmarchHoldLocation Auto
Location Property WhiterunHoldLocation Auto
Location Property FalkreathHoldLocation Auto
Location Property PaleHoldLocation Auto
Location Property WinterholdHoldLocation Auto
Location Property EastmarchHoldLocation Auto
Location Property RiftHoldLocation Auto
function MakeHadvarAndRalofPotentialAllies()
;we're making them both potential allys when player joins either side, because IsAllowedtoJoinPlayersFaction() should prevent the wrong guy from showing up
; CWScript.Log("CWAlliesScript", self + "MakeHadvarAndRalofPotentialAllies() calling AddPotentialAlly() for both Hadvar and Ralof")
AddPotentialAlly( \
CWs.HadvarRef, \
AllowedInHaafingar = False, \
AllowedInReach = True, \
AllowedInHjaalmarch = True, \
AllowedInWhiterun = True, \
AllowedInFalkreath = True, \
AllowedInPale = True, \
AllowedInWinterhold = True, \
AllowedInEastmarch = False, \
AllowedInRift = True, \
ImperialsOnly = True, \
SonsOnly = false \
)
AddPotentialAlly( \
CWs.RalofRef, \
AllowedInHaafingar = False, \
AllowedInReach = True, \
AllowedInHjaalmarch = True, \
AllowedInWhiterun = True, \
AllowedInFalkreath = True, \
AllowedInPale = True, \
AllowedInWinterhold = True, \
AllowedInEastmarch = False, \
AllowedInRift = True, \
ImperialsOnly = False, \
SonsOnly = True \
)
EndFunction
function AddPotentialAlly( \
ObjectReference ReferenceToAdd, \
Bool AllowedInHaafingar = false, \
Bool AllowedInReach = false, \
Bool AllowedInHjaalmarch = false, \
Bool AllowedInWhiterun = false, \
Bool AllowedInFalkreath = false, \
Bool AllowedInPale = false, \
Bool AllowedInWinterhold = false, \
Bool AllowedInEastmarch = false, \
Bool AllowedInRift = false, \
bool ImperialsOnly = false, \
bool SonsOnly = false \
)
; CWScript.Log("CWAlliesScript", self + "AddPotentialAlly() trying to add " + ReferenceToAdd + "Calling GetFreePotenialAllyAlias()")
ReferenceAlias AliasToForceInto = GetFreePotentialAllyAlias()
Actor ActorToAdd = ReferenceToAdd as Actor
if AliasToForceInto != None
; CWScript.Log("CWAlliesScript", self + "AddPotentialAlly() forcing " + ReferenceToAdd + " into alias " + AliasToForceInto)
AliasToForceInto.ForceRefTo(ReferenceToAdd)
if AllowedInHaafingar
; CWScript.Log("CWAlliesScript", self + "adding " + ReferenceToAdd + " to faction " + CWAlliesHaafingarFaction)
ActorToAdd.AddToFaction(CWAlliesHaafingarFaction)
EndIf
if AllowedInReach
; CWScript.Log("CWAlliesScript", self + "adding " + ReferenceToAdd + " to faction " + CWAlliesReachFaction)
ActorToAdd.AddToFaction(CWAlliesReachFaction)
EndIf
if AllowedInHjaalmarch
; CWScript.Log("CWAlliesScript", self + "adding " + ReferenceToAdd + " to faction " + CWAlliesHjaalmarchFaction)
ActorToAdd.AddToFaction(CWAlliesHjaalmarchFaction)
EndIf
if AllowedInWhiterun
; CWScript.Log("CWAlliesScript", self + "adding " + ReferenceToAdd + " to faction " + CWAlliesWhiterunFaction)
ActorToAdd.AddToFaction(CWAlliesWhiterunFaction)
EndIf
if AllowedInFalkreath
; CWScript.Log("CWAlliesScript", self + "adding " + ReferenceToAdd + " to faction " + CWAlliesFalkreathFaction)
ActorToAdd.AddToFaction(CWAlliesFalkreathFaction)
EndIf
if AllowedInPale
; CWScript.Log("CWAlliesScript", self + "adding " + ReferenceToAdd + " to faction " + CWAlliesPaleFaction)
ActorToAdd.AddToFaction(CWAlliesPaleFaction)
EndIf
if AllowedInWinterhold
; CWScript.Log("CWAlliesScript", self + "adding " + ReferenceToAdd + " to faction " + CWAlliesWinterholdFaction)
ActorToAdd.AddToFaction(CWAlliesWinterholdFaction)
EndIf
if AllowedInEastmarch
; CWScript.Log("CWAlliesScript", self + "adding " + ReferenceToAdd + " to faction " + CWAlliesEastmarchFaction)
ActorToAdd.AddToFaction(CWAlliesEastmarchFaction)
EndIf
if AllowedInRift
; CWScript.Log("CWAlliesScript", self + "adding " + ReferenceToAdd + " to faction " + CWAlliesRiftFaction)
ActorToAdd.AddToFaction(CWAlliesRiftFaction)
EndIf
if ImperialsOnly
; CWScript.Log("CWAlliesScript", self + "adding " + ReferenceToAdd + " to faction " + CWAlliesImperialsOnlyFaction)
ActorToAdd.AddToFaction(CWAlliesImperialsOnlyFaction)
EndIf
if SonsOnly
; CWScript.Log("CWAlliesScript", self + "adding " + ReferenceToAdd + " to faction " + CWAlliesSonsOnlyFaction)
ActorToAdd.AddToFaction(CWAlliesSonsOnlyFaction)
EndIf
Else
;WARNING WE COULDN'T FIND FREE SLOT!!!!
; CWScript.Log("CWAlliesScript", self + " WARNING: AddPotentialAlly() couldn't find a free slot for the ally.", 2, 1, 1 )
EndIf
EndFunction
ReferenceAlias function GetFreePotentialAllyAlias()
ReferenceAlias AliasToReturn
if PotentialAlly1.GetReference() == False
AliasToReturn = PotentialAlly1
ElseIf PotentialAlly2.GetReference() == False
AliasToReturn = PotentialAlly2
ElseIf PotentialAlly3.GetReference() == False
AliasToReturn = PotentialAlly3
ElseIf PotentialAlly4.GetReference() == False
AliasToReturn = PotentialAlly4
ElseIf PotentialAlly5.GetReference() == False
AliasToReturn = PotentialAlly5
ElseIf PotentialAlly6.GetReference() == False
AliasToReturn = PotentialAlly6
ElseIf PotentialAlly7.GetReference() == False
AliasToReturn = PotentialAlly7
ElseIf PotentialAlly8.GetReference() == False
AliasToReturn = PotentialAlly8
ElseIf PotentialAlly9.GetReference() == False
AliasToReturn = PotentialAlly9
ElseIf PotentialAlly10.GetReference() == False
AliasToReturn = PotentialAlly10
Else
;RAN OUT OF SLOTS
; CWScript.Log("CWAlliesScript", self + " WARNING: GetFreePotenialAllyAlias() ran out of PotentialAlly Aliases, returning none.", 2, 1, 1 )
return None
EndIf
; CWScript.Log("CWAlliesScript", self + "GetFreePotenialAllyAlias() returning " + AliasToReturn)
return AliasToReturn
EndFunction
function RegisterAllyPhaseMarkers(ObjectReference Phase0MarkerRef, ObjectReference Phase1MarkerRef, ObjectReference Phase2MarkerRef, ObjectReference Phase3MarkerRef, ObjectReference Phase4MarkerRef, ObjectReference Phase5MarkerRef, ObjectReference Phase6MarkerRef)
{Called by Siege scripts to register 1 set of phase1/2/3/4/5 markers for all the allies to use for that siege}
; CWScript.Log("CWAlliesScript", self + "RegisterAllyPhaseMarkers() forcing Refs: " + Phase0MarkerRef + "," + Phase1MarkerRef + ", " + Phase2MarkerRef + ", " + Phase3MarkerRef + ", " + Phase4MarkerRef + ", " + Phase5MarkerRef + ", " + Phase6MarkerRef + " into Phase0/1/2/3/4/5/6Marker Aliases.")
Phase0Marker.ForceRefTo(Phase0MarkerRef)
Phase1Marker.ForceRefTo(Phase1MarkerRef)
Phase2Marker.ForceRefTo(Phase2MarkerRef)
Phase3Marker.ForceRefTo(Phase3MarkerRef)
Phase4Marker.ForceRefTo(Phase4MarkerRef)
Phase5Marker.ForceRefTo(Phase5MarkerRef)
Phase6Marker.ForceRefTo(Phase6MarkerRef)
EndFunction
function ProcessAlliesForSiege(Location HoldLocation)
{Called by Siege scripts to find appropriate allies and move them to Phase0Marker}
; CWScript.Log("CWAlliesScript", self + "ProcessAlliesForSiege() for location " + HoldLocation + " will now try to find appropriate allies, move them to Phase1Marker and disable them.")
ObjectReference Phase0MarkerRef = Phase0Marker.GetReference()
if Phase0MarkerRef == None
; CWScript.Log("CWAlliesScript", self + " WARNING: ProcessAlliesForSiege() couldn't find a reference in Phase0Marker. Make sure Siege Script calls RegisterAllyPhaseMarkers() before calling ProcessAlliesForSiege()!!! ", 2, 1, 1 )
Return
EndIf
TryToProcessAlly(PotentialAlly1, HoldLocation, Phase0MarkerRef)
TryToProcessAlly(PotentialAlly2, HoldLocation, Phase0MarkerRef)
TryToProcessAlly(PotentialAlly3, HoldLocation, Phase0MarkerRef)
TryToProcessAlly(PotentialAlly4, HoldLocation, Phase0MarkerRef)
TryToProcessAlly(PotentialAlly5, HoldLocation, Phase0MarkerRef)
TryToProcessAlly(PotentialAlly6, HoldLocation, Phase0MarkerRef)
TryToProcessAlly(PotentialAlly7, HoldLocation, Phase0MarkerRef)
TryToProcessAlly(PotentialAlly8, HoldLocation, Phase0MarkerRef)
TryToProcessAlly(PotentialAlly9, HoldLocation, Phase0MarkerRef)
TryToProcessAlly(PotentialAlly10, HoldLocation, Phase0MarkerRef)
; CWScript.Log("CWAlliesScript", self + "ProcessAlliesForSiege() done processing potential allies.")
EndFunction
Function TryToProcessAlly(ReferenceAlias PotentialAlly, Location HoldLocation, ObjectReference Phase0MarkerRef)
; CWScript.Log("CWAlliesScript", self + "TryToProcessAlly() for PotentialAlly Alias:" + PotentialAlly + " for HoldLocation:" + HoldLocation)
actor CurrentPotentialAlly = TryPromoteToActiveAllyAndReturnActor(PotentialAlly, HoldLocation)
if CurrentPotentialAlly
; CWScript.Log("CWAlliesScript", self + "TryToProcessAlly() disabling " + CurrentPotentialAlly + " and moving to to " + Phase0MarkerRef + "." )
CurrentPotentialAlly.Disable()
CurrentPotentialAlly.MoveTo(Phase0MarkerRef)
Else ;for some reason TryPromoteToActiveAllyAndReturnActor failed to return an actor. This does not mean something broke. There are cases where this is fine (for instance tha actor isn't in the faction that allows him to show up in the hold
; CWScript.Log("CWAlliesScript", self + "TryToProcessAlly() did not get an actor from TryPromoteToActiveAllyAndReturnActor( " + PotentialAlly + " ) so we are ignoring it.")
EndIf
EndFunction
Actor function TryPromoteToActiveAllyAndReturnActor(ReferenceAlias PotentialAllyToPromote, Location HoldLocation)
Actor ActorToForce = PotentialAllyToPromote.GetActorReference()
ReferenceAlias AliasToForceInto = GetFreeActiveAllyAlias()
;check that there is an Actor in PotentialAllyToPromote
if ActorToForce == None
; CWScript.Log("CWAlliesScript", self + " TryPromoteToActiveAllyAndReturnActor() did not find an actor in PotentialAllyToPromote alias: " + PotentialAllyToPromote)
ActorToForce = None ;it's already none, but for consistency and readability I'm setting it here.
Else
;Check that Actor is in the correct faction (ie that he is allowed to show up in the HoldLocation)
if IsAllowedInLocation(ActorToForce, HoldLocation) && IsAllowedToJoinPlayersFaction(ActorToForce)
;Is Allowed in location
; CWScript.Log("CWAlliesScript", self + "TryPromoteToActiveAllyAndReturnActor() found actor" + ActorToForce + " is indeed allowed in location and is allowed to join up with the player's faction." )
if AliasToForceInto != None
; CWScript.Log("CWAlliesScript", self + "TryPromoteToActiveAllyAndReturnActor() forcing " + ActorToForce + " into alias " + AliasToForceInto)
AliasToForceInto.ForceRefTo(ActorToForce)
Else
;WARNING WE COULDN'T FIND FREE SLOT!!!!
; CWScript.Log("CWAlliesScript", self + " WARNING: TryPromoteToActiveAllyAndReturnActor() couldn't find a free slot for the ally.", 2, 1, 1 )
ActorToForce = None
EndIf
Else ; Is Not Allowed in Location
; CWScript.Log("CWAlliesScript", self + "promoteToActiveAlly() found actor" + ActorToForce + " is not allowed in location(" + HoldLocation + ") OR is not allowed to join player's faction:" + CWs.PlayerAllegiance + "[" + CWs.FactionName(CWs.PlayerAllegiance) +"]")
ActorToForce = None
EndIf
Endif
; CWScript.Log("CWAlliesScript", self + "promoteToActiveAlly() returning " + ActorToForce)
return ActorToForce
EndFunction
bool function IsAllowedInLocation(Actor ActorToCheck, Location HoldLocationToCheck)
Bool IsAllowed
if HoldLocationToCheck == HaafingarHoldLocation
if ActorToCheck.IsInFaction(CWAlliesHaafingarFaction)
IsAllowed = True
Else
; CWScript.Log("CWAlliesScript", self + "IsAllowedInLocation() did not find ActorToCheck" + ActorToCheck + " in CWAlliesHaafingarFaction. Will return false.")
IsAllowed = False
EndIf
elseif HoldLocationToCheck == ReachHoldLocation
if ActorToCheck.IsInFaction(CWAlliesReachFaction)
IsAllowed = true
else
; CWScript.Log("CWAlliesScript", self + "IsAllowedInLocation() did not find ActorToCheck" + ActorToCheck + " in CWAlliesReachFaction. Will return false.")
IsAllowed = False
Endif
elseif HoldLocationToCheck == HjaalmarchHoldLocation
if ActorToCheck.IsInFaction(CWAlliesHjaalmarchFaction)
IsAllowed = true
else
; CWScript.Log("CWAlliesScript", self + "IsAllowedInLocation() did not find ActorToCheck" + ActorToCheck + " in CWAlliesHjaalmarchFaction. Will return false.")
IsAllowed = False
Endif
elseif HoldLocationToCheck == WhiterunHoldLocation
if ActorToCheck.IsInFaction(CWAlliesWhiterunFaction)
IsAllowed = true
else
; CWScript.Log("CWAlliesScript", self + "IsAllowedInLocation() did not find ActorToCheck" + ActorToCheck + " in CWAlliesWhiterunFaction. Will return false.")
IsAllowed = False
Endif
elseif HoldLocationToCheck == FalkreathHoldLocation
if ActorToCheck.IsInFaction(CWAlliesFalkreathFaction)
IsAllowed = true
else
; CWScript.Log("CWAlliesScript", self + "IsAllowedInLocation() did not find ActorToCheck" + ActorToCheck + " in CWAlliesFalkreathFaction. Will return false.")
IsAllowed = False
Endif
elseif HoldLocationToCheck == PaleHoldLocation
if ActorToCheck.IsInFaction(CWAlliesPaleFaction)
IsAllowed = true
else
; CWScript.Log("CWAlliesScript", self + "IsAllowedInLocation() did not find ActorToCheck" + ActorToCheck + " in CWAlliesPaleFaction. Will return false.")
IsAllowed = False
Endif
elseif HoldLocationToCheck == WinterholdHoldLocation
if ActorToCheck.IsInFaction(CWAlliesWinterholdFaction)
IsAllowed = true
else
; CWScript.Log("CWAlliesScript", self + "IsAllowedInLocation() did not find ActorToCheck" + ActorToCheck + " in CWAlliesWinterholdFaction. Will return false.")
IsAllowed = False
Endif
elseif HoldLocationToCheck == EastmarchHoldLocation
if ActorToCheck.IsInFaction(CWAlliesEastmarchFaction)
IsAllowed = true
else
; CWScript.Log("CWAlliesScript", self + "IsAllowedInLocation() did not find ActorToCheck" + ActorToCheck + " in CWAlliesEastmarchFaction. Will return false.")
IsAllowed = False
Endif
elseif HoldLocationToCheck == RiftHoldLocation
if ActorToCheck.IsInFaction(CWAlliesRiftFaction)
IsAllowed = true
else
; CWScript.Log("CWAlliesScript", self + "IsAllowedInLocation() did not find ActorToCheck" + ActorToCheck + " in CWAlliesRiftFaction. Will return false.")
IsAllowed = False
Endif
Else
; CWScript.Log("CWAlliesScript", self + " WARNING: IsAllowedInLocation() found an unexpected location for HoldLocationToCheck:" + HoldLocationToCheck, 2, 1, 1 )
IsAllowed = False
EndIf
return IsAllowed
EndFunction
bool Function IsAllowedToJoinPlayersFaction(Actor ActorToCheck)
bool returnVal
if CWs.PlayerAllegiance == CWs.iImperials && ActorToCheck.IsInFaction(CWAlliesSonsOnlyFaction)
; CWScript.Log("CWAlliesScript", self + "IsAllowedToJoinPlayersFaction(" + ActorToCheck + ") is in CWAlliesSonsOnlyFaction and player Imperial. Will return false.")
returnVal = False
elseif CWs.PlayerAllegiance == CWs.iSons && ActorToCheck.IsInFaction(CWAlliesImperialsOnlyFaction)
; CWScript.Log("CWAlliesScript", self + "IsAllowedToJoinPlayersFaction(" + ActorToCheck + ") is in CWAlliesImperialsOnlyFaction and player Sons. Will return false.")
returnVal = False
Else
returnVal = True
EndIf
return returnVal
EndFunction
ReferenceAlias function GetFreeActiveAllyAlias()
ReferenceAlias AliasToReturn
if ActiveAlly1.GetReference() == False
AliasToReturn = ActiveAlly1
ElseIf ActiveAlly2.GetReference() == False
AliasToReturn = ActiveAlly2
ElseIf ActiveAlly3.GetReference() == False
AliasToReturn = ActiveAlly3
ElseIf ActiveAlly4.GetReference() == False
AliasToReturn = ActiveAlly4
ElseIf ActiveAlly5.GetReference() == False
AliasToReturn = ActiveAlly5
ElseIf ActiveAlly6.GetReference() == False
AliasToReturn = ActiveAlly6
ElseIf ActiveAlly7.GetReference() == False
AliasToReturn = ActiveAlly7
ElseIf ActiveAlly8.GetReference() == False
AliasToReturn = ActiveAlly8
ElseIf ActiveAlly9.GetReference() == False
AliasToReturn = ActiveAlly9
ElseIf ActiveAlly10.GetReference() == False
AliasToReturn = ActiveAlly10
Else
;RAN OUT OF SLOTS
; CWScript.Log("CWAlliesScript", self + " WARNING: GetFreePotenialAllyAlias() ran out of ActiveAlly Aliases, returning none.", 2, 1, 1 )
return None
EndIf
; CWScript.Log("CWAlliesScript", self + "GetFreePotenialAllyAlias() returning " + AliasToReturn)
return AliasToReturn
EndFunction
function EnableActiveAllies()
; CWScript.Log("CWAlliesScript", self + "EnableActiveAllies() calling TryToEnable() on all of the ActiveAllyX aliases.")
ActiveAlly1.TryToEnable()
ActiveAlly2.TryToEnable()
ActiveAlly3.TryToEnable()
ActiveAlly4.TryToEnable()
ActiveAlly5.TryToEnable()
ActiveAlly6.TryToEnable()
ActiveAlly7.TryToEnable()
ActiveAlly8.TryToEnable()
ActiveAlly9.TryToEnable()
ActiveAlly10.TryToEnable()
; CWScript.Log("CWAlliesScript", self + "EnableActiveAllies() finished trying to enable all the active allies.")
EndFunction
function DeactivateAllies()
{Called by Siege script when the siege is over and the allies should go home. This assumes the Allies have packages that take them some place. If this is not true, I need to revisit this system.}
; CWScript.Log("CWAlliesScript", self + "EnableActiveAllies() calling Clear() on all of the ActiveAllyX aliases.")
ActiveAlly1.Clear()
ActiveAlly2.Clear()
ActiveAlly3.Clear()
ActiveAlly4.Clear()
ActiveAlly5.Clear()
ActiveAlly6.Clear()
ActiveAlly7.Clear()
ActiveAlly8.Clear()
ActiveAlly9.Clear()
ActiveAlly10.Clear()
EndFunction

@ -1,61 +0,0 @@
Scriptname CWCampaignPollForMissionAcceptScript extends Quest
;## Quests ##
Quest Property CW Auto
Quest Property CWCampaign Auto
;## Scripts ##
;These will be assigned in the OnInit() block
CWScript Property CWs Auto hidden
CWCampaignScript Property CWCampaignS Auto hidden
Event OnInit()
; CWScript.Log("CWCampaignPollForMissionAcceptScript" , " OnInit()", 0, True, True)
CWs = CW as CWScript
CWCampaignS = CWCampaign as CWCampaignScript
registerForUpdate(5)
EndEvent
auto State NotPolling
Event OnUpdate()
; CWScript.Log("CWCampaignPollForMissionAcceptScript" , " State: 'NotPolling' OnUpdate(), doing nothing." )
EndEvent
EndState
State Polling
Event OnUpdate()
; CWScript.Log("CWCampaignPollForMissionAcceptScript" , " State: 'Polling' OnUpdate(), polling for quest acceptance or GameDaysPassed > NextPhaseDay." )
if CWCampaignS.AcceptedMission > 0
; CWScript.Log("CWCampaignPollForMissionAcceptScript" , " State: 'Polling' See's AcceptedMission > 0, going to State 'NotPolling'" )
StopPolling()
Elseif CWs.GameDaysPassed.value > CWCampaignS.NextPhaseDay
; CWScript.Log("CWCampaignPollForMissionAcceptScript" , " State: 'Polling' sees that GameDaysPassed(" + CWs.GameDaysPassed.value + ") > NextPhaseDay(" + CWCampaignS.NextPhaseDay + "), stopping polling, and calling AdvanceCampaignPhase()" )
StopPolling()
CWCampaignS.AdvanceCampaignPhase() ;this will among other things set AcceptedMission to 0
Else
; CWScript.Log("CWCampaignPollForMissionAcceptScript" , " State: 'Polling' sees that GameDaysPassed(" + CWs.GameDaysPassed.value + ") < NextPhaseDay(" + CWCampaignS.NextPhaseDay + "), will keep polling." )
EndIf
EndEvent
EndState
Function StartPolling()
GoToState("Polling")
EndFunction
Function StopPolling()
GoToState("NotPolling")
EndFunction

File diff suppressed because it is too large Load Diff

@ -1,82 +0,0 @@
Scriptname CWCatapultOffscreenFireControlScript extends ObjectReference
{Controls the offscreen firing scripting. Set properties on the CWCatapultScript.}
;Constants
string OffScreenFireModeOff = "OffScreenFireModeOff"
string OffScreenFireModeWaitingToFire = "OffScreenFireModeWaitingToFire"
string OffScreenFireModeBusyFiring = "OffScreenFireModeBusyFiring"
auto state OffScreenFireModeOff
Event OnUpdate()
; CWScript.Log("CWCatapultOffscreenFireControlScript", self + "OffScreenFireModeOff OnUpdate() doing nothing.")
EndEvent
EndState
state OffScreenFireModeBusyFiring
Event OnUpdate()
; CWScript.Log("CWCatapultOffscreenFireControlScript", self + "OffScreenFireModeBusyFiring OnUpdate() doing nothing.")
EndEvent
EndState
state OffScreenFireModeWaitingToFire
Event OnUpdate()
GoToState(OffScreenFireModeBusyFiring)
UnregisterForUpdate()
CWCatapultScript Cs = (self as ObjectReference) as CWCatapultScript
; CWScript.Log("CWCatapultOffscreenFireControlScript", self + "OffScreenFireModeWaitingToFire OnUpdate() going to state OffScreenFireModeBusyFiring and possibly firing strike if in correct phase ")
if Cs.UseCWCatapultStrikeSpawners == True
if Cs.UseCWCatapultStrikeSpawners == True ;in case we turned that off during the wait
if Cs.CWBattlePhase.GetValue() == 0 && GetLinkedRef(Cs.CW1)
; CWScript.Log("CWCatapultOffscreenFireControlScript", self + "startSpawningCatapultStrikes() Calling CallCatapultStrike() on " + GetLinkedRef(Cs.CW1))
(GetLinkedRef(Cs.CW1) as CWCatapultStrikeSpawnerScript).CallCatapultStrike()
elseif Cs.CWBattlePhase.GetValue() == 1 && GetLinkedRef(Cs.CW1)
; CWScript.Log("CWCatapultOffscreenFireControlScript", self + "startSpawningCatapultStrikes() Calling CallCatapultStrike() on " + GetLinkedRef(Cs.CW1))
(GetLinkedRef(Cs.CW1) as CWCatapultStrikeSpawnerScript).CallCatapultStrike()
elseif Cs.CWBattlePhase.GetValue() == 2 && GetLinkedRef(Cs.CW2)
; CWScript.Log("CWCatapultOffscreenFireControlScript", self + "startSpawningCatapultStrikes() Calling CallCatapultStrike() on " + GetLinkedRef(Cs.CW2))
(GetLinkedRef(Cs.CW2) as CWCatapultStrikeSpawnerScript).CallCatapultStrike()
elseif Cs.CWBattlePhase.GetValue() == 3 && GetLinkedRef(Cs.CW3)
; CWScript.Log("CWCatapultOffscreenFireControlScript", self + "startSpawningCatapultStrikes() Calling CallCatapultStrike() on " + GetLinkedRef(Cs.CW3))
(GetLinkedRef(Cs.CW3) as CWCatapultStrikeSpawnerScript).CallCatapultStrike()
elseif Cs.CWBattlePhase.GetValue() == 4 && GetLinkedRef(Cs.CW4)
; CWScript.Log("CWCatapultOffscreenFireControlScript", self + "startSpawningCatapultStrikes() Calling CallCatapultStrike() on " + GetLinkedRef(Cs.CW4))
(GetLinkedRef(Cs.CW4) as CWCatapultStrikeSpawnerScript).CallCatapultStrike()
elseif Cs.CWBattlePhase.GetValue() == 5 && GetLinkedRef(Cs.CW5)
; CWScript.Log("CWCatapultOffscreenFireControlScript", self + "startSpawningCatapultStrikes() Calling CallCatapultStrike() on " + GetLinkedRef(Cs.CW5))
(GetLinkedRef(Cs.CW5) as CWCatapultStrikeSpawnerScript).CallCatapultStrike()
elseif GetLinkedRef(Cs.CWAllPhases)
; CWScript.Log("CWCatapultOffscreenFireControlScript", self + "startSpawningCatapultStrikes() Calling CallCatapultStrike() on " + GetLinkedRef(Cs.CWAllPhases))
(GetLinkedRef(Cs.CWAllPhases) as CWCatapultStrikeSpawnerScript).CallCatapultStrike()
Else
; CWScript.Log("CWCatapultOffscreenFireControlScript", self + "startSpawningCatapultStrikes() NOT calling CallCatapultStrike() because CWBattlePhase == x which doesn't match a GetLinkedRef CWx", 1)
EndIf
GoToState(OffScreenFireModeWaitingToFire)
RegisterForUpdate(Cs.GetTimeToNextLaunch())
EndIf
EndIf
EndEvent
EndState
function StopOffscreenFiring()
GoToState(OffScreenFireModeOff)
; CWScript.Log("CWCatapultOffscreenFireControlScript", self + "StopOffscreenFiring() so went to state OffscreenFireModeOff, calling UnRegisterForUpdate()")
UnregisterForUpdate()
EndFunction
function StartOffscreenFiring(float LaunchTime)
GoToState(OffScreenFireModeWaitingToFire)
RegisterForUpdate(LaunchTime)
; CWScript.Log("CWCatapultOffscreenFireControlScript", self + "StartOffscreenFiring() so went to state OffScreenFireModeWaitingToFire")
EndFunction

@ -1,399 +0,0 @@
Scriptname CWCatapultScript extends ObjectReference
{Script on the CWCatapult Activator}
;NOTES:
;NORMAL OPERATION:
;To start catapults, 1) Enable() them, THEN 2) call TurnOn() -- THE ORDER IS IMPORTANT... ENABLE() FIRST if you don't then you put it in the mode to always fire as if it were "offscreen" and unloaded
;To stop catapults, 1) call the turnOff() function, then 2) Disable() them -- THE ORDER IS IMPORTANT
;When it's appropriate and you want to start using the CWCatapultStrikeSpawners to pin point where each hit should land, disable() the catapult which will cause it to start using the special effects instead of practical projectiles.
;When the catapult unloads it sets the UseCWCatapultStrikeSpawners bool to true and calls startSpawningCatapultStrikes() which based on the CWBattlePhase will place special fx explosions at linked refs linked with keywords CW1, CW2, CW3, CW4, CW5 based on the phase
;START DISABLED AND FIRE USING SPECIAL EFFECTS ONLY:
;To make a catapult never appear in the world but still fire with the special fx explosions, make sure it starts disabled, and instead of enable() it, just call turnOn() function on it. It assumes if it's disabled and you call turnOn() it should start firing as if it was unloaded
;AIMING THE CATAPULT
;Run the game, and "setpv aim True" on it in the console
;Now when you activate it in the ready position, it will pop up an aim menu
;One of the options is "Log Coordinates" this will print out the x, y, z position and angles to a text file so you can then enter those in the editor
;One special option is the "Face Target" button. By default this is the player, so you can run to where you want it to aim towards and then activate it via console (prid it, then "activate player") and it will face toward you
;you can also set this as a property on the reference if you have another reference you want to aim it at
;DON'T FORGET to push the "Log Coordinates" button on each catapult you aim, or you will have lost your targetting data
Weapon Property WeaponToFire Auto
{BASEOBJECT: Set this to CWCatapultWeapon, this is the weapon that the fire() function is called on.}
Ammo Property AmmoToFire Auto
{BASEOBJECT: Set this to CWCatapultAmmo, this is the ammo parameter that the fire() function is passed.}
GlobalVariable Property CWBattlePhase Auto
{BASEOBJECT: Pointer to CWBattlePhase global}
keyword Property CW1 Auto
{BASEOBJET: pointer to keyword CW1 which defines the CWCatapultStrikerSpawner associated with phase 1 that should place catapult strike effects if this catapult is unloaded and CWBattlePhase is the correct phase}
keyword Property CW2 Auto
{BASEOBJET: pointer to keyword CW2 which defines the CWCatapultStrikerSpawner associated with phase 2 that should place catapult strike effects if this catapult is unloaded and CWBattlePhase is the correct phase}
keyword Property CW3 Auto
{BASEOBJET: pointer to keyword CW3 which defines the CWCatapultStrikerSpawner associated with phase 3 that should place catapult strike effects if this catapult is unloaded and CWBattlePhase is the correct phase}
keyword Property CW4 Auto
{BASEOBJET: pointer to keyword CW4 which defines the CWCatapultStrikerSpawner associated with phase 4 that should place catapult strike effects if this catapult is unloaded and CWBattlePhase is the correct phase}
keyword Property CW5 Auto
{BASEOBJET: pointer to keyword CW5 which defines the CWCatapultStrikerSpawner associated with phase 5 that should place catapult strike effects if this catapult is unloaded and CWBattlePhase is the correct phase}
keyword Property CWAllPhases Auto
{BASEOBJET: pointer to keyword CWAllPhases which defines the CWCatapultStrikerSpawner associated with all phases that should place catapult strike effects if this catapult is unloaded}
Message Property CWCatapultMsgAngle Auto
{BASEOBJECT: pointer to the CWCatapultMsgAngle message}
Message Property CWCatapultMsgPosition Auto
{BASEOBJECT: pointer to the CWCatapultMsgAngle message}
float property MinStrikeSpawnerTime = 5.0 Auto
{Optional REFERENCE: minimum seconds that should pass between each CWCatapultStrike special effect Explosion from this catapult}
float property MaxStrikeSpawnerTime = 10.0 Auto
{Optional REFERENCE: maximum seconds that should pass between each CWCatapultStrike special effect Explosion from this catapult}
Bool Property Aim Auto
{DEBUG: Put the catapult in aiming mode.}
ObjectReference Property FaceTarget auto
{DEBUG: object ref id aim at, set before activating the Aiming mode menu in game}
;Private Properties / Variables
bool property UseCWCatapultStrikeSpawners auto ;when this is true, don't launch normally, but instead call in special effect explosions (this is set to true when the object is unloaded)
{DON'T SET THIS, FOR DEBUGGING AND INTERNAL USE BY SCRIPT ONLY}
;set bu TurnOn() and TurnOff()
bool Property TurnedOn Auto ;*** WHEN WE ARE DONE SETTING UP THIS SHOULD BE OFF BY DEFAILT AND TURNED ON WITH A FUNCTION
{DON'T SET THIS, FOR DEBUGGING AND INTERNAL USE BY SCRIPT ONLY}
;<constants>
;state names - must be the same as the name of the states
string busy = "busy" ;busy animating
string ready = "ready" ;loaded and ready to fire
string fired = "fired" ;fired Projectile
;animation events - for convenience these are declared as string variables
string aeFire = "fire" ;send this event to cause the catapult arm to fly up and launch the payload
string aeLaunch = "launch" ;[OBSOLETE] sent from activator at the moment the payload leaves the arm - this is when the weapon should call fire()
string aeFired = "fired" ;sent from activator when the launch animation is complete and it's safe to allow activate events to load it again
string aeReload = "reload" ;send this event to cause the catapult arm to lower and spawn a new payload
string aeReloaded = "reloaded" ;sent from activator when the reload animation is finished and it's safe to allow activate events to launch it again
string aeStartFired = "startFired" ;send to activator to start a catapult in the fired position. Do not call this any other time than OnLoad or it will look bad.
;</constants>
Event OnLoad()
((self as ObjectReference) as CWCatapultOffscreenFireControlScript).StopOffscreenFiring()
UseCWCatapultStrikeSpawners = False
; CWScript.Log("CWCatapultScript", self + "OnLoad()")
RegisterForAnimationEvent(self, aeFire) ;arm goes up and payload launces
RegisterForAnimationEvent(self, aeLaunch) ;last few frames as the payload launches - should coincide with the fire() function call
RegisterForAnimationEvent(self, aeFired) ;arm is at rest after finished launching
RegisterForAnimationEvent(self, aeReload) ;arm goes down and payload appears in it
RegisterForAnimationEvent(self, aeReloaded) ;arm is down and payload appeared
RegisterForAnimationEvent(self, aeStartFired) ;arm should start up
endEvent
Event OnUnload()
if UseCWCatapultStrikeSpawners == False && TurnedOn == true ;if we aren't already doing this for some reason, go ahead and Start
startSpawningCatapultStrikes()
EndIf
; debug.MessageBox(self + "OnUnload()")
; CWScript.Log("CWCatapultScript", self + "OnUnload()")
UnRegisterForAnimationEvent(self, aeFire)
UnRegisterForAnimationEvent(self, aeLaunch)
UnRegisterForAnimationEvent(self, aeFired)
UnRegisterForAnimationEvent(self, aeReload)
UnRegisterForAnimationEvent(self, aeReloaded)
UnRegisterForAnimationEvent(self, aeStartFired)
endEvent
state busy
Event OnBeginState()
; CWScript.Log("CWCatapultScript", self + "OnBeginState() busy")
EndEvent
;catch activate
Event OnActivate(ObjectReference akActionRef)
; CWScript.Log("CWCatapultScript", self + "OnActivate(" + akActionRef + "): busy, so doing nothing.")
EndEvent
EndState
auto state ready
Event OnBeginState()
; CWScript.Log("CWCatapultScript", self + "OnBeginState() ready")
EndEvent
;catch activate
Event OnActivate(ObjectReference akActionRef)
if aim == true
showAimingMenu()
Else
if UseCWCatapultStrikeSpawners == False
launch()
; CWScript.Log("CWCatapultScript", self + "OnActivate(" + akActionRef + ") ready, so called launch().")
Else
; CWScript.Log("CWCatapultScript", self + "OnActivate(" + akActionRef + ") UseCWCatapultStrikeSpawners == True so I am not launching normally but calling in SFX catapult explosions.")
EndIf
EndIf
EndEvent
EndState
state fired
Event OnBeginState()
; CWScript.Log("CWCatapultScript", self + "OnBeginState() fired")
EndEvent
;catch activate
Event OnActivate(ObjectReference akActionRef)
reload()
; CWScript.Log("CWCatapultScript", self + "OnActivate(" + akActionRef + ") fired, so called reload.")
EndEvent
EndState
Event OnAnimationEvent(ObjectReference akSource, string asEventName)
; CWScript.Log("CWCatapultScript", self + "ProcessAnimationEvent(" + asEventName + ")")
if asEventName == aeReloaded
GoToState(ready)
elseif asEventName == aeFired
GoToState(fired)
endif
EndEvent
function TurnOn()
;allowed to fire
TurnedOn = True
;*** PUT THIS BACK IN WHEN WE HAVE ACTORS LAUNCHING ENABLED CATAPULTS
; if IsDisabled()
startSpawningCatapultStrikes()
; EndIf
EndFunction
function TurnOff(bool AndDisable = True)
;not allowed to fire
TurnedOn = False
if AndDisable == True
disable()
EndIf
((self as ObjectReference) as CWCatapultOffscreenFireControlScript).StopOffscreenFiring()
EndFunction
float function GetTimeToNextLaunch()
float timeToNextLaunch = Utility.RandomFloat(MinStrikeSpawnerTime, MaxStrikeSpawnerTime)
; CWScript.Log("CWCatapultScript", self + "GetTimeToNextLaunch() returning " + timeToNextLaunch)
Return timeToNextLaunch
EndFunction
function startSpawningCatapultStrikes()
if TurnedOn == False
; CWScript.Log("GetTimeToNextLaunch", self + "WARNING: my TurnedOn variable is false, I should NOT be calling startSpawningCatapultStrikes on myself.", 2, 1, 1)
Else
UseCWCatapultStrikeSpawners = True
((self as ObjectReference) as CWCatapultOffscreenFireControlScript).StartOffscreenFiring(GetTimeToNextLaunch())
EndIf
EndFunction
function launch()
GoToState(busy)
; CWScript.Log("CWCatapultScript", self + "launch()")
PlayAnimationAndWait(aeFire, aeLaunch)
WeaponToFire.fire(self, AmmoToFire)
EndFunction
function reload()
GoToState(busy)
; CWScript.Log("CWCatapultScript", self + "reload()")
PlayAnimation(aeReload)
EndFunction
;AIMING MENU STUFF
function showAimingMenu()
float translateSpeed = 100
Message thisMessage = CWCatapultMsgAngle
int button = thisMessage.Show()
int left = 0
int right = 1
int back = 2
int forward = 3
int face = 4
int nextMenu = 5
int log = 6
int done = 7
float offset = 1
if button == left
translateTo(X, Y, Z, GetAngleX(), GetAngleY(), GetAngleZ() - offset, translateSpeed)
elseif button == right
translateTo(X, Y, Z, GetAngleX(), GetAngleY(), GetAngleZ() + offset, translateSpeed)
elseif button == back
translateTo(X, Y, Z, GetAngleX(), GetAngleY() - offset, GetAngleZ(), translateSpeed)
elseif button == forward
translateTo(X, Y, Z, GetAngleX(), GetAngleY() + offset, GetAngleZ(), translateSpeed)
elseif button == face
translateTo(X, Y, Z, GetAngleX(), GetAngleY(), GetFacingToTarget(FaceTarget, True), translateSpeed)
elseif button == nextMenu
showPositioningMenu()
elseif button == log
logPositionAndAngle()
EndIf
if button != done
showAimingMenu()
EndIf
EndFunction
function showPositioningMenu()
float translateSpeed = 100
Message thisMessage = CWCatapultMsgPosition
int button = thisMessage.Show()
int left = 0
int right = 1
int back = 2
int forward = 3
int up = 4
int down = 5
int nextMenu = 6
int log = 7
int done = 8
float offset = 1
float xOffset
float yOffset
;NOTE: the catapult art is setup facing backwards which is why when moving left/back we add the offsets and moving right/forward we subtract the offsets
if button == left
xOffset = offset * math.cos(GetAngleZ())
yOffset = offset * -( math.sin(GetAngleZ()) )
translateTo(X + xOffset, Y + yOffset, Z, GetAngleX(), GetAngleY(), GetAngleZ(), translateSpeed)
elseif button == right
xOffset = offset * math.cos(GetAngleZ())
yOffset = offset * -( math.sin(GetAngleZ()) )
translateTo(X - xOffset, Y - yOffset, Z, GetAngleX(), GetAngleY(), GetAngleZ(), translateSpeed)
elseif button == back
xOffset = offset * math.sin(GetAngleZ())
yOffset = offset * math.cos(GetAngleZ())
translateTo(X + xOffset, Y + yOffset, Z, GetAngleX(), GetAngleY(), GetAngleZ(), translateSpeed)
elseif button == forward
xOffset = offset * math.sin(GetAngleZ())
yOffset = offset * math.cos(GetAngleZ())
translateTo(X - xOffset, Y - yOffset, Z, GetAngleX(), GetAngleY(), GetAngleZ(), translateSpeed)
elseif button == up
translateTo(X, Y, Z + offset, GetAngleX(), GetAngleY(), GetAngleZ(), translateSpeed)
elseif button == down
translateTo(X, Y, Z - offset, GetAngleX(), GetAngleY(), GetAngleZ(), translateSpeed)
elseif button == nextMenu
showAimingMenu()
elseif button == log
LogPositionAndAngle()
EndIf
if button != done
showPositioningMenu()
EndIf
EndFunction
function LogPositionAndAngle()
; CWScript.Log("CWCatapultAimingLog", self + "X: " + X + ", Y:" + Y + ", Z:" + Z + ", Angle X:" + GetAngleX() + ", Angle Y:" + GetAngleY() + ", Angle Z:" + GetAngleZ(), 1, 1)
EndFunction
float function GetFacingToTarget(ObjectReference TargetRef, bool invertFacing = False)
float deltaX = TargetRef.X - X
float deltaY = TargetRef.Y - Y
float newAngle = math.atan(deltaX/deltaY)
if TargetRef.Y < Y
newAngle += 180
EndIf
if invertFacing
if newAngle >= 180
newAngle -= 180
Else
newAngle += 180
EndIf
EndIf
return newAngle
EndFunction

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,529 +0,0 @@
Scriptname CWThreatCombatBarksScript extends Quest Conditional
ReferenceAlias Property ImperialBridge Auto
ReferenceAlias Property ImperialFence Auto
ReferenceAlias Property ImperialFenceArcher Auto
ReferenceAlias Property ImperialFenceMage Auto
ReferenceAlias Property ImperialHouse Auto
ReferenceAlias Property ImperialRock Auto
ReferenceAlias Property ImperialStables Auto
ReferenceAlias Property ImperialTower Auto
ReferenceAlias Property ImperialTowerArcher Auto
ReferenceAlias Property ImperialTowerMage Auto
ReferenceAlias Property ImperialTree Auto
ReferenceAlias Property ImperialWall Auto
ReferenceAlias Property ImperialWallArcher Auto
ReferenceAlias Property ImperialWallMage Auto
ReferenceAlias Property ImperialWindow Auto
ReferenceAlias Property ImperialWindowArcher Auto
ReferenceAlias Property ImperialWindowMage Auto
ReferenceAlias Property SonsBridge Auto
ReferenceAlias Property SonsFence Auto
ReferenceAlias Property SonsFenceArcher Auto
ReferenceAlias Property SonsFenceMage Auto
ReferenceAlias Property SonsHouse Auto
ReferenceAlias Property SonsRock Auto
ReferenceAlias Property SonsStables Auto
ReferenceAlias Property SonsTower Auto
ReferenceAlias Property SonsTowerArcher Auto
ReferenceAlias Property SonsTowerMage Auto
ReferenceAlias Property SonsTree Auto
ReferenceAlias Property SonsWall Auto
ReferenceAlias Property SonsWallArcher Auto
ReferenceAlias Property SonsWallMage Auto
ReferenceAlias Property SonsWindow Auto
ReferenceAlias Property SonsWindowArcher Auto
ReferenceAlias Property SonsWindowMage Auto
keyword Property CW1MeleeClose Auto
keyword Property CW1MeleeWide Auto
keyword Property CW1MissileClose Auto
keyword Property CW1MissileWide Auto
keyword Property CW2MeleeClose Auto
keyword Property CW2MeleeWide Auto
keyword Property CW2MissileClose Auto
keyword Property CW2MissileWide Auto
keyword Property CW3MeleeClose Auto
keyword Property CW3MeleeWide Auto
keyword Property CW3MissileClose Auto
keyword Property CW3MissileWide Auto
keyword Property CW4MeleeClose Auto
keyword Property CW4MeleeWide Auto
keyword Property CW4MissileClose Auto
keyword Property CW4MissileWide Auto
keyword Property CW5MeleeClose Auto
keyword Property CW5MeleeWide Auto
keyword Property CW5MissileClose Auto
keyword Property CW5MissileWide Auto
;CWThreatBridgeImperial
;CWThreatBridgeSons
;CWThreatFenceImperial
;CWThreatFenceImperialArcher
;CWThreatFenceImperialMage
;CWThreatFenceSons
;CWThreatFenceSonsArcher
;CWThreatFenceSonsMage
;CWThreatHouseImperial
;CWThreatHouseSons
;CWThreatRockImperial
;CWThreatRockSons
;CWThreatStablesImperial
;CWThreatStablesSons
;CWThreatTowerImperial
;CWThreatTowerImperialArcher
;CWThreatTowerImperialMage
;CWThreatTowerSons
;CWThreatTowerSonsArcher
;CWThreatTowerSonsMage
;CWThreatTreeImperial
;CWThreatTreeSons
;CWThreatWallImperial
;CWThreatWallImperialArcher
;CWThreatWallImperialMage
;CWThreatWallSons
;CWThreatWallSonsArcher
;CWThreatWallSonsMage
;CWThreatWindowImperial
;CWThreatWindowImperialArcher
;CWThreatWindowImperialMage
;CWThreatWindowSons
;CWThreatWindowSonsArcher
;CWThreatWindowSonsMage
CWScript Property CWs Auto
{BASE OBJECT - pointer to CWScript on CW quest}
int BattlePhaseToStopBarking = 6 ;once we are in phase 6, we should stop taunting using the combat barks - stage 6 occurs in stage 50 of CWSiege
Function ProcessTriggerActor(Actor TriggerActor, float BattlePhase, bool Bridge = false, bool Fence = false, bool House = false, bool Rock = false, bool Stables = false, bool Tower = false, bool Tree = false, bool Wall = false, bool Window = false)
{Trigger calls this function, passing in it's reference. We decide what do to with it.}
;***
;debug.StartStackProfiling()
; CWScript.Log("CWThreatCombatBarksScript", self + "ProcessTriggerActor(" + TriggerActor + ", BattlePhase:" + BattlePhase + ")")
if BattlePhase >= BattlePhaseToStopBarking
; CWScript.Log("CWThreatCombatBarksScript", self + "ProcessTriggerActor() BattlePhase[" + BattlePhase + "] => BattlePhaseToStopBarking[" + BattlePhaseToStopBarking + "], returning without processing trigger actor.")
return
EndIf
ReferenceAlias FactionTypeAlias
ReferenceAlias FactionTypeRoleAlias
GlobalVariable FactionTypeGlobal
GlobalVariable FactionTypeRoleGlobal
int ActorAllegiance = CWs.GetActorAllgeiance(TriggerActor)
if ActorAllegiance == CWs.iImperials
if Bridge
FactionTypeAlias = ImperialBridge
FactionTypeGlobal = CWs.CWThreatBridgeImperial
ElseIf Fence
FactionTypeAlias = ImperialFence
FactionTypeGlobal = CWs.CWThreatFenceImperial
FactionTypeRoleAlias = determineRoleAlias(TriggerActor, BattlePhase, ImperialFenceArcher, ImperialFenceMage)
FactionTypeRoleGlobal = determineRoleGlobal(TriggerActor, BattlePhase, CWs.CWThreatFenceImperialArcher, CWs.CWThreatFenceImperialMage)
ElseIf House
FactionTypeAlias = ImperialHouse
FactionTypeGlobal = CWs.CWThreatHouseImperial
ElseIf Rock
FactionTypeAlias = ImperialRock
FactionTypeGlobal = CWs.CWThreatRockImperial
ElseIf Stables
FactionTypeAlias = ImperialStables
FactionTypeGlobal = CWs.CWThreatStablesImperial
ElseIf Tower
FactionTypeAlias = ImperialTower
FactionTypeGlobal = CWs.CWThreatTowerImperial
FactionTypeRoleAlias = determineRoleAlias(TriggerActor, BattlePhase, ImperialTowerArcher, ImperialTowerMage)
FactionTypeRoleGlobal = determineRoleGlobal(TriggerActor, BattlePhase, CWs.CWThreatTowerImperialArcher, CWs.CWThreatTowerImperialMage)
ElseIf Tree
FactionTypeAlias = ImperialTree
FactionTypeGlobal = CWs.CWThreatTreeImperial
ElseIf Wall
FactionTypeAlias = ImperialWall
FactionTypeGlobal = CWs.CWThreatWallImperial
FactionTypeRoleAlias = determineRoleAlias(TriggerActor, BattlePhase, ImperialWallArcher, ImperialWallMage)
FactionTypeRoleGlobal = determineRoleGlobal(TriggerActor, BattlePhase, CWs.CWThreatWallImperialArcher, CWs.CWThreatWallImperialMage)
ElseIf Window
FactionTypeAlias = ImperialWindow
FactionTypeGlobal = CWs.CWThreatWindowImperial
FactionTypeRoleAlias = determineRoleAlias(TriggerActor, BattlePhase, ImperialWindowArcher, ImperialWindowMage)
FactionTypeRoleGlobal = determineRoleGlobal(TriggerActor, BattlePhase, CWs.CWThreatWindowImperialArcher, CWs.CWThreatWindowImperialMage)
EndIf
elseif ActorAllegiance == CWs.iSons
if Bridge
FactionTypeAlias = SonsBridge
FactionTypeGlobal = CWs.CWThreatBridgeSons
ElseIf Fence
FactionTypeAlias = SonsFence
FactionTypeGlobal = CWs.CWThreatFenceSons
FactionTypeRoleAlias = determineRoleAlias(TriggerActor, BattlePhase, SonsFenceArcher, SonsFenceMage)
FactionTypeRoleGlobal = determineRoleGlobal(TriggerActor, BattlePhase, CWs.CWThreatFenceSonsArcher, CWs.CWThreatFenceSonsMage)
ElseIf House
FactionTypeAlias = SonsHouse
FactionTypeGlobal = CWs.CWThreatHouseSons
ElseIf Rock
FactionTypeAlias = SonsRock
FactionTypeGlobal = CWs.CWThreatRockSons
ElseIf Stables
FactionTypeAlias = SonsStables
FactionTypeGlobal = CWs.CWThreatStablesSons
ElseIf Tower
FactionTypeAlias = SonsTower
FactionTypeGlobal = CWs.CWThreatTowerSons
FactionTypeRoleAlias = determineRoleAlias(TriggerActor, BattlePhase, SonsTowerArcher, SonsTowerMage)
FactionTypeRoleGlobal = determineRoleGlobal(TriggerActor, BattlePhase, CWs.CWThreatTowerSonsArcher, CWs.CWThreatTowerSonsMage)
ElseIf Tree
FactionTypeAlias = SonsTree
FactionTypeGlobal = CWs.CWThreatTreeSons
ElseIf Wall
FactionTypeAlias = SonsWall
FactionTypeGlobal = CWs.CWThreatWallSons
FactionTypeRoleAlias = determineRoleAlias(TriggerActor, BattlePhase, SonsWallArcher, SonsWallMage)
FactionTypeRoleGlobal = determineRoleGlobal(TriggerActor, BattlePhase, CWs.CWThreatWallSonsArcher, CWs.CWThreatWallSonsMage)
ElseIf Window
FactionTypeAlias = SonsWindow
FactionTypeGlobal = CWs.CWThreatWindowSons
FactionTypeRoleAlias = determineRoleAlias(TriggerActor, BattlePhase, SonsWindowArcher, SonsWindowMage)
FactionTypeRoleGlobal = determineRoleGlobal(TriggerActor, BattlePhase, CWs.CWThreatWindowSonsArcher, CWs.CWThreatWindowSonsMage)
EndIf
endif
If BattlePhase == CWs.CWBattlePhase.GetValue()
FactionTypeAlias.ForceRefTo(TriggerActor)
FactionTypeGlobal.setValue(1)
if FactionTypeRoleAlias
FactionTypeRoleAlias.ForceRefTo(TriggerActor)
FactionTypeRoleGlobal.setValue(1)
EndIf
; CWScript.Log("CWThreatCombatBarksScript", self + "ProcessTriggerActor(" + TriggerActor + ", forced into:" + FactionTypeAlias + ", AND " + FactionTypeRoleAlias + ") and the following globals were set to 1:" + FactionTypeGlobal + " AND " + FactionTypeRoleGlobal)
Else
;this took too long and we are in the wrong phase, we can't be sure this guy's role hasn't changed, dump the alias.
EndIf
;***
;debug.StopStackProfiling()
EndFunction
ReferenceAlias function determineRoleAlias(Actor ActorToCheck, Float BattlePhase, ReferenceAlias TypeArcherAlias, ReferenceAlias TypeMageAlias)
if isArcher(ActorToCheck, BattlePhase)
return TypeArcherAlias
ElseIf isMage(ActorToCheck, BattlePhase)
return TypeMageAlias
Else
return None
EndIf
EndFunction
GlobalVariable function determineRoleGlobal(Actor ActorToCheck, Float BattlePhase, GlobalVariable TypeArcherGlobal, GlobalVariable TypeMageGlobal)
if isArcher(ActorToCheck, BattlePhase)
return TypeArcherGlobal
ElseIf isMage(ActorToCheck, BattlePhase)
return TypeMageGlobal
Else
return None
EndIf
EndFunction
bool function isArcher(Actor ActorToCheck, float BattlePhase)
bool returnVal
if BattlePhase == 1 && ( ActorToCheck.GetLinkedRef(CW1MissileClose) || ActorToCheck.GetLinkedRef(CW1MissileWide) )
returnVal = True
elseif BattlePhase == 2 && ( ActorToCheck.GetLinkedRef(CW2MissileClose) || ActorToCheck.GetLinkedRef(CW2MissileWide) )
returnVal = True
elseif BattlePhase == 3 && ( ActorToCheck.GetLinkedRef(CW3MissileClose) || ActorToCheck.GetLinkedRef(CW3MissileWide) )
returnVal = True
elseif BattlePhase == 4 && ( ActorToCheck.GetLinkedRef(CW4MissileClose) || ActorToCheck.GetLinkedRef(CW4MissileWide) )
returnVal = True
elseif BattlePhase == 5 && ( ActorToCheck.GetLinkedRef(CW5MissileClose) || ActorToCheck.GetLinkedRef(CW5MissileWide) )
returnVal = True
Else
; CWScript.Log("CWThreatCombatBarksScript", self + "isArcher(" + ActorToCheck + ") didn't find a linkedRef with a CWXMissileClose/Wide keyword where X was the BattlePhase:" + BattlePhase)
EndIf
return returnVal
EndFunction
bool function isMage(Actor ActorToCheck, float BattlePhase)
;currently there are no mages
return False
EndFunction
function ClearAliasIfActorIsInIt(ReferenceAlias AliasToCheck, Actor ActorToCheck, GlobalVariable GlobalToClear)
if AliasToCheck.GetReference() == ActorToCheck
GlobalToClear.SetValue(0)
AliasToCheck.Clear()
; CWScript.Log("CWThreatCombatBarksScript", self + "ClearAliasIfActorIsInIt(" + AliasToCheck + ", " + ActorToCheck + ") actor is in alias, so cleared alias and set global to 0:" + GlobalToClear)
EndIf
EndFunction
function ProcessTriggerActorLeaving(Actor TriggerActor)
;***
;debug.StartStackProfiling()
int ActorAllegiance = CWs.GetActorAllgeiance(TriggerActor)
if ActorAllegiance == CWs.iImperials
ClearAliasIfActorIsInIt(ImperialBridge, TriggerActor, CWs.CWThreatBridgeImperial)
ClearAliasIfActorIsInIt(ImperialFence, TriggerActor, CWs.CWThreatFenceImperial)
ClearAliasIfActorIsInIt(ImperialFenceArcher, TriggerActor, CWs.CWThreatFenceImperialArcher)
ClearAliasIfActorIsInIt(ImperialFenceMage, TriggerActor, CWs.CWThreatFenceImperialMage)
ClearAliasIfActorIsInIt(ImperialHouse, TriggerActor, CWs.CWThreatHouseImperial)
ClearAliasIfActorIsInIt(ImperialRock, TriggerActor, CWs.CWThreatRockImperial)
ClearAliasIfActorIsInIt(ImperialStables, TriggerActor, CWs.CWThreatStablesImperial)
ClearAliasIfActorIsInIt(ImperialTower, TriggerActor, CWs.CWThreatTowerImperial)
ClearAliasIfActorIsInIt(ImperialTowerArcher, TriggerActor, CWs.CWThreatTowerImperialArcher)
ClearAliasIfActorIsInIt(ImperialTowerMage, TriggerActor, CWs.CWThreatTowerImperialMage)
ClearAliasIfActorIsInIt(ImperialTree, TriggerActor, CWs.CWThreatTreeImperial)
ClearAliasIfActorIsInIt(ImperialWall, TriggerActor, CWs.CWThreatWallImperial)
ClearAliasIfActorIsInIt(ImperialWallArcher, TriggerActor, CWs.CWThreatWallImperialArcher)
ClearAliasIfActorIsInIt(ImperialWallMage, TriggerActor, CWs.CWThreatWallImperialMage)
ClearAliasIfActorIsInIt(ImperialWindow, TriggerActor, CWs.CWThreatWindowImperial)
ClearAliasIfActorIsInIt(ImperialWindowArcher, TriggerActor, CWs.CWThreatWindowImperialArcher)
ClearAliasIfActorIsInIt(ImperialWindowMage, TriggerActor, CWs.CWThreatWindowImperialMage)
elseif ActorAllegiance == CWs.iSons
ClearAliasIfActorIsInIt(SonsBridge, TriggerActor, CWs.CWThreatBridgeSons)
ClearAliasIfActorIsInIt(SonsFence, TriggerActor, CWs.CWThreatFenceSons)
ClearAliasIfActorIsInIt(SonsFenceArcher, TriggerActor, CWs.CWThreatFenceSonsArcher)
ClearAliasIfActorIsInIt(SonsFenceMage, TriggerActor, CWs.CWThreatFenceSonsMage)
ClearAliasIfActorIsInIt(SonsHouse, TriggerActor, CWs.CWThreatHouseSons)
ClearAliasIfActorIsInIt(SonsRock, TriggerActor, CWs.CWThreatRockSons)
ClearAliasIfActorIsInIt(SonsStables, TriggerActor, CWs.CWThreatStablesSons)
ClearAliasIfActorIsInIt(SonsTower, TriggerActor, CWs.CWThreatTowerSons)
ClearAliasIfActorIsInIt(SonsTowerArcher, TriggerActor, CWs.CWThreatTowerSonsArcher)
ClearAliasIfActorIsInIt(SonsTowerMage, TriggerActor, CWs.CWThreatTowerSonsMage)
ClearAliasIfActorIsInIt(SonsTree, TriggerActor, CWs.CWThreatTreeSons)
ClearAliasIfActorIsInIt(SonsWall, TriggerActor, CWs.CWThreatWallSons)
ClearAliasIfActorIsInIt(SonsWallArcher, TriggerActor, CWs.CWThreatWallSonsArcher)
ClearAliasIfActorIsInIt(SonsWallMage, TriggerActor, CWs.CWThreatWallSonsMage)
ClearAliasIfActorIsInIt(SonsWindow, TriggerActor, CWs.CWThreatWindowSons)
ClearAliasIfActorIsInIt(SonsWindowArcher, TriggerActor, CWs.CWThreatWindowSonsArcher)
ClearAliasIfActorIsInIt(SonsWindowMage, TriggerActor, CWs.CWThreatWindowSonsMage)
EndIf
;***
;debug.StopStackProfiling()
EndFunction
;Called by sieges when the battle phase changes
function RegisterBattlePhaseChanged()
CWs.CWThreatBridgeImperial.SetValue(0)
CWs.CWThreatBridgeSons.SetValue(0)
CWs.CWThreatFenceImperial.SetValue(0)
CWs.CWThreatFenceImperialArcher.SetValue(0)
CWs.CWThreatFenceImperialMage.SetValue(0)
CWs.CWThreatFenceSons.SetValue(0)
CWs.CWThreatFenceSonsArcher.SetValue(0)
CWs.CWThreatFenceSonsMage.SetValue(0)
CWs.CWThreatHouseImperial.SetValue(0)
CWs.CWThreatHouseSons.SetValue(0)
CWs.CWThreatRockImperial.SetValue(0)
CWs.CWThreatRockSons.SetValue(0)
CWs.CWThreatStablesImperial.SetValue(0)
CWs.CWThreatStablesSons.SetValue(0)
CWs.CWThreatTowerImperial.SetValue(0)
CWs.CWThreatTowerImperialArcher.SetValue(0)
CWs.CWThreatTowerImperialMage.SetValue(0)
CWs.CWThreatTowerSons.SetValue(0)
CWs.CWThreatTowerSonsArcher.SetValue(0)
CWs.CWThreatTowerSonsMage.SetValue(0)
CWs.CWThreatTreeImperial.SetValue(0)
CWs.CWThreatTreeSons.SetValue(0)
CWs.CWThreatWallImperial.SetValue(0)
CWs.CWThreatWallImperialArcher.SetValue(0)
CWs.CWThreatWallImperialMage.SetValue(0)
CWs.CWThreatWallSons.SetValue(0)
CWs.CWThreatWallSonsArcher.SetValue(0)
CWs.CWThreatWallSonsMage.SetValue(0)
CWs.CWThreatWindowImperial.SetValue(0)
CWs.CWThreatWindowImperialArcher.SetValue(0)
CWs.CWThreatWindowImperialMage.SetValue(0)
CWs.CWThreatWindowSons.SetValue(0)
CWs.CWThreatWindowSonsArcher.SetValue(0)
CWs.CWThreatWindowSonsMage.SetValue(0)
ImperialBridge.clear()
ImperialFence.clear()
ImperialFenceArcher.clear()
ImperialFenceMage.clear()
ImperialHouse.clear()
ImperialRock.clear()
ImperialStables.clear()
ImperialTower.clear()
ImperialTowerArcher.clear()
ImperialTowerMage.clear()
ImperialTree.clear()
ImperialWall.clear()
ImperialWallArcher.clear()
ImperialWallMage.clear()
ImperialWindow.clear()
ImperialWindowArcher.clear()
ImperialWindowMage.clear()
SonsBridge.clear()
SonsFence.clear()
SonsFenceArcher.clear()
SonsFenceMage.clear()
SonsHouse.clear()
SonsRock.clear()
SonsStables.clear()
SonsTower.clear()
SonsTowerArcher.clear()
SonsTowerMage.clear()
SonsTree.clear()
SonsWall.clear()
SonsWallArcher.clear()
SonsWallMage.clear()
SonsWindow.clear()
SonsWindowArcher.clear()
SonsWindowMage.clear()
EndFunction
Loading…
Cancel
Save