Command that negates the whole Script

Post » Sat Oct 18, 2014 8:01 am

Hi guys. I've created a spell that lasts 60 secs. The script of this spell contains commands that are being executed constantly for over 60 secs. Is there any way to add a command in the script so that it can negate the whole script in order to stop the last stages of the process? I know it's a bit complicated, but please try to understand.

e.g. [Event OnEffectFinish (end then i add the command)]

User avatar
ImmaTakeYour
 
Posts: 3383
Joined: Mon Sep 03, 2007 12:45 pm

Post » Sat Oct 18, 2014 7:41 pm

http://skyrimmw.weebly.com/skyrim-modding/creating-a-do-once-script-skyrim-modding-tutorial or http://www.creationkit.com/States_(Papyrus)

User avatar
Kill Bill
 
Posts: 3355
Joined: Wed Aug 30, 2006 2:22 am

Post » Sat Oct 18, 2014 6:19 pm

Thanx for the fast reply but this doesnt seem to solve the problem. Here is how the script works: After the activation of the spell, for the next 60 secs a command is continiously activated and taks effect. Up to here everything is fine. The problem is here: When i use the T button(Wait) the command still takes effect even if the spell has ended. I think that the pc doesnt understand the passing of the time with the T button so i would like to put a command at the [Event onFinish] that negates the whole previous script, so after waitng nothing should take effect. I know its a bit complicated, but as i said before please try to understand. Thanx in advance.

User avatar
Josephine Gowing
 
Posts: 3545
Joined: Fri Jun 30, 2006 12:41 pm

Post » Sat Oct 18, 2014 6:41 am

If you just post your spell script this will be a lot easier to fix ;)

User avatar
Roisan Sweeney
 
Posts: 3462
Joined: Sun Aug 13, 2006 8:28 pm

Post » Sat Oct 18, 2014 8:27 am

Exactly - we can only do so much from explanations.

User avatar
Janeth Valenzuela Castelo
 
Posts: 3411
Joined: Wed Jun 21, 2006 3:03 am

Post » Sat Oct 18, 2014 8:06 pm

Ok. Here comes a big story. I have created a spell that changes the eye texture to a blind for a minute. As long as I activate the spell in 3rd person view, everything is fine. But if i activate the spell in 1st person view and then change to 3rd person, there is no change to eyes. So i was trying a solution and came up with an idea. Using the Utility.Wait 60 times one at every second even if i changed to 3rd person view the change eye texture command should be still activated. Refreshing the face at the Event OnFinish restores the eyes to the original color. Everything works perfectly up to here. The only problem is that if i use the T button(Wait). the time still counts and the commands are still be activated for the rest of the minute. So if i could put a command on Event OnFinish that disables the script, i think that the problem will be solved cause after waitng the spell would expire, then the Event OnFinish and the rest of the script would be disabled.

Scriptname polymorphEyes extends activemagiceffect
;=== Imports ===--
Import Utility
Import Game
;=== Variables ===--
Actor _Caster
;=== Properties ===--
TextureSet property BlindEyes auto
Event OnEffectStart(Actor akTarget, Actor akCaster)
Utility.Wait(1)
akCaster.SetEyeTexture(BlindEyes)
Utility.Wait(2)
akCaster.SetEyeTexture(BlindEyes)
Utility.Wait(3)
akCaster.SetEyeTexture(BlindEyes)
Utility.Wait(4)
akCaster.SetEyeTexture(BlindEyes)
Utility.Wait(5)
akCaster.SetEyeTexture(BlindEyes)
.
.
.
.
.
.
.
EndEvent
Event OnEffectFinish(Actor akTarget, Actor akCaster)
RefreshFace()
EndEvent
Function RefreshFace()
If !_Caster
Return
EndIf
String facegen = "bUseFaceGenPreprocessedHeads:General"
SetINIBool(facegen, False)
_Caster.QueueNiNodeUpdate()
SetINIBool(facegen, True)
EndFunction
(Please remove the dots in the script. I used them to save time and space)
User avatar
Penny Wills
 
Posts: 3474
Joined: Wed Sep 27, 2006 6:16 pm

Post » Sat Oct 18, 2014 7:10 pm

Couldn't you just http://www.creationkit.com/RegisterForSingleUpdate_-_Form within a loop rather than using Utility.Wait, which is a latent function and will pause your entire script for that amount of time? It counts the waiting time/sleeping time AFAIK. Or maybe I'm just missing the point entirely here...

User avatar
Ashley Hill
 
Posts: 3516
Joined: Tue Jul 04, 2006 5:27 am

Post » Sat Oct 18, 2014 2:01 pm

Kuertee had a similar problem, so he came up with http://www.creationkit.com/Passing_Conditions_to_Papyrus that will send you an "event" when the player changes perspective from first to third person.

You could set up a second magic effect & script as instructed on that page, but instead of the debug message, send an SKSE event. This would be the whole script you would need for that effect:

Event OnEffectStart(Actor akTarget, Actor akCaster)    SendModEvent("EVENT_OnEnterFirstPerson")EndEventEvent OnEffectFinish(Actor akTarget, Actor akCaster)    SendModEvent("EVENT_OnEnterThirdPerson")EndEvent

Then back in your original spell (the one you pasted above) you can simplify the script quite a lot. You will want to RegisterForModEvent to listen for the events as they get sent from your other effect.

Spoiler
Scriptname polymorphEyes extends activemagiceffect  ;=== Imports ===--Import UtilityImport Game;=== Variables ===--Actor _Caster;=== Properties ===--TextureSet property BlindEyes autoSpell property YourPerspectiveDetectingAbility auto ;fill this with your conditioned abilityEvent OnEffectStart(Actor akTarget, Actor akCaster)  akCaster.AddSpell(YourPerspectiveDetectingAbility)  RegisterForModEvent("EVENT_OnEnterFirstPerson", "OnEnterFirstPerson")  RegisterForModEvent("EVENT_OnEnterThirdPerson", "OnEnterThirdPerson")  akCaster.SetEyeTexture(BlindEyes)EndEventEvent OnEnterFirstPerson(string eventName, string strArg, float numArg, Form sender)    debug.notification("Entered first person mode!")    ;do anything you need to do when the player goes back to first person hereEndEventEvent OnEnterThirdPerson(string eventName, string strArg, float numArg, Form sender)    debug.notification("Entered third person mode!")    akCaster.SetEyeTexture(BlindEyes)EndEventEvent OnEffectFinish(Actor akTarget, Actor akCaster)  akCaster.RemoveSpell(YourPerspectiveDetectingAbility)  RefreshFace()EndEventFunction RefreshFace()  If !_Caster    Return  EndIf  String facegen = "bUseFaceGenPreprocessedHeads:General"  SetINIBool(facegen, False)  _Caster.QueueNiNodeUpdate()  SetINIBool(facegen, True)EndFunction 

And FYI, in that script above you're increasing the amount of time you wait every time you call Utility.Wait - so for instance, when you call "Utility.Wait(5)" that means your script will stop for five seconds, not just one. :smile:

User avatar
Marnesia Steele
 
Posts: 3398
Joined: Thu Aug 09, 2007 10:11 pm


Return to V - Skyrim