Snowbick Posted September 2, 2022 Share Posted September 2, 2022 [Google translation]--------------------------Hello world! I am a novice in modding.I'm having fun making a little dlc for fallout 4.But I'm stuck on one thing. Here's my problem: I would like that when a stage of my quest is completed "SetObjectiveCompleted(XX)", an NPC appears in a specific place, but only for a predefined time of the day. For example: In my quest, the Player listens to a radio to start the main quest, the message asks him to go to a location to meet an NPC who is only there between 9am and 11am.If the player goes before, the NPC does not appear, if the player goes in these hours, the NPC is there. What script would allow me to do that? Can you tell me what to look for (script, package..)? Thank you for your help. [Francais]------------- Salut tout le monde ! Je suis un novice dans le modding.Je suis en train de m'amuser à faire un petit dlc pour fallout 4.Mais je suis bloqué sur un truc. Voilà mon problème : J'aimerais que lorsque qu'un stage de ma quête soit complété "SetObjectiveCompleted(XX)" , un NPC apparait à un endroit précis, mais seulement pendant un temps prédéfini de la journée. Par exemple : Dans ma quête, le Player écoute une radio pour débuter la quête principale, le message lui demande d'aller à une localisation pour rencontrer un NPC qui n'ai là que entre 9h et 11h.Si le joueur y va avant, le NPC n'apparait pas, si le joueur va dans ces heures la, le NPC est là. Quel script me permettrait de faire ca ?Pouvez vous m'indiquer vers quoi chercher (script, package..)? Merci pour votre aide. Link to comment Share on other sites More sharing options...
Zorkaz Posted September 3, 2022 Share Posted September 3, 2022 StartTimerGameTime should do the jobhttps://www.creationkit.com/fallout4/index.php?title=StartTimerGameTime_-_ScriptObject Link to comment Share on other sites More sharing options...
LarannKiar Posted September 3, 2022 Share Posted September 3, 2022 The quest Confidence Man has such timer, take a look at the function FightTimerSetup() (MS14QuestScript). Link to comment Share on other sites More sharing options...
SKKmods Posted September 3, 2022 Share Posted September 3, 2022 You could either attach a script to a quest that monitors the player for OnLocationChange event to your trigger location, or, less intrusive place an invisible activator in the location as a spawn controller that manages the actor. Before getting into actual script solution: 1. Is the spawned actor unique or a common ActorBase. 2. Once the spawn conditions are met, does the actor persist or despwan once the player leaves. 3. If the actor despawns shoudl they respawn during the valid hours range. There are so many different ways of achiveing the outcome you need to be clear on your design criteria. Link to comment Share on other sites More sharing options...
Snowbick Posted September 3, 2022 Author Share Posted September 3, 2022 StartTimerGameTime should do the jobhttps://www.creationkit.com/fallout4/index.php?title=StartTimerGameTime_-_ScriptObject Ok thanks you ! I will look at this function and try to understand it Link to comment Share on other sites More sharing options...
Snowbick Posted September 3, 2022 Author Share Posted September 3, 2022 The quest Confidence Man has such timer, take a look at the function FightTimerSetup() (MS14QuestScript).Good idea, I'll look at this Link to comment Share on other sites More sharing options...
Snowbick Posted September 3, 2022 Author Share Posted September 3, 2022 You could either attach a script to a quest that monitors the player for OnLocationChange event to your trigger location, or, less intrusive place an invisible activator in the location as a spawn controller that manages the actor. Before getting into actual script solution: 1. Is the spawned actor unique or a common ActorBase. 2. Once the spawn conditions are met, does the actor persist or despwan once the player leaves. 3. If the actor despawns shoudl they respawn during the valid hours range. There are so many different ways of achiveing the outcome you need to be clear on your design criteria. Ok thanks , 1. yes the actor is unique2. it doesn't matter but in the idea the actor stays even if the Player leaves I will try to find with this information thank you very much ;-) Link to comment Share on other sites More sharing options...
SKKmods Posted September 3, 2022 Share Posted September 3, 2022 If the actor is unique you could simply attach an event OnLoad() enable/disable script to the actor and place the actor where you want them. This is the logic (no not a full script): Event OnLoad() If (pMyQuestName.GetStage() >= 100) If (pGameHour.GetValue() <= 6) || (pGameHour.GetValue() >= 20) ; night time Self.MoveToMyEditorLocation() ; consistent placed start position Self.Enable() Else ; daytime Self.Disable() EndIf EndIf EndEvent Link to comment Share on other sites More sharing options...
Snowbick Posted September 3, 2022 Author Share Posted September 3, 2022 (edited) If the actor is unique you could simply attach an event OnLoad() enable/disable script to the actor and place the actor where you want them. This is the logic (no not a full script): Event OnLoad() If (pMyQuestName.GetStage() >= 100) If (pGameHour.GetValue() <= 6) || (pGameHour.GetValue() >= 20) ; night time Self.MoveToMyEditorLocation() ; consistent placed start position Self.Enable() Else ; daytime Self.Disable() EndIf EndIf EndEvent Thank you for your help! I finally put a trigger in the area with an "OnTriggerEnter" script : My NPC is initialy disable and if the player enters the trigger during the right hours, the NPC appears(enable), otherwise the NPC remains disabled it does what I want! Thanks to you I made my first script! But I have to learn better how to make scripts in the Creation Kit because I spent 3 hours doing just that... that's what it looks like : pNW_02JamesQuest01 : quest namepNW_02James : actor's nameNW_02JamesScriptSpawnLexington : script name Scriptname NW_02JamesScriptSpawnLexington extends ObjectReference Const Actor Property pNW_02James Auto Const Quest Property pNW_02JamesQuest01 Auto Const float Function GetCurrentHourOfDay() float Time = Utility.GetCurrentGameTime() Time -= Math.Floor(Time) ; Remove "previous in-game days passed" bit Time *= 24 ; Convert from fraction of a day to number of hours Return Time EndFunction Event OnTriggerEnter(ObjectReference akTriggerRef) If akTriggerRef == Game.GetPlayer() If (pNW_02JamesQuest01.GetStage() >= 30) If (GetCurrentHourOfDay () < 10) || (GetCurrentHourOfDay () > 12) debug.notification("Pas de James a l'horizon...") pNW_02James.Disable() Else pNW_02James.Enable() EndIf Else pNW_02James.Disable() EndIf Endif EndEvent I'll try something else later but for now it's perfect! Thanks Edited September 3, 2022 by Snowbick Link to comment Share on other sites More sharing options...
Recommended Posts