New Papyrus Thread: Code not executing.

Post » Wed Jun 20, 2012 5:23 am

I presume you are setting it in some other script, since I don't see any SetValue statements?

Can you show us the script where you set it? That might give us some insight.
User avatar
Anna Krzyzanowska
 
Posts: 3330
Joined: Thu Aug 03, 2006 3:08 am

Post » Wed Jun 20, 2012 1:30 pm

What value is GetValue() giving you, and what should it be? You don't have a SetValue() in your script, so it should be whatever you set it as in the CK.
User avatar
Thema
 
Posts: 3461
Joined: Thu Sep 21, 2006 2:36 am

Post » Wed Jun 20, 2012 1:26 pm

It's set to 1 by another papyrus fragment... Here it is :

MOD1QPart2.SetStage(3)MOD1QPart1.SetStage(32)akSpeaker.SetAllowFlying(False)MOD1QCombatPhase.SetValue(1)akSpeaker.StartCombat(Game.GetPlayer())


*This is an END Dialouge fragment BTW


Edit: Also, GetValue() is returning 0, but (in the console) GetGlobalValue is showing me the correct value (1)
User avatar
Kaylee Campbell
 
Posts: 3463
Joined: Mon Mar 05, 2007 11:17 am

Post » Wed Jun 20, 2012 2:00 am

Well, SetValue() is supposed to accept a float so maybe you could try "SetValue(1.0)" and see if that does anything. Or nvm, if that was a problem then checking the console wouldn't have given you the correct value.

Did you try SetValueInt() and GetValueInt() instead? Those are the ones I've used and they worked for me.
User avatar
LuCY sCoTT
 
Posts: 3410
Joined: Sun Feb 04, 2007 8:29 am

Post » Wed Jun 20, 2012 11:02 am

Well, SetValue() is supposed to accept a float so maybe you could try "SetValue(1.0)" and see if that does anything. Or nvm, if that was a problem then checking the console wouldn't have given you the correct value.

Did you try SetValueInt() and GetValueInt() instead? Those are the ones I've used and they worked for me.

Actually I haven't don't know why. I'll try GetValueInt()


EDIT: It's still not working. Even with GetValueInt()
User avatar
Dawn Farrell
 
Posts: 3522
Joined: Thu Aug 23, 2007 9:02 am

Post » Wed Jun 20, 2012 1:59 pm

I presume that it's also being changed elsewhere, otherwise it will always be that initial value?
User avatar
Emily Rose
 
Posts: 3482
Joined: Sat Feb 17, 2007 5:56 pm

Post » Wed Jun 20, 2012 9:53 am

You're obviously right. The Engine won't allow me to go backwards. Plus it says right there in the wiki: "Otherwise, http://www.creationkit.com/SetCurrentStageID_-_Quest has no effect after it is called the first time for any stage on a running quest." This was invalid, however, my point still stands, the quote mentioned that it only affects what the player sees when "SetStage" is called for a stage, it still does not allow one to entirely repeat a stage. Now I just need to figure out how to get around it.

So I need to figure out how to create some kind of global-variable-esque thing.

Actually, my http://www.gamesas.com/topic/1360040-tools-you-got-a-letter-from-what/ implementation repeatedly cycles through stages just fine if you want to dispense with the Global variable issue for the moment..
User avatar
Cat Haines
 
Posts: 3385
Joined: Fri Oct 27, 2006 9:27 am

Post » Wed Jun 20, 2012 7:08 am

OK...spotted several big issues...first, you don't appear to be updating your global when you change state. Second, you're not registering for update in several of your states, and third, you're using Flyingstate1 and Flyingstate2 as states, when they're really just functions:

Spoiler
Scriptname MOD1AazCombatScript extends Actor  Quest Property MOD1QPart1 AutoGlobalVariable Property combatphase  Auto  Int property Phase AutoEvent OnInit()endeventauto state waitingstate        Event OnInit()	    registerforupdate(5);Polling    endevent    Event OnUpdate()	    if (MOD1QPart1.GetStage() == 29)		    unregisterforupdate();		    debug.notification("exiting waiting state");		    Phase = 1		    gotostate ("activestate")	    else		    debug.notification("in waiting state" + MOD1QPart1.GetStage())	    endif    endeventendstatestate activestate    Event OnBeginState()	    debug.notification("entered active state");	    registerforsingleupdate(5);    endevent    event onupdate()    int phase = combatphase.getvalue() as int;	    if (phase == 1)		    gotostate ("combatstate");	    elseif (phase == 2)		    flyingstate1()	    elseif (phase == 3)		    Flyingstate2()	    else		    gotostate ("activestate");		    debug.notification ("In activestate. Phase =" + phase);	    endif    endeventendstatestate combatstate    Event OnBeginState()	    setallowflying(false);	    startcombat(game.getplayer());	    registerforsingleupdate(10);	    Phase = 2    endevent    event onupdate()	    gotostate ("activestate")    endeventendstateFunction flyingstate1()	    setallowflying(true)	    stopcombat()    RegisterForSingleUpdate(120)    Phase = 3endFunctionFunction flyingstate2()	    setallowflying(true) ; You sure? Not time to land yet?	    stopcombat()    RegisterForSingleUpdate(120)    Phase = 1 ; This will make him land and attack next time.endFunction

Give that a try.
User avatar
Marguerite Dabrin
 
Posts: 3546
Joined: Tue Mar 20, 2007 11:33 am

Post » Wed Jun 20, 2012 2:48 am

Slightly taking a break from working on this issue to work on the rest of my mod, but...it didn't work.
User avatar
JD bernal
 
Posts: 3450
Joined: Sun Sep 02, 2007 8:10 am

Post » Wed Jun 20, 2012 4:21 am

Slightly taking a break from working on this issue to work on the rest of my mod, but...it didn't work.

Ah, I forgot to take out the global variable when I added the property...


Spoiler
Scriptname MOD1AazCombatScript extends Actor  Quest Property MOD1QPart1 AutoGlobalVariable Property combatphase  Auto  Int property Phase Autoauto state waitingstate    Event OnInit()	    registerforupdate(5);Polling    endevent    Event OnUpdate()	    if (MOD1QPart1.GetStage() == 29)        unregisterforupdate();        debug.notification("exiting waiting state");        Phase = 1        registerforsingleupdate(5);        gotostate ("activestate")	    else		    debug.notification("in waiting state" + Phase)	    endif    endeventendstatestate activestate    Event OnBeginState()	    debug.notification("entered active state");    endevent    event onupdate()	    if (phase == 1)		    CombatPhase()	    elseif (phase <= 3)		    flyingPhase()	    else        Phase = 0        RegisterForSingleUpdate(5)	    endif    Phase += 1    endeventendstateFunction combatPhase()	    setallowflying(false);	    startcombat(game.getplayer());	    registerforsingleupdate(10);EndFunctionFunction flyingPhase()    setallowflying(true)    stopcombat()    RegisterForSingleUpdate(120)endFunction
User avatar
Jani Eayon
 
Posts: 3435
Joined: Sun Mar 25, 2007 12:19 pm

Post » Wed Jun 20, 2012 7:04 am

Ah, I forgot to take out the global variable when I added the property...


Spoiler
Scriptname MOD1AazCombatScript extends Actor  Quest Property MOD1QPart1 AutoGlobalVariable Property combatphase  Auto  Int property Phase Autoauto state waitingstate	Event OnInit()		registerforupdate(5);Polling	endevent	Event OnUpdate()		if (MOD1QPart1.GetStage() == 29)		unregisterforupdate();		debug.notification("exiting waiting state");		Phase = 1		registerforsingleupdate(5);		gotostate ("activestate")		else			debug.notification("in waiting state" + Phase)		endif	endeventendstatestate activestate	Event OnBeginState()		debug.notification("entered active state");	endevent	event onupdate()		if (phase == 1)			CombatPhase()		elseif (phase <= 3)			flyingPhase()		else		Phase = 0		RegisterForSingleUpdate(5)		endif	Phase += 1	endeventendstateFunction combatPhase()		setallowflying(false);		startcombat(game.getplayer());		registerforsingleupdate(10);EndFunctionFunction flyingPhase()	setallowflying(true)	stopcombat()	RegisterForSingleUpdate(120)endFunction

I actually fixed that before I even posted. It still doesn't work. XD
User avatar
Mason Nevitt
 
Posts: 3346
Joined: Fri May 11, 2007 8:49 pm

Post » Wed Jun 20, 2012 11:19 am

I actually fixed that before I even posted. It still doesn't work. XD

Did you try that second version? I turned the combat phase to a function too and switched to using just two states...
User avatar
Marie Maillos
 
Posts: 3403
Joined: Wed Mar 21, 2007 4:39 pm

Post » Wed Jun 20, 2012 3:25 am

OK, one more try. If this doesn't work, at least it gives some detailed feedback.


Spoiler
Scriptname MOD1AazCombatScript extends Actor  Quest Property MOD1QPart1 AutoGlobalVariable Property combatphase  Auto  Int property Phase = 1 AutoFunction combatPhase()		setallowflying(false);		startcombat(game.getplayer());		registerforsingleupdate(10);EndFunctionFunction flyingPhase()	setallowflying(true)	stopcombat()	RegisterForSingleUpdate(120)endFunctionauto state waitingstate	Event OnInit()		registerforupdate(5) ; Polling	endevent	Event OnUpdate()		if (MOD1QPart1.GetStage() == 29)			unregisterforupdate();			debug.notification("exiting waiting state");			Phase = 1			registerforsingleupdate(5);	   	 gotostate ("activestate")		else		   debug.notification("in waiting state" + Phase)		endif	endeventendstatestate activestate	Event OnBeginState()		debug.notification("entered active state");	endevent	event onupdate()	String Msg = self + " Updating. Phase = "	  if (phase == 1)		   CombatPhase()		   Debug.Notification(Msg + "Combat.")	  elseif (phase <= 3)		   flyingPhase()		   Debug.Notification(Msg + "Flying: " + Phase)	  else		   Debug.Notification(Msg + "Combat in 5 seconds")		   Phase = 0		   RegisterForSingleUpdate(5)	  endif	Phase += 1	endeventendstate
User avatar
Breautiful
 
Posts: 3539
Joined: Tue Jan 16, 2007 6:51 am

Post » Wed Jun 20, 2012 11:26 am

Alright. Working on something else ATM. I'll post feedback by the end of the night though.
User avatar
MISS KEEP UR
 
Posts: 3384
Joined: Sat Aug 26, 2006 6:26 am

Post » Wed Jun 20, 2012 11:11 am

Yea... this just isn't gonna work. I need to go back and carefully rewrite the code myself. I appreciate your attempts to help, but you don't know the other parts of my mod, and other things are causing your script not to work properly.. That last script completely interfered with the scene before it, and didn't really work in the slightest because of it. I've decided to focus on finishing a different part of my mod for now. Thanks for the help. I'll start a thread again in a few days when I get back to working on this code (if I encounter a problem that is.)
User avatar
Sammykins
 
Posts: 3330
Joined: Fri Jun 23, 2006 10:48 am

Post » Wed Jun 20, 2012 2:54 am

It's starting to seem like maybe you have a corrupt save...try turning your mod off, making a new save game, and then loading that save with your quest enabled...

I don't see anything at all that could interfere with another quest stage...it's not changing the quest stage, it wasn't changing the global variable even before I edited it...and it's doing what you said you wanted it to do...or at least it should be, assuming you're using the functions you wanted to use (StopCombat(), etc) correctly.
User avatar
Isabell Hoffmann
 
Posts: 3463
Joined: Wed Apr 18, 2007 11:34 pm

Post » Wed Jun 20, 2012 8:11 am

Well, I know what the problem is. The script calls the Dragons to start combat, but the scene isn't over yet, so it cancels the scene, and the Dragon enters combat
User avatar
Courtney Foren
 
Posts: 3418
Joined: Sun Mar 11, 2007 6:49 am

Post » Wed Jun 20, 2012 5:20 pm

Well, I know what the problem is. The script calls the Dragons to start combat, but the scene isn't over yet, so it cancels the scene, and the Dragon enters combat

Aha...so what you need to do is click the button for "Edit Actor Behavior" on your scene, and uncheck the combat options.

But I thought you said it was triggered by the end of the final dialog of the scene...so how would it cancel the scene? (Assuming you don't set stage 29 until it's time for the dragon to attack when the scene ends?)
User avatar
Soku Nyorah
 
Posts: 3413
Joined: Tue Oct 17, 2006 1:25 pm

Post » Wed Jun 20, 2012 2:23 pm

To force the dragon to wait until all dialog is done before attacking, add one extra phase to your scene at the end, and put a 1 second timer in there, and no other actions, and set the stage to 29 at the end of THAT phase.
User avatar
Eoh
 
Posts: 3378
Joined: Sun Mar 18, 2007 6:03 pm

Post » Wed Jun 20, 2012 6:59 am

No see.. I need to change the stage to 32. This is what I was talking about. It's my fault for not telling you, but there is a lot of information I'd have to give you. One of those things is that the SCENE actually starts on a trigger activate when the stage is 29. The end of the scene actually sets the stage to 32. So yea... iIknow how to fix them problem, I'm just slightly preoccupied with working on the other parts of my mod. Shooting for the Nexus contest Deadline of the 7th, so I'm hustling. XD

EDIT: I know.

EDIT EDIT: There are a lot of things you don't know about this: There are about 3 stages worth of packages which execute on individual actors during the scene. I'll handle it. Thanks for the help.
User avatar
Jennifer May
 
Posts: 3376
Joined: Thu Aug 16, 2007 3:51 pm

Previous

Return to V - Skyrim