Jappa123 Posted March 7, 2023 Posted March 7, 2023 Hello everyone, I'm trying to set up dialogue for dominant follower, what I want to achieve is: Once device is locked on player, unlock dialogue wont be available for let's say next 5 hours, ater 5 hours follower will be able to unlock locked device. Could you give me some advice, how to get it working? Thanks!
Taki17 Posted March 7, 2023 Posted March 7, 2023 (edited) If you just want the unlock dialogue to have a 5h cooldown when clicked, put 5 in the "Hours until reset" field of the appropriate topic info in the quest that handles this follower's dialogue. If what you want is that the follower locks the player in a restraint in dialogue, then makes the unlock dialogue option unavailable for the next 5 hours, that'll take a bit more work: In the script for the follower's dialogue quest, you need to create the following: a conditional variable that stores if the unlock dialogue is currently on cooldown or not (let's call it UnlockOnCooldown) a variable that stores the exact time the player was locked in the restraint (let's call it PlayerLockedTime) a function that is called from the script fragment attached to the dialogue that equips the player with restraints (let's call it LockPlayerAndSetCooldown) an OnUpdate event handler that periodically checks if the cooldown has expired So the mechanics would look something like this: For the unlock dialogue option to work, add the condition that UnlockOnCooldown needs to be false The follower locks the player in restraints. In the script attached to this dialoge, we call LockPlayerAndSetCooldown In LockPlayerAndSetCooldown, get the current game time and store it in PlayerLockedTime and also set UnlockOnCooldown to true and register this script for an update event In the OnUpdate event handler, check if subtracting the value of PlayerLockedTime, from the value of the GameDaysPassed global, converted to hours results in a value equal to or larger than 5. ( GameDaysPassed.GetValue() - PlayerLockedTime ) * 24.0 > 5.0 ) If so, the cooldown is over, set UnlockOnCooldown to false and do not register for another update - the unlock dialogue option will be available again. If not, register for another update to check this again Edited March 7, 2023 by Taki17
Jappa123 Posted March 7, 2023 Author Posted March 7, 2023 Thank you, I will try to get it working as soon i have some free time.
Jappa123 Posted March 7, 2023 Author Posted March 7, 2023 2 minutes ago, CaptainJ03 said: Are you aware of this mod? Yes, might be good mod to look up for some help in scripting and stuff, will check it out.
MTB Posted March 7, 2023 Posted March 7, 2023 Simplification suggestions for Taki17th's solution: When starting the timer simply compute the expire time eg CanReleaseAfter = GameDaysPassed.GetValue() + duration_in_days and put it somewhere a condition can get at it such as a conditional quest variable or a global. Then on the release conversation info put a condition: GetVMQuestVariable MyQuest CanReleaseAfter < GameDaysPassed (check use global) or GetGlobalValue CanReleaseAfter < GameDaysPassed (check use global) (initialize CanReleaseAfter to a large value or add an AND CanReleaseAfter > 0 so conversation is not available before setting timer.)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now