Nutulator Posted August 23, 2016 Share Posted August 23, 2016 (edited) Hey guys, I'll like some help troubleshooting a problem in my mod. I've edited the flare gun quest so when the player uses the flare gun it spawns the custom NPCs which I've made instead of the minutemen. Using the flare gun also makes them the player's companions. The problem is, it doesn't work the second time. On the first time it works as it should, launch the flare and the four NPCs spawn near you in a couple seconds. The second time, lets say the player dismisses the squad and tries to call them again later on, they don't spawn. It doesn't work either when I try using the console and calling the quest through set stage. Perhaps this is also related--the NPCs don't dismiss to the location you specify. They will get dismissed but they always return to the same old location--at the middle of the main road in Sanctuary Hills. Dismiss location under CompanionActorScript is set to something different but still. Only way this part of the mods works is in conjunction with Unlimited Companion Framework. I haven't seen any compatibility issues. I'm missing something and I don't know what it is. Any guesses what I can try to resolve this? Thanks a lot. I've included some screenshots of the mod settings in the CK along with a screenshot of the edited script the mod is using and the original MinFlareGunQuestScript in code. http://i.imgur.com/SQh4Nbe.jpg http://i.imgur.com/C8aV2Wb.jpg http://i.imgur.com/EQe3jIS.jpg Scriptname MinFlareGunQuestScript extends Quest ReferenceAlias Property Workshop01 Auto Const ReferenceAlias Property Flare Auto Const WorkshopParentScript Property WorkshopParent auto const ReferenceAlias[] Property MarkerAliases Auto Const ReferenceAlias Property MinutemanLeader Auto Const RefCollectionAlias Property Minutemen Auto Const ReferenceAlias Property MinutemanDog Auto Const GlobalVariable Property MinFlareGunCooldown auto const { set to next time flare gun can be used } Activator Property MinFlareGunProjectileShooter auto const int minMarkerDistance = 4000 const ; minimum distance of marker to start Minutemen at int minFlareHeight = 500 const ; minimum height above player for flare to count as signal float cooldownDays = 0.4 const ; a bit more than 8 hours of gametime between times when you can use flare gun float minFlareResponseDays = 0.05 const float maxFlareResponseDays = 0.1 const bool minutemenResponded = false function Initialize() ; is flare high enough above player to count as "flare"? ; NOTE - yes this means flares won't work when fired horizontally from the tops of tall buildings... ObjectReference flareRef = Flare.GetRef() float height = flareRef.GetPositionZ() - Game.GetPlayer().GetPositionZ() debug.trace(self + " Flare height = " + height) if height < minFlareHeight ; run short timer, then stop StartTimerGameTime(0.01) else minutemenResponded = true ; figure out where to place Minutemen, and how many to enable ; first in array is closest, work your way down int i = 0 bool foundMarker = false while i < MarkerAliases.Length && foundMarker == false ObjectReference marker = MarkerAliases[i].GetRef() if marker && marker.GetDistance(Game.GetPlayer()) > minMarkerDistance && Game.GetPlayer().HasDirectLOS(marker) == false && Game.GetPlayer().HasDetectionLOS(marker) == false foundMarker = true debug.trace(self + " found valid marker " + marker + " (distance=" + marker.GetDistance(game.Getplayer()) + ")") ; move Minutemen here Minutemen.MoveAllTo(marker) MinutemanLeader.TryToMoveTo(marker) MinutemanDog.TryToMoveTo(marker) else debug.trace(self + " skipping marker " + marker + " (distance=" + marker.GetDistance(game.Getplayer()) + ")") endif i += 1 endWhile ; enable the minutemen MinutemanLeader.TryToEnable() MinutemanDog.TryToEnable() ; how many others? ObjectReference workshopRef = Workshop01.GetRef() ; get population of workshop settlement float population = workshopRef.GetValue(WorkshopParent.WorkshopRatings[WorkshopParent.WorkshopRatingPopulation].resourceValue) as int ; max is +1 per 3 population: int populationBonus = Math.Ceiling(population/3.0) debug.trace(self + " population=" + population + ", bonus=" + populationBonus) int minCount = 1 int maxCount = 1 + populationBonus int actualCount = Utility.RandomInt(minCount, maxCount) debug.trace(self + " actual count=" + actualCount) if actualCount >= Minutemen.GetCount() Minutemen.EnableAll() else i = 0 while i < actualCount Minutemen.GetAt(i).Enable() i += 1 endWhile endif ; random wait StartTimerGameTime(utility.RandomFloat(minFlareResponseDays, maxFlareResponseDays)) endif endFunction Event OnTimerGameTime(int aiTimerID) debug.trace(self + " start timer expired") if minutemenResponded ; if leader not too close, fire flare ObjectReference leader = MinutemanLeader.GetRef() if leader.GetDistance(Game.GetPlayer()) > minMarkerDistance debug.trace(self + " leader is far enough away - fire flare") Game.GetPlayer().PlaceAtMe(MinFlareGunProjectileShooter) endif else debug.trace(self + " no one responding, stop quest") Stop() endif EndEvent function Shutdown() ; set next available time global to current time + cooldownDays if minutemenResponded MinFlareGunCooldown.SetValue(Utility.GetCurrentGameTime() + cooldownDays) endif endFunction Edited August 23, 2016 by Nutulator Link to comment Share on other sites More sharing options...
kwong96 Posted August 23, 2016 Share Posted August 23, 2016 just an initial thought in regards to setting the stage, make sure you have "allow repeated stages" on the quest data tab. Link to comment Share on other sites More sharing options...
Nutulator Posted August 23, 2016 Author Share Posted August 23, 2016 Yup, I have that checked but still no difference. Link to comment Share on other sites More sharing options...
Nutulator Posted August 23, 2016 Author Share Posted August 23, 2016 (edited) I got an idea, perhaps the reset quest function will work. I'm not exactly good at coding so can someone be kind enough to tell me what lines of code would go where? Edit: Well that narrows it down, through sqv I found out the last stage wasn't ending the quest, it kept running on stage 1000 and never changed. kmyQuest.Shutdown() didn't work, huh. Now I need something to actually end it.... what could that be? Edited August 23, 2016 by Nutulator Link to comment Share on other sites More sharing options...
MasterMagnus Posted August 24, 2016 Share Posted August 24, 2016 There is no Shutdown function. If you want to stop a quest from running without completing it, yourQuest.Stop() http://www.creationkit.com/fallout4/index.php?title=Stop_-_Quest Link to comment Share on other sites More sharing options...
Nutulator Posted August 24, 2016 Author Share Posted August 24, 2016 Interesting... I wonder why the original script has shutdown() in it then. I've figured the rest out, thanks for the help guys. Link to comment Share on other sites More sharing options...
Recommended Posts