Quest scripting woes, can't make my function work

Post » Sun Jun 24, 2012 9:20 am

I'm trying to make a quest for my new Khajiit NPC. The idea is that you bring him a single Moon Sugar and then you win. Easy peasy, right?

This is the script I am using:
Scriptname BCQScript1 extends Quest ConditionalIngredient Property pSugar Auto ConditionalGlobalVariable Property pBCQ01SugarCount Auto ConditionalQuest Property pBCQ01Quest Auto ConditionalFunction SugarCounted()int CurrentCount = Game.GetPlayer().GetItemCount(pSugar)pBCQ01SugarCount.Value = http://forums.bethsoft.com/topic/1348543-quest-scripting-woes-cant-make-my-function-work/CurrentCountUpdateCurrentInstanceGlobal(pBCQ01SugarCount)if CurrentCount>= 1  pBCQ01Quest.SetObjectiveCompleted(10,1)  pBCQ01Quest.SetObjectiveDisplayed(20,true,true)elseif CurrentCount < 1  pBCQ01Quest.SetObjectiveCompleted(10,0)  pBCQ01Quest.SetObjectiveDisplayed(20,0)  pBCQ01Quest.SetObjectiveDisplayed(10,true,true)endifendFunction


It saves and compiles fine, no warnings or errors.

Now, I got to quest stage 10 and try to add as a fragment, pBCQ01Quest.SugarCounted()

Result:
Starting 1 compile threads for 1 files...
Compiling "QF_BCQ01_01004F93"...
c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\QF_BCQ01_01004F93.psc(12,12): SugarCounted is not a function or does not exist
No output generated for QF_BCQ01_01004F93, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on QF_BCQ01_01004F93



I don't understand :confused:
User avatar
Darren
 
Posts: 3354
Joined: Wed Jun 06, 2007 2:33 pm

Post » Sun Jun 24, 2012 1:55 am

I want to know about this too. I am having so much un-fun with fragments. This is the second time I've had to delete local content and download again - this time it's because I was messing with fragments in both quests and perks.

I was getting the same compiler errors - even when I deleted the existing fragment to add a new one, the compiler insisted on attaching the old one and throwing errors. Getting any kind of information on how these fragments are supposed to work would be hugely helpful.
User avatar
Abi Emily
 
Posts: 3435
Joined: Wed Aug 09, 2006 7:59 am

Post » Sat Jun 23, 2012 9:06 pm

Maybe you have to make a property for your other script in the fragment, create a var to put the property, then call your fonction with the varname.SugarCounted() then ?
User avatar
Kat Lehmann
 
Posts: 3409
Joined: Tue Jun 27, 2006 6:24 am

Post » Sun Jun 24, 2012 7:15 am

Two ways to do it.

Add that script above to the quest. Then in the script fragment you are using delete everything out, hit the drop down above it and select your script that has the function and then compile that fragment. Check the advanced tab to make sure it has actually created a fragment, else you may have to put some dummy code in there and compile that first. Once it is compiled you should then be able to do:

kmyQuest.SugarCounted()

---------------------------------------

Either that or you add a property to the fragment of type QUEST and point it to another quest that has your script running on it. Then in the fragment you can do:

myScriptName blahblah = myQuestProperty as myScriptName
blahblah.sugarCounted()
User avatar
i grind hard
 
Posts: 3463
Joined: Sat Aug 18, 2007 2:58 am

Post » Sun Jun 24, 2012 10:46 am

Alright, well, after reinstalling the Creation Kit I seem to at least no longer get told that my function doesn't exist.

Instead, I get this:
Starting 1 compile threads for 1 files...
Compiling "QF_BCQ01_02004F93"...
c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\QF_BCQ01_02004F93.psc(16,0): variable pBCQ01Quest is undefined
c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\QF_BCQ01_02004F93.psc(16,12): none is not a known user-defined type
No output generated for QF_BCQ01_02004F93, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on QF_BCQ01_02004F93

Trying the thing with kmyQuest gives me the same error but saying kmyQuest instead of pBCQ01Quest

As for the latter option, there is no other quest using my script. Should I simply make a new dummy quest?




here is an image to sum up my problem
http://i.imgur.com/EcLOw.jpg
User avatar
Christine
 
Posts: 3442
Joined: Thu Dec 14, 2006 12:52 am

Post » Sun Jun 24, 2012 3:31 am

Good to see I'm not the only person having this problem.

I'm trying to start a scene, but it keeps telling me that the property I'm referring to is undefined, when I know that it IS defined.
User avatar
Nana Samboy
 
Posts: 3424
Joined: Thu Sep 14, 2006 4:29 pm

Post » Sun Jun 24, 2012 8:25 am

I want to know about this too. I am having so much un-fun with fragments. This is the second time I've had to delete local content and download again - this time it's because I was messing with fragments in both quests and perks.

I was getting the same compiler errors - even when I deleted the existing fragment to add a new one, the compiler insisted on attaching the old one and throwing errors. Getting any kind of information on how these fragments are supposed to work would be hugely helpful.

Try removing the fragment script. Then go to the fragment, Copy the text there (edit what you want first if you like) clear the field and click on Advanced. Then click 'Delete'. Once you've now completely cleared out the script and the fragment click Okay (for example if it's a Perk) to save your changes. Go back in to the Perk, back to the Fragment field and paste the text. Making sure whatever you changed is edited in the field. Click on Advanced, click 'Regenerate' then click okay. In the main Perk window you should now see a new script with no properties defined. Looks like a 'blue cross'. Right click on the script and Edit Source (or external whichever) and edit/check the properties from the script and not the properties window. After you compile double-click on the script and set values to your properties like normal.

Should maybe work. I do this and it works for me. When you follow these steps it assigns a new ID # to the script (Ex: if previous was QF_blahblah_000398 new one might be QFblahblah000399) that is automatically generated for Fragments and should then stop calling up the original/previously used.
User avatar
Tracey Duncan
 
Posts: 3299
Joined: Wed Apr 18, 2007 9:32 am


Return to V - Skyrim