Jump to content

need help with Quest Stage Result Scripts


grmblf

Recommended Posts

I know it sounds weird, and really it puzzles me 'cause I've done some scripting before that used quest stage result scripts as functions that was called from the main script, but I've been checking, testing and searching info in the wiki with no success until now, so I come to you in hope that someone could spot what's wrong with my attempts.

 

What I have:

A quest set to allow repeat stages. The main script, attached to that quest, that performs some checking and when certain conditions are met calls a setStage X for that quest. Then I have set the stages and written a result script for each one, so 'til now everything looks ok. The problem is when I call the setStage from the quest script, stages are reached (getStageDone X returns true) but result scripts doesn't run even I've set no condition for the stages or flags. I've added some debug code like a message "result script runnign" and some other visible effects but neither they appear nor the variables I change there seem to be altered, so I guess result script isn't running.

 

If someone knows what could be causing this or any other thing about stage functions or result scripts I should be aware of I'll be very thankful to read it as I've been with this all day and it starts to drive me crazy. Really, any clue is appreciated.

 

 

PS: I'm using OBSE and there's no other mod interfering as I'm loading my mod alone in CS (not even oblivion.esm) althought I'm testing it with some other mods. I guess that doesn't matter as the quest IS running and it's script runs too.

Link to comment
Share on other sites

That is odd.

 

You might try disabling the allowed repeat stage and see if the script will run even once.

 

I wonder if perhaps your main script is resetting the stage every frame before the result script has time to process? You might add a simple

 

If (GetStage grmblfQuest != X)
    SetStage grmblfQuest X
EndIf

 

Adding it of course alongside your other checks. I don't know if its the issue but it's worth a try.

 

 

And of course syntax (ironically I mispelled syntax originaly). I can't tell you ow many hours I've spent troubleshooting a script to find out I was missing a period, explicit reference, or asterick. It can be somewha frustrating, but such is the life of a programmer. :)

Link to comment
Share on other sites

Ok so far I've discovered that there's something within my code that prevents the result script from running entirely. I've closed the CS and after opening it again a message prompts and says that 'Errors were encountered during InitItem for result script on quest stage 11, quest 'grmCSQ''

 

and here's my code: (these are actually the maths I plan to use to calc the spell damage. I know it's quite crazy but these are the ones used by the game)

RemoveAllEffectItems grmCSFrostBallSpell

set grmCSQ.skillFactor to ( 0.2 + 1.2 * ( 1 - ( player.getAV Destruction / 100 ) ) )
If ( grmCSQ.skillFactor < 0.9 )
set grmCSQ.skillFactor to 0.9
Endif
set grmCSQ.kFactor to ( grmCSQ.magickaSpent / ( 1.5 * 0.74 * grmCSQ.skillFactor ) )
set grmCSQ.timerFactor to ( 1 + ( grmCSQ.timer / 5 ) )
set grmCSQ.expFactor to ( log grmCSQ.kFactor ) / 1.15
set grmCSQ.magnitude to ( ( exp grmCSQ.expFactor ) * grmCSQ.timerFactor )

AddFullEffectItem FRDG grmCSQ.magnitude 5 1 2 grmCSFrostBallSpell

 

Every variable is declared in the quest script and the reference it's a spell I've made and that's it's EditorID.

Link to comment
Share on other sites

Instead of setting quest stages for doing that I would instead set a variable (You could label it stage so it feels the same to you). Because I think you might be having an issue calling all the "quest.variabe" variables. I'm not sure however.

 

Most the time when I use a quest to process a script every frame I add three quest stages 0 - 50 and 100. With the result script for 50 only being to set the fQuestDelayTime to .01 and then setstage at 100. I don't know why but everytime I try to set the questdelayvariable in the main quest script it doesn't work for me. (I'm probably doing something wrong but whatever). If setting that variable inside the main quest script works for you then I wouldn't even use stages at all.

 

As a math note why in the first line are you adding "(0.2 + 1.2..." The only reason to do that instead of simply sing 1.4 is if there's a parenthesis missing (i.e. "(0.2 + (1.2...")

 

And why on earth does it use log and exp!? I hate those functions. Haha! Nothing wrong that I can tell with your code just that log always drove me nuts in math. :P

Link to comment
Share on other sites

there will be 50 or more functions like this, one for each spell or kind of spell, and I don't want them all inside the main script, it'll just make it unreadable. And yes, set fQuestDelayTime to 0.01 at every iteration works for me as the main script runs fine. Also, if I change that result script for a simplest one with one single command, it's processed. The problem comes with that particular code and probably has something to do with that InitItem error the CS reports.

 

As a math note, multiplication takes priority over sum :D

Link to comment
Share on other sites

Oh yeah. I was looking at that wrong. Yay me for being dumb.

 

I would suggest then that you add a "Message "This worked"" to the bottom of the result script and the pull out one line at a time (even though it'll throw the calculation of and throw a 0 damage spell) until you see the message so you know which line offends.

 

For some reason I feel like it's the last one:

AddFullEffectItem FRDG grmCSQ.magnitude 5 1 2 grmCSFrostBallSpell

 

You might try defining a magnitude variable within the result script itself and setting it to the quest magnitude because for some reason I feel like trying to input the quest variable might be causing the problem.

 

but thats just based on theory's, wild guesses, and examining my fecal material so I wouldn't take it for much. But hey it's worth a shot.

 

Also, to streamline your script a bit it's not necessary to have this run seperately for each type of spell. Consider doing this:

 

 

 

Oh geeze. Now I'm making easy stuff complicated.

 

Note: I assume this script would be run the second you release the button after charging correct? Or do you have different math for charging different kinds of spells?

 

On that assumption here goes.

 

Set Spell to GetPlayerSpell

RemoveAllEffectItems grmCSFrostBallSpell
;Removes all current effects of your CSSpell,
;so that spell effects don't keep stacking up


CopyAllEffectItems grmCSFrostBallSpell Spell
;Copies every aspect of your currently selected spell to your CSSpell 

;The 0 in the following refers to the effect index.
;In a spell that only has one effect (i.e. fire damage) it's always 0.
;If you start implementing ways to have chargeable spells with multiple effects (i.e. fire and frost) then
;it would be 0 for the first effect (in this example fire), and 1 for the next effect (frost). And so on.

SetNthEffectItemMagnitude grmCSQ.magnitude grmCSFrostballSpell 0
SetNthEffectItemArea grmCSQ.area grmCSFrostballSpell 0

SetNthEffectItemDuration grmCSQ.duration grmCSFrostballSpell 0
; I don't know if your charged up spells will have any duration or always instant damage.
;If it's always instant Set the duration to 1
;(I think, though it might actually be a 0 duration I can't remember offhand)

SetNthEffectItemRange grmCSQ.range grmCSFrostballSpell 0
;by now you probably know, range is self or touch etc

 

You might not have used the exact variable names I guessed at, but just mod those accordingly.

Let me know if you have questions about that.

 

Also if you don't already I'd suggest bookmarking:

This

Link to comment
Share on other sites

Problem solved. I loaded again my mod with oblivion.esm on the CS, saved, exited, and loaded again. This time my mod was dependant on oblivion.esm and it worked.

 

I could verify that the problematic line was

AddFullEffectItem FRDG grmCSQ.magnitude 5 1 2 grmCSFrostBallSpell

wich prevented the entire result script from running. I guess the magic effects are part of the OB master file and therefor the CS coudn't find the FRDG when it wasn't loaded, so eventhough it didn't report an error and allowed me to save the result script, once in game it wasn't processed at all, even lines written before wasn't read.

 

So what this story tells is that we should load oblivion.esm always when creating a new mod :P at least I'll do it.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...