Bring 10 items to NPC (010) Quests

Post » Sun Nov 18, 2012 2:23 am

Hey there guys. I'm after some help with a quest I'm working on. The quest is to bring 10 Wolf pelts and 10 Bear pelts to an NPC. It works fine, easy peasy lol. What I'm trying to do now is have it display the amount you have/need in your quest journal.

I'm using FreeformRiften10 as a base quest to go by. Also just working out the Wolf pelt display for now, rather than both.

Now so far I have 2 globals sets up, HISQ3WolfPeltCount, and HISQ3WolfPeltTotal. They are added to the Text Display Globals in the quest itself. So the objective reads: "Collect 10 Wolf Pelts for the Guild (/)", and it displays as Collect 10 Wolf Pelts for the Guild "(0/10)" Yay that part works fine. What I'm having trouble with the the script for FreeformRiften10 and using it for my self. Because my objective is Get the pelts and take them to the Guild, I only have 1 ObjectiveDisplayed. What I'm struggling with is displaying the amount you have on your person.

Looking at FreeformRiften10 it has a script that reads like this (as well as a quest script)

Spoiler

Scriptname FFR10QuestScript extends Quest  ConditionalGlobalVariable Property pFF10SaltCount Auto ConditionalQuest Property pFFR10Quest Auto ConditionalIngredient Property pSalt Auto ConditionalFunction SaltCounted()float CurrentCount = Game.GetPlayer().GetItemCount(pSalt)pFF10SaltCount.Value = http://forums.bethsoft.com/topic/1401207-bring-10-items-to-npc-010-quests/CurrentCountUpdateCurrentInstanceGlobal(pFF10SaltCount)if CurrentCount>= 10pFFR10Quest.SetObjectiveCompleted(10,1)pFFR10Quest.SetObjectiveDisplayed(20,true,true)elseif CurrentCount < 10pFFR10Quest.SetObjectiveCompleted(10,0)pFFR10Quest.SetObjectiveDisplayed(20,0)pFFR10Quest.SetObjectiveDisplayed(10,true,true)endifendFunction

And mine reads:


Spoiler

Scriptname HISGQ3PeltScript extends Quest; script just to update count  MiscObject Property WolfPelt  Auto  Quest Property HISGuildQuest3Pelts  Auto  GlobalVariable Property HISQ3WolfPeltCount  Auto  Function PeltsCounted()float CurrentCount = Game.GetPlayer().GetItemCount(WolfPelt)HISQ3WolfPeltCount.Value = http://forums.bethsoft.com/topic/1401207-bring-10-items-to-npc-010-quests/CurrentCountUpdateCurrentInstanceGlobal(HISQ3WolfPeltCount)if CurrentCount>= 10			;elseif CurrentCount < 10			;endifendFunction

In stage 10 of my script I need what is in stage 10 of the other quest I think, (which is why it's not updating)... pFFR10QS.SaltCounted(). Now this seems to be calling a property in the quest script pointing at the addon script, but I don't know how to do that... there isn't a Script property that I can see. The source of the quest script shows FFR10QuestScript Property pFFR10QS Auto. But how can I make the script a property in another script like beth have? I've tried calling the function of kmyQuest but that doesn't work. I'm just guessing at stuff now.

Am I doing something really silly? Can anyone help? I just want the count to update when you have/drop the pelts lol. :smile:

EDIT

Solved, see below.
User avatar
Quick Draw III
 
Posts: 3372
Joined: Sat Oct 20, 2007 6:27 am

Post » Sat Nov 17, 2012 9:27 pm

Okay, not sure if I completely understand the details of what you are saying as I couldn't find pFFR10QS.SaltCounted() in the beth code you posted. But, that looks like a function call, not a property. So, if I'm understanding what you need, you just have to cast the script first to get access to that function.

In your description, you have this: FFR10QuestScript Property pFFR10QS Auto
so this function call seems perfectly valid: pFFR10QS.SaltCounted()
As pFFR10QS is of type FFR10QuestScript, and yep, when I open FFR10QuestScript.PSC, I see the SaltCounted function.

If you need to call a function on another quest script, just pass in the quest as a property of that type, then you can call it. Or, using the Beth example, you can cast in your code:
(pFFR10Quest as FFR10QuestScript).SaltCounted()
User avatar
Charlotte Lloyd-Jones
 
Posts: 3345
Joined: Fri Jun 30, 2006 4:53 pm

Post » Sun Nov 18, 2012 8:15 am

Thanks man.

I figured out how to add the second script to my quest script, and now in stage 10 of my quest it reads HISGQ3Script.PeltsCounted(). I just added a new property to my quest script, pasted HISGQ3PeltScript into the property type box, and called it HISGQ3Script. Then in the value of the property I set it to the quest name itself. If you look at FreeformRiften10 you'll see 2 scripts in the scripts box, and it appears that the Quest script calls the added script as a function some how.

It's really hard to describe what I'm doing, because this is the first time I've really messed with variables and things before. But I'm simply cloning the FreeformRiften10 quest (by that I mean make my own, not duplicate) and changing the values and info to my own.

I just can't get it to work. Which is weird, because it's almost exactly the same as the FFR10 quest. It just doesn't want to update the variable/journal display :shrug:

EDIT: I've created an objective 15, simply because I thought maybe that's what was causing it to not work; having just 1 objective.

Scripts are as follows:

Quest

Spoiler

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment;NEXT FRAGMENT INDEX 3Scriptname HIS_QF_HISGuildQuest3Pelts_01018FD8 Extends Quest Hidden;BEGIN ALIAS PROPERTY CrabMarker;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_CrabMarker Auto;END ALIAS PROPERTY;BEGIN FRAGMENT Fragment_0Function Fragment_0();BEGIN CODESetObjectiveDisplayed(11)HISGQ3Script.PeltsCounted();END CODEEndFunction;END FRAGMENT;BEGIN FRAGMENT Fragment_2Function Fragment_2();BEGIN CODESetObjectiveCompleted(10)Game.GetPlayer().AddItem(Gold001, 1200)Alias_CrabMarker.GetReference().Disable();END CODEEndFunction;END FRAGMENT;END FRAGMENT CODE - Do not edit anything between this and the begin commentMiscObject Property Gold001  AutoMiscObject Property WolfPelt  Auto  HISGQ3PeltScript Property HISGQ3Script  Auto  



Script added to script box

Spoiler

Scriptname HISGQ3PeltScript extends Quest ConditionalMiscObject Property WolfPelt  Auto ConditionalQuest Property HISGuildQuest3Pelts  Auto ConditionalGlobalVariable Property HISQ3WolfPeltCount  Auto ConditionalFunction PeltsCounted()float CurrentCount = Game.GetPlayer().GetItemCount(WolfPelt)HISQ3WolfPeltCount.Value = http://forums.bethsoft.com/topic/1401207-bring-10-items-to-npc-010-quests/CurrentCountUpdateCurrentInstanceGlobal(HISQ3WolfPeltCount)if CurrentCount>= 10HISGuildQuest3Pelts.SetObjectiveCompleted(10,1)HISGuildQuest3Pelts.SetObjectiveDisplayed(15,true,true)elseif CurrentCount < 10HISGuildQuest3Pelts.SetObjectiveCompleted(10,0)HISGuildQuest3Pelts.SetObjectiveDisplayed(15,0)HISGuildQuest3Pelts.SetObjectiveDisplayed(10,true,true)endifendFunction
User avatar
Loane
 
Posts: 3411
Joined: Wed Apr 04, 2007 6:35 am

Post » Sun Nov 18, 2012 4:58 am

I just can't get it to work. Which is weird, because it's almost exactly the same as the FFR10 quest. It just doesn't want to update the variable/journal display :shrug:
Okay, before I start dissecting your code, have you made sure to:
1) Add your global to the Quest "Text Display Globals"?
2) Call the UpdateCurrentInstanceGlobal function? (You probably did since it's in FFR10QuestScript.)
User avatar
RaeAnne
 
Posts: 3427
Joined: Sat Jun 24, 2006 6:40 pm

Post » Sun Nov 18, 2012 3:14 am

Okay, before I start dissecting your code, have you made sure to:
1) Add your global to the Quest "Text Display Globals"?
2) Call the UpdateCurrentInstanceGlobal function? (You probably did since it's in FFR10QuestScript.)

Yep they're added mate, like I said (0/10) dispays in the journal fine. And I think my function is written right (UpdateCurrentInstanceGlobal(HISQ3WolfPeltCount), here's the script:

Spoiler

Scriptname HISGQ3PeltScript extends Quest ConditionalMiscObject Property WolfPelt  Auto ConditionalQuest Property HISGuildQuest3Pelts  Auto ConditionalGlobalVariable Property HISQ3WolfPeltCount  Auto ConditionalFunction PeltsCounted()float CurrentCount = Game.GetPlayer().GetItemCount(WolfPelt)HISQ3WolfPeltCount.Value = http://forums.bethsoft.com/topic/1401207-bring-10-items-to-npc-010-quests/CurrentCountUpdateCurrentInstanceGlobal(HISQ3WolfPeltCount)if CurrentCount>= 10HISGuildQuest3Pelts.SetObjectiveCompleted(10,1)HISGuildQuest3Pelts.SetObjectiveDisplayed(15,true,true)elseif CurrentCount < 10HISGuildQuest3Pelts.SetObjectiveCompleted(10,0)HISGuildQuest3Pelts.SetObjectiveDisplayed(15,0)HISGuildQuest3Pelts.SetObjectiveDisplayed(10,true,true)endifendFunction
User avatar
christelle047
 
Posts: 3407
Joined: Mon Apr 09, 2007 12:50 pm

Post » Sun Nov 18, 2012 3:19 am

The next thing is to make sure your PeltsCounted function is working correctly... have you put a debug statement to show the count? such as:
float CurrentCount = Game.GetPlayer().GetItemCount(WolfPelt)Debug.Messagebox("PeltCount="+CurrentCount)  ;<=== Add thisHISQ3WolfPeltCount.Value = http://forums.bethsoft.com/topic/1401207-bring-10-items-to-npc-010-quests/CurrentCount

Edit: Removed the part where you already stated ;)
User avatar
Josh Lozier
 
Posts: 3490
Joined: Tue Nov 27, 2007 5:20 pm

Post » Sat Nov 17, 2012 5:30 pm

Okay, been rereading from the beginning...

What's actually calling the PeltsCounted() function?

Seems like you'd need to create a player alias for the quest with code for the OnContainerChanged Event... something that triggers when the player picks up something.
User avatar
Alisia Lisha
 
Posts: 3480
Joined: Tue Dec 05, 2006 8:52 pm

Post » Sun Nov 18, 2012 7:39 am

The next thing is to make sure your PeltsCounted function is working correctly... have you put a debug statement to show the count? such as:
float CurrentCount = Game.GetPlayer().GetItemCount(WolfPelt)Debug.Messagebox("PeltCount="+CurrentCount)  ;<=== Add thisHISQ3WolfPeltCount.Value = http://forums.bethsoft.com/topic/1401207-bring-10-items-to-npc-010-quests/CurrentCount

Edit: Removed the part where you already stated :wink:

Ok for testing I have the quest begin when the game loads, and when it does the messagebox show PeltCount = 0.000. But it doesn't update (in the journal or a new box popup) when I actually take some wolf pelts :ermm:
User avatar
GPMG
 
Posts: 3507
Joined: Sat Sep 15, 2007 10:55 am

Post » Sun Nov 18, 2012 4:07 am

Okay, been rereading from the beginning...

What's actually calling the PeltsCounted() function?

Seems like you'd need to create a player alias for the quest with code for the OnContainerChanged Event... something that triggers when the player picks up something.

From what I can tell, PeltsCounted() is just a made up function in the script. I've seen it before for Ace Skills where the modder has the perks added to the player on load. The quest stage calls that function, and the script has it as a function. And like I said I've just copied the quest........................

I've just realised, that the quest I'm using as a base has a player alias... with a script....

I knew I was missing something, how else does the game know to update the variable????!?!!!?!?!!

I will post results.
User avatar
Fanny Rouyé
 
Posts: 3316
Joined: Sun Mar 25, 2007 9:47 am

Post » Sun Nov 18, 2012 8:30 am

And now it works ;)

Player alias created, add the addon script as a property of a new script on the alias (seriously what is it called when you add a script to a quest, you refer to the quest script as just that, quest script, but what about scripts you add?) like I did with the quest script, then add the following script:

Scriptname HISQ3PlayerScript extends ReferenceAlias  ConditionalHISGQ3PeltScript Property HISGQ3Script  Auto ConditionalQuest Property HISGuildQuest3Pelts  Auto ConditionalMiscObject Property WolfPelt  Auto ConditionalEvent OnInit()AddInventoryEventFilter(WolfPelt)endEventEvent OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)if HISGuildQuest3Pelts.GetStageDone(10) == 1if akBaseItem == WolfPeltHISGQ3Script.PeltsCounted()endifendifendEventEvent OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)if HISGuildQuest3Pelts.GetStageDone(10) == 1if akBaseItem == WolfPeltHISGQ3Script.PeltsCounted()endifendifendEvent

Now it works!!!! :D

Will upload a quick video.
User avatar
Cedric Pearson
 
Posts: 3487
Joined: Fri Sep 28, 2007 9:39 pm

Post » Sun Nov 18, 2012 3:13 am

This is how I would do it...

I'd create a Player Alias for your quest, and add this code to that alias:

Scriptname  extends ReferenceAliasMiscObject Property WolfPelt  AutoEvent OnInit() AddInventoryEventFilter(WolfPelt)EndEventEvent OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) ;Since we know this is for the wolfpelt, call the update function (self as HISGQ3PeltScript).PeltsCounted()endEvent

You'll need to replace the with whatever you want to cal your player alias script for that quest.

Sorry, I don't have a quest set up like this to test atm, so I don't know if this line will actually work:

(self as HISGQ3PeltScript).PeltsCounted()

If it doesn't, you could try passing in the quest as a property, and changing that line of code to:
Quest Property  Auto ( as HISGQ3PeltScript).PeltsCounted()
I'm not sure of a way to to get access to the current quest.
User avatar
Khamaji Taylor
 
Posts: 3437
Joined: Sun Jul 29, 2007 6:15 am

Post » Sun Nov 18, 2012 4:41 am

And now it works :wink:

HISGQ3PeltScript Property HISGQ3Script  Auto Conditional...HISGQ3Script.PeltsCounted()

Great! and that answered my question too :smile:

I should have remembered, that is very OO.
User avatar
Ann Church
 
Posts: 3450
Joined: Sat Jul 29, 2006 7:41 pm

Post » Sat Nov 17, 2012 9:35 pm

Great! and that answered my question too :smile:

I should have remembered, that is very OO.

Thanks for your help mate. When you said about the player script it twigged it for me, went and had a look at FreeformRiften10 and boom, player alias with a script. Here's a video of it working :smile:

http://www.youtube.com/watch?v=hVjtWpJHH1M

(ignore the "messy" look of the quest journal, I'll be adding bear pelts to this list also)

EDIT:

Ah I've come a long way in the 2 months I've been learning this lol. Oh how easy I thought it was all going to be ;)
User avatar
Epul Kedah
 
Posts: 3545
Joined: Tue Oct 09, 2007 3:35 am

Post » Sat Nov 17, 2012 10:45 pm

http://www.youtube.com/watch?v=hVjtWpJHH1M
Just watched it, congrats!

Oh how easy I thought it was all going to be :wink:
Lol - those gotta be famous last words!

My last mod... I got an idea and figured it would take me a day to make a quick little mod. Just wanted to make a little mod that would allow the player to call their animal follower since the animal can't ride on the carriage....

Well, it did only take a day to create the Dog Whistle, and another 5 weeks to create the animals! :wink:
User avatar
Bigze Stacks
 
Posts: 3309
Joined: Sun May 20, 2007 5:07 pm

Post » Sun Nov 18, 2012 8:28 am

Just watched it, congrats!


Lol - those gotta be famous last words!

My last mod... I got an idea and figured it would take me a day to make a quick little mod. Just wanted to make a little mod that would allow the player to call their animal follower since the animal can't ride on the carriage....

Well, it did only take a day to create the Dog Whistle, and another 5 weeks to create the animals! :wink:

Lol I know! I didn't realise it could take a day to make a simple 3 stage quest. I told people when I launched HiS it'd have a guild and quests in a couple of weeks (when I work full time to) lol. CK noob = me.
User avatar
Chloe Lou
 
Posts: 3476
Joined: Sat Nov 04, 2006 2:08 am

Post » Sun Nov 18, 2012 7:15 am

Lol I know! I didn't realise it could take a day to make a simple 3 stage quest. I told people when I launched HiS it'd have a guild and quests in a couple of weeks (when I work full time to) lol. CK noob = me.

It's fun though, right? ;)
User avatar
Jeff Turner
 
Posts: 3458
Joined: Tue Sep 04, 2007 5:35 pm

Post » Sat Nov 17, 2012 8:58 pm

It's fun though, right? :wink:

So fun I can't remember the last time I actually played the game properly ;)
User avatar
Mark Churchman
 
Posts: 3363
Joined: Sun Aug 05, 2007 5:58 am


Return to V - Skyrim