Jump to content

Settlemet Raids - Not exactly a "bug" but ...


Perraine

Recommended Posts

It would be great if the script would prevent two settlements from being attacked at the same time. This happened to me and I was in Far Harbor at the time. I knew there was no way I could make it to both in time, so I had to choose which one to defend.

 

(1) Starting more than one attack at a time is a bug in my opinion, since there is a chance that the settlements are too far apart to respond to all ongoing attacks within the time limit. It's not happening very often, but it certainly can happen.

 

(2) I already have a fix for this. If there is general agreement that this is indeed a bug, this can go live in the next UFO4P update.

 

Technically, I defined a new float variable UFO4P_GameTimeOfLastWorkshopAttackStarted on WorkshopParentScript and modified its TriggerAttack() function as follows:

function TriggerAttack(WorkshopScript workshopRef, int attackStrength)
	wsTrace("   TriggerAttack on " + workshopRef)

	;UFO4P 1.0.x Bug #yyyyy: Added the following four lines to limit the number of settlement attacks running at the same time: since attacks will get resolved
	;after 15 hours game time (0.625 game days), it is sufficient to check whether the last attack was started less than 0.625 game days ago:
	if (Utility.GetCurrentGameTime() - UFO4P_GameTimeOfLastWorkshopAttackStarted) < 0.625
		wsTrace("   TriggerAttack CANCELLED")
		return
	endIf	
	
	if !WorkshopEventAttack.SendStoryEventAndWait(akLoc = workshopRef.myLocation, aiValue1 = attackStrength, akRef1 = workshopRef)
		; Removed - now that we have an attack message, don't do fake attacks
		;/
		wsTrace(" 	no attack quest started - resolve if player is not nearby")
		; no quest started - resolve if player is not at this location
		if workshopRef.Is3DLoaded() == false && Game.Getplayer().GetDistance(workshopRef) > 4000
			ResolveAttack(workshopRef, attackStrength, RaiderFaction)
		endif
		/;
	else
		;UFO4P 1.0.x Bug #yyyyy: Added this line to update the tracking variable:
		UFO4P_GameTimeOfLastWorkshopAttackStarted = Utility.GetCurrentGameTime()
	endif
	wsTrace("   TriggerAttack DONE")
endFunction

Since we know that all attacks will get resolved after 15 game hours (= 0.625 game days), we only have to make sure that the time interval between two subsequently triggered attacks is not smaller than that.

 

The fix is not retro-active though: if you install it when you alredy have five attacks running, you'll have to deal with them somehow.  They won't get cancelled.

Link to comment
Share on other sites

  • 3 weeks later...

It turned out that the fix above does not solve the problem, simply because WorkshopParentScript does not trigger several attacks  within such a short period of time (it never did). This thread explains what the real problem is:

http://www.afkmods.com/index.php?/topic/4807-issues-with-random-encounters/

 

Workshop stuff is in post #17, but you will need to read the entire thread to understand the issue.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...