DarkWandererAmon Posted July 31 Posted July 31 Hello everyone? I am once again looking for a method to implement cooldowns for shouts. My current plan is to come up with a script that once a dragon uses a shout via OnSpellCast, they will be UNABLE to equip that shout until a timer is expired. But the timer will only apply to that single shout and the dragon will be able to use other shouts while the said timer is running. Would anyone be able to lend a hand for this? Kind regards! SOME NOTES: 1-I first created a script that casts a self spell on the caster and gave conditions via both keywords and activemagiceffects ==0 to ensure the dragons dont use their shout while their self cooldown spell is active on them (This did not work, while the dragon did cast the self spell on themselves, they still kept using the said shout on the targets, THE ONLY THING THAT CHANGED WAS THE TARGETS OF THE SHOUT BECAME IMMUNE TO THE SHOUT, so sadly dragons kept on using the shouts on the targets. 2-Second thing I tried was to use a global variable and a script when the shout was cast, the global variable would be ticked on and off and when it was of the shout wouldnt be able to be cast. Sadly the same issue happened as the first one, the shout was STILL used only the targets became immune to it 3-Third thing I did was removing the shout and adding it back after using but that caused save corruption (I wanted to experiment after reading the wikia)
Sphered Posted July 31 Posted July 31 Equipping shouts? Or do you mean using them? I should imagine you mean the latter. Aside, have you played with the SKSE functions for shouts, and are you okay with the SKSE requirement? If so, def try them if you haven't yet. SetNthRecovery() could be set to a very high number to effectively make it unusable until lowered again. the only nuance I worry about there, is if you set it back to normal, is IDK how quick it updates where they will realize they can use it again, and such. Not sure there would need testing Below are the shout script calls ScriptName Shout Extends Form Hidden ; SKSE additions built 2015-05-24 00:46:48.937000 UTC WordOfPower Function GetNthWordOfPower(Int n) Native Spell Function GetNthSpell(Int n) Native Float Function GetNthRecoveryTime(Int n) Native Function SetNthWordOfPower(Int n,WordOfPower aWoop) Native Function SetNthSpell(Int n,Spell aSpell) Native Function SetNthRecoveryTime(Int n,Float time) Native
PeterMartyr Posted August 1 Posted August 1 Personally if I add a timer to "anything" I use a Global, but compare it to Days Passed presay... something for you to adapt Scriptname PoupIdleCommentTimerScript extends Quest GlobalVariable Property GameDaysPassed Auto GlobalVariable Property _Poup_NextIdleComment Auto Float Property fMaximum Auto Float Property fMinimum Auto ;/ ; fAmount "game hours" expressed in GameDaysPassed ; 0.02 about 30 in-game minutes ; 0.04 about 1 in-game hour ; 0.06 about 1 hour and 30 minutes in-game ; 0.08 about 2 in-game hours ; 0.10 about 2 hours and 30 minutes in-game /; Function Commented() Float DaysUntilNextAllowed = Utility.RandomFloat(fMinimum, fMaximum) Float NextAllowed = GameDaysPassed.GetValue() + DaysUntilNextAllowed _Poup_NextIdleComment.SetValue(NextAllowed) EndFunction I use that for dialogue, once you adapt it for your needs, you just need to "SET IT" not switch it on and off.. it is a friggin Cooldown! via a Script!! Fire and Forget!!! BTW reason I replied is the USEP CK Wiki implies OnSpellCast does not work for NPC.. OFC needs testing which I am not going to do)) But I can point you or any PEEP reading this in the right direction for Scripted Cooldown)) to be used in CK Conditions I am taking shout recovery time and cooldown to two different things, you need to be more specific if it is not BTW where is this being validated Effect or Spell? IF Effect 18 hours ago, DarkWandererAmon said: THE ONLY THING THAT CHANGED WAS THE TARGETS OF THE SHOUT BECAME IMMUNE TO THE SHOUT, 18 hours ago, DarkWandererAmon said: the shout was STILL used only the targets became immune to it Yeah that what happens try a using a Spell, heaps of shouts have conditions in spells for NPC, it must work!!
DarkWandererAmon Posted Friday at 11:18 AM Author Posted Friday at 11:18 AM 14 hours ago, Sphered said: Equipping shouts? Or do you mean using them? I should imagine you mean the latter. Aside, have you played with the SKSE functions for shouts, and are you okay with the SKSE requirement? If so, def try them if you haven't yet. SetNthRecovery() could be set to a very high number to effectively make it unusable until lowered again. the only nuance I worry about there, is if you set it back to normal, is IDK how quick it updates where they will realize they can use it again, and such. Not sure there would need testing Below are the shout script calls ScriptName Shout Extends Form Hidden ; SKSE additions built 2015-05-24 00:46:48.937000 UTC WordOfPower Function GetNthWordOfPower(Int n) Native Spell Function GetNthSpell(Int n) Native Float Function GetNthRecoveryTime(Int n) Native Function SetNthWordOfPower(Int n,WordOfPower aWoop) Native Function SetNthSpell(Int n,Spell aSpell) Native Function SetNthRecoveryTime(Int n,Float time) Native This is great! Will it affect the shout individually? Or will it affect all the shouts at once? Btw this was what I was initially trying to say. My initial method was to replace one of the shout spells with an empty spell so the shout would become unusable. The DUTShoutCooldownSpell is the empty spell. When a dragon uses a shout it needs to equip it by default. While I was messing with MOREINFOCONSOLE ı realized whenever a dragon shouts on their powers section (I think, will check again and report back) I see that they have the shout they currently cast equipped. And that Dragon.GetEquıppedShout() is to track the used shout. But hope that kinda explains what I was trying to say. Will check your method when I get home tho thank you Sphered! Btw the script is much more complex than the small bit I am sending but I can send the whole bit if need be. It basically uses animation events and globals to achieve it but I cant seem to make it work. SCRIPT: Event OnUpdate() int[] newActiveCooldowns = new int[128] int newNumActiveCooldowns = 0 int index = 0 while(index < numActiveCooldowns) int shoutIndex = ActiveCooldowns[index] - 1 float timeLeft = endTimes[shoutIndex] - Utility.GetCurrentGameTime() if(timeLeft > 0.0) newActiveCooldowns[newNumActiveCooldowns] = shoutIndex + 1 newNumActiveCooldowns += 1 else endTimes[shoutIndex] = 0.0 Shout expiredShout = shouts[shoutIndex] Spell resetspell = expiredShout.GetNthSpell(1) expiredShout.SetNthSpell(0, resetspell) expiredShout.SetNthSpell(2, resetspell) EndIf index += 1 EndWhile ActiveCooldowns = newActiveCooldowns numActiveCooldowns = newNumActiveCooldowns if(numActiveCooldowns != 0) self.RegisterForSingleUpdate(1) EndIf EndEvent Event OnSpellCast(Form akSpell) If (akSpell as Spell) && (isShout == true) isShout = false Spell spellReleased = akSpell as Spell Shout shoutUsed = Dragon.GetEquippedShout() shoutUsed.SetNthSpell(2, DUTShoutCooldownSpell) shoutUsed.SetNthSpell(0, DUTShoutCooldownSpell) int index = shouts.Find(shoutUsed) if(index < 0) index = arraySize shouts[index] = shoutUsed arraySize += 1 EndIf endTimes[index] = Utility.GetCurrentGameTime() + RealTimeSecondsToGameTimeDays((GenerateRandomFloat(18.0, 30.0))) index += 1 int ActiveCooldownIndex = ActiveCooldowns.Find(index) if(ActiveCooldownIndex < 0) ActiveCooldownIndex = numActiveCooldowns numActiveCooldowns += 1 EndIf ActiveCooldowns[ActiveCooldownIndex] = index self.RegisterForSingleUpdate(0) endif
DarkWandererAmon Posted Friday at 11:22 AM Author Posted Friday at 11:22 AM 7 hours ago, PeterMartyr said: Personally if I add a timer to "anything" I use a Global, but compare it to Days Passed presay... something for you to adapt Scriptname PoupIdleCommentTimerScript extends Quest GlobalVariable Property GameDaysPassed Auto GlobalVariable Property _Poup_NextIdleComment Auto Float Property fMaximum Auto Float Property fMinimum Auto ;/ ; fAmount "game hours" expressed in GameDaysPassed ; 0.02 about 30 in-game minutes ; 0.04 about 1 in-game hour ; 0.06 about 1 hour and 30 minutes in-game ; 0.08 about 2 in-game hours ; 0.10 about 2 hours and 30 minutes in-game /; Function Commented() Float DaysUntilNextAllowed = Utility.RandomFloat(fMinimum, fMaximum) Float NextAllowed = GameDaysPassed.GetValue() + DaysUntilNextAllowed _Poup_NextIdleComment.SetValue(NextAllowed) EndFunction I use that for dialogue, once you adapt it for your needs, you just need to "SET IT" not switch it on and off.. it is a friggin Cooldown! via a Script!! Fire and Forget!!! BTW reason I replied is the USEP CK Wiki implies OnSpellCast does not work for NPC.. OFC needs testing which I am not going to do)) But I can point you or any PEEP reading this in the right direction for Scripted Cooldown)) to be used in CK Conditions I am taking shout recovery time and cooldown to two different things, you need to be more specific if it is not BTW where is this being validated Effect or Spell? IF Effect Yeah that what happens try a using a Spell, heaps of shouts have conditions in spells for NPC, it must work!! Thank you for the reply! I think OnSpellCast actually does work for NPCS if set up right. Shout recovery applies to all shouts right like if shout A is used all shouts get a shout recovery. Whereas a cooldown applies to each shout individually, hope that clears it up. The validation is done on effect BUT for testing purposes I tried the conditions on both Spell and magic effect. Also thanks for the script! I kinda use something similar on mine to set up the cooldown duration! So it will truly be helpful!
DarkWandererAmon Posted Tuesday at 03:15 PM Author Posted Tuesday at 03:15 PM I added it to spells Like This excluding the cooldown magic effect but they still ignore it regardless
Recommended Posts