Advice on making fetch quests more "radiant"

Post » Mon Nov 19, 2012 12:31 am

Afternoon guys, I'm wondering if you could offer some help for me. I'll explain my dilemma as best I can :smile:

In my hunting mod, I have a system for regular contract quests, that selects a dialogue response at random when the player selects Contracts in the job list my NPC offers. Video here - http://www.youtube.com/watch?v=2PPtyj2r884

Each response launches a quest, for example Collect 10 Wolf Pelts for Blacksmith A. Now I have it so they are tracked in your inventory, so your journal will read "Collect 10 Wolf Pelts for Blacksmith A (5/10)" as an example. I use two globals for each quest, a constant Total set to 10 (or 20, or 15, or whatever the quest requires), and another to be set to how many of the item you have on you.

I have a script in the quest that runs on the player as an alias, as follows (for collect 10 goat hides quest):


Spoiler

Scriptname HISJL1RWHidePlayerScript extends ReferenceAlias  ConditionalQuest Property HISJL1RWHide  Auto  ConditionalMiscObject Property GoatHide  Auto  ConditionalHISJL1RWHideScript Property HISJL1RWHideCountScript  Auto ConditionalEvent OnInit()AddInventoryEventFilter(GoatHide)endEventEvent OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)if HISJL1RWHide.GetStageDone(10) == 1if akBaseItem == GoatHideHISJL1RWHideCountScript.HidesCounted()endifendifendEventEvent OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)if HISJL1RWHide.GetStageDone(10) == 1if akBaseItem == GoatHideHISJL1RWHideCountScript.HidesCounted()endifendifendEvent


Here is the script I run, using this "HISJL1RWHideCountScript.HidesCounted()" in the stage fragment box:


Spoiler

Scriptname HISJL1RWHideScript extends Quest ConditionalQuest Property HISJL1RWHide  Auto ConditionalGlobalVariable Property HISJL1RWHideCount  Auto ConditionalGlobalVariable Property HISJL1RWHideTotal  Auto ConditionalMiscObject Property GoatHide  Auto ConditionalFunction HidesCounted()float CurrentCount = Game.GetPlayer().GetItemCount(GoatHide)HISJL1RWHideCount.Value = http://forums.bethsoft.com/topic/1407207-advice-on-making-fetch-quests-more-radiant/CurrentCountUpdateCurrentInstanceGlobal(HISJL1RWHideCount)if CurrentCount>= 10HISJL1RWHide.SetObjectiveCompleted(10,1)HISJL1RWHide.SetObjectiveDisplayed(15,true,true)elseif CurrentCount < 10HISJL1RWHide.SetObjectiveCompleted(10,0)HISJL1RWHide.SetObjectiveDisplayed(15,0)HISJL1RWHide.SetObjectiveDisplayed(10,true,true)endifendFunction

How it works is when the player has 10 of the item (or whatever I've set in the script) it sets the stage, and the NPC will remove that amount from the player's inventory, and reward the player accordingly depending on Guild rank. It multiplies the reward by how many items I've set. Here is my reward script in the start dialogue fragment:


Spoiler

if (Game.GetPlayer().GetFactionRank(HISFaction) <= 2)	   Game.GetPlayer().AddItem(Gold, 5*10)elseif  (Game.GetPlayer().GetFactionRank(HISFaction) == 3)			 Game.GetPlayer().AddItem(Gold, 8*10)elseif  (Game.GetPlayer().GetFactionRank(HISFaction) >= 4)			 Game.GetPlayer().AddItem(Gold, 10*10)endifGame.GetPlayer().RemoveItem(GoatHide, 10)


Now I've had a couple of people request that each time this quest pops up it is a random number of pelts that the NPC needs. Because the amount needed is coded into every script, I don't know how it could work. I could simply just have a handful of different versions of each quest and script. This way is time consuming though, and wondered if there was a better way to make these quests dynamic in that respect. If not I can simply have say 4 or 5 of the same quest, with different amounts required, and set them so they have a response timer only showing every now and then.

Is there a better way? I've hopefully supplied you guys with enough info... and possibly even scripts for people who want to achieve a similar thing :wink:
User avatar
Mel E
 
Posts: 3354
Joined: Mon Apr 09, 2007 11:23 pm

Post » Sun Nov 18, 2012 6:58 pm

I would think that when you start the quest, you could create http://www.creationkit.com/RandomInt_-_Utility (say, 3 and 10), stick that number in a global, and then replace your hard-coded "10" with that global in all the various places it appears.

There's actually a bit of cut vanilla content that does exactly this kind of thing, BTW, that I'm restoring in my Companions overhaul mod--Aela has a radiant pelt collection quest, which asks the player to collect a random number of a random type of pelt. So you could have a look at that quest in the CK. I think the quest name is CR03.
User avatar
Ronald
 
Posts: 3319
Joined: Sun Aug 05, 2007 12:16 am

Post » Mon Nov 19, 2012 3:59 am

I would think that when you start the quest, you could create http://www.creationkit.com/RandomInt_-_Utility (say, 3 and 10), stick that number in a global, and then replace your hard-coded "10" with that global in all the various places it appears.

There's actually a bit of cut vanilla content that does exactly this kind of thing, BTW, that I'm restoring in my Companions overhaul mod--Aela has a radiant pelt collection quest, which asks the player to collect a random number of a random type of pelt. So you could have a look at that quest in the CK. I think the quest name is CR03.

That seems too easy lol. I don't know how to do it yet but if it's just a case of putting a "use global1" in place of 10 then it makes sense.

I'll see how I can make that work mate and check our that quest. Thank you :)
User avatar
Trey Johnson
 
Posts: 3295
Joined: Thu Oct 11, 2007 7:00 pm

Post » Mon Nov 19, 2012 3:38 am

Ok I've had a chance to look through this. They do things (it seems) very different with this quest CR03. They don't appear to attach a script to the player and running OnItemAdded, instead opting for an Update. This has now thrown me for a loop lol.

I could maybe mix the two methods. I just need to figure out how I say in the script:

PeltsNeededGlobal = a random number

They use int and float and kmy in a way I'm not used to so it's like learning scripting again :ermm: lol
User avatar
John Moore
 
Posts: 3294
Joined: Sun Jun 10, 2007 8:18 am

Post » Sun Nov 18, 2012 5:33 pm



That seems too easy lol. I don't know how to do it yet but if it's just a case of putting a "use global1" in place of 10 then it makes sense.

I'll see how I can make that work mate and check our that quest. Thank you :)

This should work, no?
CurrentCount >= (myGlobal.GetValue() as int)

And for setting it, something like
myGlobal.SetValue(utility.RandomInt(3, 10))

EDIT:
Also you may need to use http://www.creationkit.com/UpdateCurrentInstanceGlobal_-_Quest before using the newly set global

- Hypno
User avatar
KiiSsez jdgaf Benzler
 
Posts: 3546
Joined: Fri Mar 16, 2007 7:10 am

Post » Sun Nov 18, 2012 12:16 pm

Ok I have it provisionally working (the start anyway). The random number becomes the total needed. But because of how the script worked originally, it now changes the total needed every time a pelt is added/removed from the inventory. I'm calling the SabrecatPeltsCounted() and need to add another function, that's why it's doing it. Script now says:


Spoiler

Scriptname HISJL1STPeltScript extends QuestQuest Property HISJL1STPelt  AutoInt Property MinSkins  Auto  Int Property MaxSkins  Auto  MiscObject Property SabreCatPelt  AutoGlobalVariable Property HISJL1STPeltCount  AutoGlobalVariable Property HISJL1STPeltTotal  Autoint TargetCount = -1Function SabrecatPeltsCounted()TargetCount = Utility.RandomInt(MinSkins, MaxSkins)HISJL1STPeltTotal.value = http://forums.bethsoft.com/topic/1407207-advice-on-making-fetch-quests-more-radiant/TargetCountfloat CurrentCount = Game.GetPlayer().GetItemCount(SabreCatPelt)HISJL1STPeltCount.Value = CurrentCountUpdateCurrentInstanceGlobal(HISJL1STPeltCount)UpdateCurrentInstanceGlobal(HISJL1STPeltTotal)if CurrentCount>= TargetCountHISJL1STPelt.SetObjectiveCompleted(10,1)HISJL1STPelt.SetObjectiveDisplayed(15,true,true)elseif CurrentCount < TargetCount         HISJL1STPelt.SetObjectiveCompleted(10,0)HISJL1STPelt.SetObjectiveDisplayed(15,0)HISJL1STPelt.SetObjectiveDisplayed(10,true,true) endifendFunction

And when a pelt is added/removed, the player alias script reads:


Spoiler

Scriptname HISJL1STPeltPlayerScipt extends ReferenceAlias  ConditionalHISJL1STPeltScript Property HISJL1STPeltScriptCount  Auto  ConditionalQuest Property HISJL1STPelt  Auto  ConditionalMiscObject Property SabreCatPelt  Auto  ConditionalEvent OnInit()AddInventoryEventFilter(SabreCatPelt)endEventEvent OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)if HISJL1STPelt.GetStageDone(10) == 1if akBaseItem == SabreCatPeltHISJL1STPeltScriptCount.SabrecatPeltsCounted()endifendifendEventEvent OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)if HISJL1STPelt.GetStageDone(10) == 1if akBaseItem == SabreCatPeltHISJL1STPeltScriptCount.SabrecatPeltsCounted()endifendifendEvent

So it works to randomise the needed pelts, but as you can see I'm calling the old function. Any advice on how to clean this up? :)
User avatar
Camden Unglesbee
 
Posts: 3467
Joined: Wed Aug 15, 2007 8:30 am

Post » Sun Nov 18, 2012 9:04 pm

Guys if I was allowed to swear on here I really really would... I've done it. :biggrin:

I kind of understand custom Functions now yippee!!! Will upload a video.

The the npc takes the right amount of pelts, gives the right amount of gold, the game counts the pelts properly and the amount you need is random every time :) !!!!! So made up.

Could even go as far as making the item itself dynamic thanks to DreamKing pointing out that quest :)

Thanks for all your help guys. Will post a video and final post with all my scripts to share :)
User avatar
Cassie Boyle
 
Posts: 3468
Joined: Sun Nov 05, 2006 9:33 am

Post » Sun Nov 18, 2012 12:54 pm

Hey guys here is the video link :smile: http://www.youtube.com/watch?v=N1bbhwDtoqM

(ignore the prolonged response after he gets the pelts, audio isn't finished)

2 globals are both set to Short, and 0. The scripts then set these values. Here are my scripts (obviously properties are all set up)

I have a script attached to the quest itself, which I call in certain places.


First, Stage 9 (the first stage):

HISJL1STPeltScriptCount.Startup()


Stage 10 is:

HISJL1STPeltScriptCount.SabrecatPeltsCounted()
HISJL1Active.SetStage(10)


(The Active quest is the quest I run during all contract quests, so I can set a condition to only allow 1 quest at a time to run)


The actual script running HISJL1STPeltScriptCount is:
Spoiler

Scriptname HISJL1STPeltScript extends QuestQuest Property HISJL1STPelt  AutoInt Property MinSkins  Auto  Int Property MaxSkins  Auto  MiscObject Property SabreCatPelt  AutoGlobalVariable Property HISJL1STPeltCount  AutoGlobalVariable Property HISJL1STPeltTotal  Autoint TargetCount = -1Function Startup()TargetCount = Utility.RandomInt(MinSkins, MaxSkins)HISJL1STPeltTotal.value = TargetCountfloat CurrentCount = Game.GetPlayer().GetItemCount(SabreCatPelt)HISJL1STPeltCount.Value = CurrentCount	   SetStage(10)endFunctionFunction SabrecatPeltsCounted()HISJL1STPeltTotal.value = http://forums.bethsoft.com/topic/1407207-advice-on-making-fetch-quests-more-radiant/TargetCountfloat CurrentCount = Game.GetPlayer().GetItemCount(SabreCatPelt)HISJL1STPeltCount.Value = CurrentCountUpdateCurrentInstanceGlobal(HISJL1STPeltCount)UpdateCurrentInstanceGlobal(HISJL1STPeltTotal)if CurrentCount>= TargetCountHISJL1STPelt.SetObjectiveCompleted(10,1)HISJL1STPelt.SetObjectiveDisplayed(15,true,true)elseif CurrentCount < TargetCount		 HISJL1STPelt.SetObjectiveCompleted(10,0)HISJL1STPelt.SetObjectiveDisplayed(15,0)HISJL1STPelt.SetObjectiveDisplayed(10,true,true)endifendFunction


The count is achieved by tracking the playerAddItem event. A script attached to the player as an alias is as follows:
Spoiler

Scriptname HISJL1STPeltPlayerScipt extends ReferenceAlias  ConditionalHISJL1STPeltScript Property HISJL1STPeltScriptCount  Auto  ConditionalQuest Property HISJL1STPelt  Auto  ConditionalMiscObject Property SabreCatPelt  Auto  ConditionalEvent OnInit()AddInventoryEventFilter(SabreCatPelt)endEventEvent OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)if HISJL1STPelt.GetStageDone(10) == 1if akBaseItem == SabreCatPeltHISJL1STPeltScriptCount.SabrecatPeltsCounted()endifendifendEventEvent OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)if HISJL1STPelt.GetStageDone(10) == 1if akBaseItem == SabreCatPeltHISJL1STPeltScriptCount.SabrecatPeltsCounted()endifendifendEvent


And the adding gold/removing the item scripts are in the dialogue fragments, here:
Spoiler

Start Fragmentgetowningquest().setstage(20)Game.GetPlayer().RemoveItem(SabrecatPelt, (HISJL1STPeltTotal.GetValueInt()))End Fragmentif (Game.GetPlayer().GetFactionRank(HISFaction) <= 2)	   Game.GetPlayer().AddItem(Gold, 25*(HISJL1STPeltTotal.GetValueInt()))elseif  (Game.GetPlayer().GetFactionRank(HISFaction) == 3)			 Game.GetPlayer().AddItem(Gold, 37*(HISJL1STPeltTotal.GetValueInt()))elseif  (Game.GetPlayer().GetFactionRank(HISFaction) >= 4)			 Game.GetPlayer().AddItem(Gold, 50*(HISJL1STPeltTotal.GetValueInt()))endif


I understand now though that I can just put all of those dialogue fragment into the main script like with the counts, and just call the individual functions. Like Startup(), RemovePelts() etc.

Really starting to get to grips with scripting and things like that :smile: Hopefully this post will pop up in a search for someone in the future.
User avatar
Cameron Garrod
 
Posts: 3427
Joined: Sat Jun 30, 2007 7:46 am

Post » Sun Nov 18, 2012 8:47 pm

Looking forward to seeing the final scripts. I bet the likes of Random Noob and JustinOther can optimise them.

Uncle Bob says 'Clean the Code' and Tesco says 'every little helps', I appreciate most of you guys making the great mods are migrating from another scripting language?

*Quick Edit* - Damn you type fast or I type slow ;O)

Thanks for replying BEFORE I even finished typing and posting ;o)
User avatar
Floor Punch
 
Posts: 3568
Joined: Tue May 29, 2007 7:18 am

Post » Mon Nov 19, 2012 3:00 am

Looking forward to seeing the final scripts. I bet the likes of Random Noob and JustinOther can optimise them.

Uncle Bob says 'Clean the Code' and Tesco says 'every little helps', I appreciate most of you guys making the great mods are migrating from another scripting language?

*Quick Edit* - Damn you type fast or I type slow ;O)

Thanks for replying BEFORE I even finished typing and posting ;o)

No problem :wink:

It's really hard to describe how to set a quest like this up to a noob who may read this topic, because I'm a noob myself basically lol. But if you look at FreeformIvarstead03, and CR03 quests and see how they place the scripts and stuff, really study it, it all makes sense. But like I said, I'm still learning, so what might seem like I should have created Facebook type of genius!!!! may be as simple as sending an email is to an actual programmer. :smile:

EDIT

Oh and yes of course if someone like Justin has a way to optimise my script I'm open for it :)
User avatar
Nicole Mark
 
Posts: 3384
Joined: Wed Apr 25, 2007 7:33 pm

Post » Mon Nov 19, 2012 3:26 am

We are all Noobs,

Even us programmers (during the day) mostly deal with different languages than Papyrus. I certainly meant no disrespect with my previous comment, It had no connection to your scripts, or your mod, or even your post to be fair.

I only mentioned optimisation because of my 'free time' research into Papyrus, I still do not understand it fully.

I do hope both RandoomNoob and JustinOther pop in because they have been really helpful for me in the past, just following their posts to others on here, as have you and the likes off all the other regulars.

Hopefully, your video has now finished the stage of 'You Tube processing' and is now available to view, It was still processing when I started this post but pretty sure it will be finished now ;O)
User avatar
Melis Hristina
 
Posts: 3509
Joined: Sat Jun 17, 2006 10:36 pm

Post » Sun Nov 18, 2012 11:44 pm

Didn't take any offence mate :) just justifying my obvious excitement over my quest script lol.
User avatar
Lauren Graves
 
Posts: 3343
Joined: Fri Aug 04, 2006 6:03 pm

Post » Sun Nov 18, 2012 10:42 pm

Ok so I have it working where the script now picks 1 of 3 (for now) pelts for the player to collect. They also show in the journal, they are sent to the Pelt Alias when the script chooses the pelt.

Where I'm having trouble with now is the game knowing what pelt I pick up and drop. The old method is the Player Alias script above that counts the items. But now I need that alias script to know what pelt to count. Here is my script now that decides what pelt to choose:

Spoiler

Function Startup()TargetCount = Utility.RandomInt(MinSkins, MaxSkins)HISJL1STPeltTotal.value = http://forums.bethsoft.com/topic/1407207-advice-on-making-fetch-quests-more-radiant/TargetCountfloat CurrentCount = Game.GetPlayer().GetItemCount(SamplePelt.GetReference())HISJL1STPeltCount.Value = CurrentCountTargetSkinsIndex = Utility.RandomInt(1, 3)if	 (TargetSkinsIndex == 1)TargetSkins = SabreCatPeltelseif (TargetSkinsIndex == 2)TargetSkins = BearSnow ;BearSnowelseif (TargetSkinsIndex == 3)TargetSkins = BearCave ;BearCaveelseTargetSkinsIndex = 1TargetSkins = BearCave ;BearCaveendifif (TargetCount <= 0)TargetCount = 15endif	   HISJL1STPeltActual.SetValue(TargetSkinsIndex)ObjectReference pelt = SamplePeltSpawnPoint.GetReference().PlaceAtMe(TargetSkins)SamplePelt.ForceRefTo(pelt)	   SetStage(10)endFunction

What I thought of doing as you can see is using the number TargetSkinsIndex as a global variable, and then in the player alias script pointing that global to a pelt to count. But the only way I can think of is using lots of ifs and elseifs just to:

Spoiler

Scriptname HISJL1STPeltPlayerScipt extends ReferenceAlias  ConditionalHISJL1STPeltScript Property HISJL1STPeltScriptCount  Auto  ConditionalQuest Property HISJL1STPelt  Auto  ConditionalMiscObject Property SabreCatPelt  Auto  ConditionalReferenceAlias Property SamplePelt  Auto  MiscObject TargetSkins = NoneEvent OnInit()AddInventoryEventFilter(TargetSkins)endEventEvent OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)if HISJL1STPelt.GetStageDone(10) == 1if akBaseItem == TargetSkinsHISJL1STPeltScriptCount.PeltsCounted()endifendifendEventEvent OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)if HISJL1STPelt.GetStageDone(10) == 1if akBaseItem == TargetSkinsHISJL1STPeltScriptCount.PeltsCounted()endifendifendEvent

I've put TargetSkins into the Baseitem part of the script for now. Is there a clean way to do what I want? Or do I need basically

if global = this number
this number = pelt 1
elseif global = this other number
this other number = pelt 2

etc etc.

Appreciate the help guys :smile: Really need it to make this quest even better.

EDIT

As you can see these scripts are a little messy at the moment because I'm trying to work out the best method to do what I want.
User avatar
Niisha
 
Posts: 3393
Joined: Fri Sep 15, 2006 2:54 am

Post » Sun Nov 18, 2012 5:21 pm

On the verge of giving up on this now. I'm managing to get some of they way but not all. It either counts them but doesn't change the globals, or doesn't count them atall, or only counts them if you have them on you when the quest starts....

It's getting beyond a joke I can't even recognise my script now.
User avatar
Kari Depp
 
Posts: 3427
Joined: Wed Aug 23, 2006 3:19 pm

Post » Mon Nov 19, 2012 2:22 am

Maybe it'll just be easier to have the quest just randomise the number of pelts needed, like I had working. Then just make another couple of quests for the same person but for different items. :shrug:
User avatar
krystal sowten
 
Posts: 3367
Joined: Fri Mar 09, 2007 6:25 pm

Post » Sun Nov 18, 2012 11:01 pm

Here are my scripts as they stand now. Really need some help with this. I think it's to do with my OnInit event on the player alias. The script I run on the quest chooses a random item which works great, it just isn't tracked with OnItemAdded. It does work if you already have the pelts on you when the quest starts though.

Hopefully I can get this sorted, surely there's a way to do it I'm so close lol.

Quest starts with Stage 9. Stage 9 calls - HISJL1STPeltScriptCount.Startup(). Stage 10 calls - HISJL1STPeltScriptCount.PeltsCounted().

PlayerAlias script
Spoiler

Scriptname HISJL1STPeltPlayerScipt extends ReferenceAlias  ConditionalHISJL1STPeltScript Property HISJL1STPeltScriptCount  AutoQuest Property HISJL1STPelt  Auto  ConditionalReferenceAlias Property SamplePelt  Auto  MiscObject Property SabreCatPelt  AutoMiscObject Property BearCave  Auto  MiscObject Property BearSnow  Auto  GlobalVariable Property HISJL1STPeltActual  Auto  GlobalVariable Property HISJL1STPeltCount  Auto  GlobalVariable Property HISJL1STPeltTotal  Auto  MiscObject TargetSkins = NoneEvent OnInit()HISJL1STPeltScriptCount.Update()AddInventoryEventFilter(TargetSkins)endEventEvent OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)if  (HISJL1STPeltActual.GetValueInt() == 1) && (HISJL1STPelt.GetStageDone(10) == 1) && (akBaseItem == SabreCatPelt)HISJL1STPeltScriptCount.PeltsCounted()                        Debug.Messagebox("Sabrecat pelt added!")elseif (HISJL1STPeltActual.GetValueInt() == 2) && (HISJL1STPelt.GetStageDone(10) == 1) && (akBaseItem == BearSnow)HISJL1STPeltScriptCount.PeltsCounted()                        Debug.Messagebox("Snow Bear pelt added!")elseif (HISJL1STPeltActual.GetValueInt() == 3) && (HISJL1STPelt.GetStageDone(10) == 1) && (akBaseItem == BearCave)HISJL1STPeltScriptCount.PeltsCounted()                        Debug.Messagebox("Cave Bear pelt added!")   else;endifendEventEvent OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)if  (HISJL1STPeltActual.GetValueInt() == 1) && (HISJL1STPelt.GetStageDone(10) == 1) && (akBaseItem == SabreCatPelt)HISJL1STPeltScriptCount.PeltsCounted()                        Debug.Messagebox("Sabrecat pelt removed!")elseif (HISJL1STPeltActual.GetValueInt() == 2) && (HISJL1STPelt.GetStageDone(10) == 1) && (akBaseItem == BearSnow)HISJL1STPeltScriptCount.PeltsCounted()                        Debug.Messagebox("Snow Bear pelt removed!")elseif (HISJL1STPeltActual.GetValueInt() == 3) && (HISJL1STPelt.GetStageDone(10) == 1) && (akBaseItem == BearCave)HISJL1STPeltScriptCount.PeltsCounted()                        Debug.Messagebox("Cave Bear pelt removed!")   else;endifendEvent


Script that doe's the work (HISJL1STPeltScriptCount.)

Spoiler

Scriptname HISJL1STPeltScript extends Quest  conditionalQuest Property HISJL1STPelt  AutoReferenceAlias Property SamplePelt  Auto  ReferenceAlias Property SamplePeltSpawnPoint  Auto  Int Property MinSkins  Auto  Int Property MaxSkins  Auto  MiscObject Property SabreCatPelt  AutoMiscObject Property BearSnow  Auto  MiscObject Property BearCave  AutoMiscObject TargetSkins = None  Int Property TargetSkinsIndex Auto  ConditionalGlobalVariable Property HISJL1STPeltCount  AutoGlobalVariable Property HISJL1STPeltTotal  AutoGlobalVariable Property HISJL1STPeltActual  Auto int TargetCount = -1Function Startup()TargetCount = Utility.RandomInt(MinSkins, MaxSkins)HISJL1STPeltTotal.value = http://forums.bethsoft.com/topic/1407207-advice-on-making-fetch-quests-more-radiant/TargetCountfloat CurrentCount = Game.GetPlayer().GetItemCount(TargetSkins)HISJL1STPeltCount.Value = CurrentCountUpdateCurrentInstanceGlobal(HISJL1STPeltCount)UpdateCurrentInstanceGlobal(HISJL1STPeltTotal)TargetSkinsIndex = Utility.RandomInt(1, 3)if     (TargetSkinsIndex == 1)TargetSkins = SabreCatPeltelseif (TargetSkinsIndex == 2)TargetSkins = BearSnow ;BearSnowelseif (TargetSkinsIndex == 3)TargetSkins = BearCave ;BearCaveelseTargetSkinsIndex = 1TargetSkins = SabreCatPelt ;SabreCatPeltendifif (TargetCount <= 0)TargetCount = 15endif       HISJL1STPeltActual.SetValue(TargetSkinsIndex)ObjectReference pelt = SamplePeltSpawnPoint.GetReference().PlaceAtMe(TargetSkins)SamplePelt.ForceRefTo(pelt)       SetStage(10)       Debug.MessageBox(HISJL1STPeltActual.GetValueInt())endFunctionFunction Cleanup()       ObjectReference pelt = SamplePelt.GetReference()SamplePelt.Clear()pelt.Disable()pelt.Delete()EndFunctionFunction PeltsCounted()UpdateCurrentInstanceGlobal(HISJL1STPeltCount)UpdateCurrentInstanceGlobal(HISJL1STPeltTotal)UpdateCurrentInstanceGlobal(HISJL1STPeltActual)if     (TargetSkinsIndex == 1)TargetSkins = SabreCatPeltelseif (TargetSkinsIndex == 2)TargetSkins = BearSnow ;BearSnowelseif (TargetSkinsIndex == 3)TargetSkins = BearCave ;BearCaveelseTargetSkinsIndex = 1TargetSkins = BearCave ;BearCaveendifHISJL1STPeltTotal.value = TargetCountfloat CurrentCount = Game.GetPlayer().GetItemCount(TargetSkins)HISJL1STPeltCount.Value = CurrentCountif CurrentCount>= TargetCountHISJL1STPelt.SetObjectiveCompleted(10,1)HISJL1STPelt.SetObjectiveDisplayed(15,true,true)elseif CurrentCount < TargetCount         HISJL1STPelt.SetObjectiveCompleted(10,0)HISJL1STPelt.SetObjectiveDisplayed(15,0)HISJL1STPelt.SetObjectiveDisplayed(10,true,true) endifendFunctionFunction Update()UpdateCurrentInstanceGlobal(HISJL1STPeltCount)UpdateCurrentInstanceGlobal(HISJL1STPeltTotal)UpdateCurrentInstanceGlobal(HISJL1STPeltActual)endFunction

Thanks guys as always for you help. I'm sure this can be sorted, I'm just doing something wrong and it's probably really obvious to more experienced people :)
User avatar
Helen Quill
 
Posts: 3334
Joined: Fri Oct 13, 2006 1:12 pm

Post » Sun Nov 18, 2012 11:54 am

I'm not 100% if this will fix your problem but the only thing that stands out to me is that in the player alias script you've got

AddInventoryEventFilter(TargetSkins)

but

MiscObject TargetSkins = None

I know you have a property in the other script with the same same, but as far as I understand it isn't actually the same property, so it never gets set to anything other then none.

I suggest making a formlist containing all the types of pelt you plan on using, then filtering for that instead. Then the rest looks ok in my head (I'm not at home right now so cannot test myself)

- Hypno
User avatar
Svenja Hedrich
 
Posts: 3496
Joined: Mon Apr 23, 2007 3:18 pm

Post » Sun Nov 18, 2012 11:50 pm

Thanks mate I see what you're saying. I tried to show the player alias script what target skins is by using if and the global variable value etc. obviously I'm not doing it right though lol.

I just need to say if the targetskins is "this" then filter the inventory for it.
User avatar
Andrea Pratt
 
Posts: 3396
Joined: Mon Jul 31, 2006 4:49 am

Post » Sun Nov 18, 2012 6:07 pm

If you just change TargetSkins from a miscobject into a formlist property then there should be minimal editing of your script needed. Once you point this property to a formlist that contains all the different skins you are planning on using then your script will be alert to any of the items in tge list. Then "if"'s you've already got in the onitemadded()/onitemremoved() blocks will do their jobs again in working out if it's the current objective item.

Let me know if this works. I would test it out myself but I'm sitting by a lake, fishing and soaking up the sun (gotta take advantage when you can considering how rare it is having sun in the summer over here :P)

EDIT: Just to clarify, I'm referring to editing the alias script. The function script should be fine as it is. If it makes it clearer, call it "TargetSkinsList" in the alias script

- Hypno
User avatar
Dale Johnson
 
Posts: 3352
Joined: Fri Aug 10, 2007 5:24 am

Post » Sun Nov 18, 2012 11:34 am

Thanks mate I'll try that. See how I've set out all the skins in the main script, which it then picks one from, I thought I could use a similar one in the alias but instead of choosing from the list, using whatever one the list has set the global to.

I'll let you know how it goes. Spent 3 hours trying to sort it last night, would be a waste if I just drop it lol.
User avatar
Francesca
 
Posts: 3485
Joined: Thu Jun 22, 2006 5:26 pm

Post » Sun Nov 18, 2012 12:01 pm

Well seeing how you said that it actually works sometimes then you are definitely doing the main bit right.

The way I see it, the only thing off with your code at the moment is just that filter line. If you just change the addinventoryeventfilter() to point to the new formlist, then it should work with the rest of your code out of the box...in theory, in my head at least (just clarifying my thoughts for the sake of future readers of this thread)

- Hypno
User avatar
Alyce Argabright
 
Posts: 3403
Joined: Mon Aug 20, 2007 8:11 pm

Post » Sun Nov 18, 2012 2:49 pm

Just letting you guys know I sorted it :)

In the end I had to split a lot of things up. It just wouldn't work having more than one if condition in the OnInit event on the player, and the conditions on the counts and scripts (I couldn't get them to work anyway). Tracking items added that is. The random pelt and quantity was working fine..

I had to split the player alias into 3 different ones, create a stage for each pelt, and create a function inside the main script for each stage/pelt combo. It still works to randomly select pelt and quantity, just needed to be split up and organised in the back end. I'll post my scripts later :)
User avatar
Paul Rice
 
Posts: 3430
Joined: Thu Jun 14, 2007 11:51 am

Post » Sun Nov 18, 2012 6:59 pm

So now this particular quest chooses 1 pelt (out of 5 available) and a quantity required (from 5 to 15) at random, and works as it should. Not all of my contract quests will be this way, there are some that are the same pelt (some smiths may prefer 1 type), others only take the best pelts... you get the jist I'm sure :smile: Anyway, here are my scripts.

Each pelt check has it's own corresponding player alias, so there are 5 player alias scripts. And there is 1 main script to do all the counting etc. Here you go :smile:

Alias 1
Spoiler

Scriptname HISJL1STPeltPlayerScipt extends ReferenceAlias  ConditionalHISJL1STPeltScript Property HISJL1STPeltScriptCount  AutoQuest Property HISJL1STPelt  AutoMiscObject Property SabreCatPelt  AutoGlobalVariable Property HISJL1STPeltActual  Auto  GlobalVariable Property HISJL1STPeltCount  Auto  GlobalVariable Property HISJL1STPeltTotal  Auto  Event OnInit()float skin = HISJL1STPeltActual.Getvalueint()if  skin == 1AddInventoryEventFilter(SabreCatPelt)   endifendEventEvent OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)	   if HISJL1STPelt.GetStageDone(11) == 1	   if akBaseItem == SabreCatPelt  HISJL1STPeltScriptCount.SabrePeltsCounted()	   Debug.Messagebox("SabreCat pelt added!")	   endif	   endifendEventEvent OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)	   if HISJL1STPelt.GetStageDone(11) == 1	   if akBaseItem == SabreCatPelt  HISJL1STPeltScriptCount.SabrePeltsCounted()	   Debug.Messagebox("SabreCat pelt removed!")	   endif	   endifendEvent


Alias 2

Spoiler

Scriptname HISJL1STPeltPlayerScipt1 extends ReferenceAlias	ConditionalMiscObject Property BearSnowPelt  Auto  HISJL1STPeltScript Property HISJL1STPeltScriptCount  Auto  Quest Property HISJL1STPelt  Auto  GlobalVariable Property HISJL1STPeltActual  Auto  GlobalVariable Property HISJL1STPeltTotal  Auto  GlobalVariable Property HISJL1STPeltCount  Auto  Event OnInit()float skin = HISJL1STPeltActual.Getvalueint()if  skin == 2AddInventoryEventFilter(BearSnowPelt)   endifendEventEvent OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)	   if HISJL1STPelt.GetStageDone(12) == 1	   if akBaseItem == BearSnowPelt  HISJL1STPeltScriptCount.BearSnowPeltsCounted()	   Debug.Messagebox("Snow Bear pelt added!")	   endif	   endifendEventEvent OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)	   if HISJL1STPelt.GetStageDone(12) == 1	   if akBaseItem == BearSnowPelt  HISJL1STPeltScriptCount.BearSnowPeltsCounted()	   Debug.Messagebox("Snow Bear pelt removed!")	   endif	   endifendEvent

You get the idea with that.


My main script is as follows. As you can see Stage 10 gets set after Startup(), which then sets the stage for each pelt when chosen, which is how I can condition each player alias script separately.


Spoiler

Scriptname HISJL1STPeltScript extends Quest  conditionalQuest Property HISJL1STPelt  AutoReferenceAlias Property SamplePelt  Auto  ReferenceAlias Property SamplePeltSpawnPoint  Auto  Int Property MinSkins  Auto  Int Property MaxSkins  Auto  MiscObject Property SabreCatPelt  AutoMiscObject Property BearSnow  Auto  MiscObject Property BearCave  AutoMiscObject Property Bear  Auto  MiscObject Property SabrecatSnow  Auto  MiscObject TargetSkins = None  Int Property TargetSkinsIndex Auto  ConditionalGlobalVariable Property HISJL1STPeltCount  AutoGlobalVariable Property HISJL1STPeltTotal  AutoGlobalVariable Property HISJL1STPeltActual  Autoint TargetCount = -1Function Startup()TargetCount = Utility.RandomInt(MinSkins, MaxSkins)HISJL1STPeltTotal.value = http://forums.bethsoft.com/topic/1407207-advice-on-making-fetch-quests-more-radiant/TargetCountfloat CurrentCount = Game.GetPlayer().GetItemCount(TargetSkins)HISJL1STPeltCount.Value = CurrentCountUpdateCurrentInstanceGlobal(HISJL1STPeltCount)UpdateCurrentInstanceGlobal(HISJL1STPeltTotal)TargetSkinsIndex = Utility.RandomInt(1, 5)if	 (TargetSkinsIndex == 1)TargetSkins = SabreCatPeltelseif (TargetSkinsIndex == 2)TargetSkins = BearSnow ;BearSnowelseif (TargetSkinsIndex == 3)TargetSkins = BearCave ;BearCaveelseif (TargetSkinsIndex == 4)TargetSkins = Bear ;Bearelseif (TargetSkinsIndex == 5)TargetSkins = SabrecatSnow ;SabrecatSnowelseTargetSkinsIndex = 1TargetSkins = SabreCatPelt ;SabreCatPeltendifif (TargetCount <= 0)TargetCount = 15endif	   HISJL1STPeltActual.SetValue(TargetSkinsIndex)ObjectReference pelt = SamplePeltSpawnPoint.GetReference().PlaceAtMe(TargetSkins)SamplePelt.ForceRefTo(pelt)	  SetStage(10)endFunctionFunction Cleanup()	   ObjectReference pelt = SamplePelt.GetReference()SamplePelt.Clear()pelt.Disable()pelt.Delete()EndFunctionFunction SabrePeltsCounted()	   HISJL1STPeltTotal.value = TargetCount	   float CurrentCount = Game.GetPlayer().GetItemCount(SabreCatPelt)	   HISJL1STPeltCount.Value = CurrentCountUpdateCurrentInstanceGlobal(HISJL1STPeltCount)UpdateCurrentInstanceGlobal(HISJL1STPeltTotal)if CurrentCount>= TargetCountHISJL1STPelt.SetObjectiveCompleted(10,1)HISJL1STPelt.SetObjectiveDisplayed(15,true,true)elseif CurrentCount < TargetCount		 HISJL1STPelt.SetObjectiveCompleted(10,0)HISJL1STPelt.SetObjectiveDisplayed(15,0)HISJL1STPelt.SetObjectiveDisplayed(10,true,true)endifendFunctionFunction BearSnowPeltsCounted()	   HISJL1STPeltTotal.value = http://forums.bethsoft.com/topic/1407207-advice-on-making-fetch-quests-more-radiant/TargetCount	   float CurrentCount = Game.GetPlayer().GetItemCount(BearSnow)	   HISJL1STPeltCount.Value = CurrentCountUpdateCurrentInstanceGlobal(HISJL1STPeltCount)UpdateCurrentInstanceGlobal(HISJL1STPeltTotal)if CurrentCount>= TargetCountHISJL1STPelt.SetObjectiveCompleted(10,1)HISJL1STPelt.SetObjectiveDisplayed(15,true,true)elseif CurrentCount < TargetCount		 HISJL1STPelt.SetObjectiveCompleted(10,0)HISJL1STPelt.SetObjectiveDisplayed(15,0)HISJL1STPelt.SetObjectiveDisplayed(10,true,true)endifendFunctionFunction BearCavePeltsCounted()	   HISJL1STPeltTotal.value = http://forums.bethsoft.com/topic/1407207-advice-on-making-fetch-quests-more-radiant/TargetCount	   float CurrentCount = Game.GetPlayer().GetItemCount(BearCave)	   HISJL1STPeltCount.Value = CurrentCountUpdateCurrentInstanceGlobal(HISJL1STPeltCount)UpdateCurrentInstanceGlobal(HISJL1STPeltTotal)if CurrentCount>= TargetCountHISJL1STPelt.SetObjectiveCompleted(10,1)HISJL1STPelt.SetObjectiveDisplayed(15,true,true)elseif CurrentCount < TargetCount		 HISJL1STPelt.SetObjectiveCompleted(10,0)HISJL1STPelt.SetObjectiveDisplayed(15,0)HISJL1STPelt.SetObjectiveDisplayed(10,true,true)endifendFunctionFunction BearPeltsCounted()	   HISJL1STPeltTotal.value = http://forums.bethsoft.com/topic/1407207-advice-on-making-fetch-quests-more-radiant/TargetCount	   float CurrentCount = Game.GetPlayer().GetItemCount(Bear)	   HISJL1STPeltCount.Value = CurrentCountUpdateCurrentInstanceGlobal(HISJL1STPeltCount)UpdateCurrentInstanceGlobal(HISJL1STPeltTotal)if CurrentCount>= TargetCountHISJL1STPelt.SetObjectiveCompleted(10,1)HISJL1STPelt.SetObjectiveDisplayed(15,true,true)elseif CurrentCount < TargetCount		 HISJL1STPelt.SetObjectiveCompleted(10,0)HISJL1STPelt.SetObjectiveDisplayed(15,0)HISJL1STPelt.SetObjectiveDisplayed(10,true,true)endifendFunctionFunction SabrecatSnowPeltsCounted()	   HISJL1STPeltTotal.value = http://forums.bethsoft.com/topic/1407207-advice-on-making-fetch-quests-more-radiant/TargetCount	   float CurrentCount = Game.GetPlayer().GetItemCount(SabrecatSnow)	   HISJL1STPeltCount.Value = CurrentCountUpdateCurrentInstanceGlobal(HISJL1STPeltCount)UpdateCurrentInstanceGlobal(HISJL1STPeltTotal)if CurrentCount>= TargetCountHISJL1STPelt.SetObjectiveCompleted(10,1)HISJL1STPelt.SetObjectiveDisplayed(15,true,true)elseif CurrentCount < TargetCount		 HISJL1STPelt.SetObjectiveCompleted(10,0)HISJL1STPelt.SetObjectiveDisplayed(15,0)HISJL1STPelt.SetObjectiveDisplayed(10,true,true)endifendFunction

Script called in Stage 10.
Spoiler

Scriptname HISJL1STPeltScript2 extends Quest	conditionalQuest Property HISJL1STPelt  Auto  GlobalVariable Property HISJL1STPeltActual  Auto  Function RandomPelt()   if HISJL1STPeltActual.GetValueInt() == 1	   Debug.MessageBox("Sabrecat Pelts - " +HISJL1STPeltActual.GetValueInt())	   SetStage(11)   elseif HISJL1STPeltActual.GetValueInt() == 2	   Debug.MessageBox("Snow Bear Pelts - " +HISJL1STPeltActual.GetValueInt())	   SetStage(12)   elseif HISJL1STPeltActual.GetValueInt() == 3	   Debug.MessageBox("Cave Bear Pelts - " +HISJL1STPeltActual.GetValueInt())	   SetStage(13)   elseif HISJL1STPeltActual.GetValueInt() == 4	   Debug.MessageBox("Bear Pelts - " +HISJL1STPeltActual.GetValueInt())	   SetStage(14)   elseif HISJL1STPeltActual.GetValueInt() == 5	   Debug.MessageBox("Snow Sabrecat Pelts - " +HISJL1STPeltActual.GetValueInt())	   SetStage(15)endifEndFunction


Here's a little video showing it in action :smile:

http://youtu.be/Tgm5O5BR7Pw

Only took 4 days to figure out lol.
User avatar
james reed
 
Posts: 3371
Joined: Tue Sep 18, 2007 12:18 am

Post » Sun Nov 18, 2012 10:26 pm

Nice one mate, glad you got it sorted

- Hypno
User avatar
Kayla Bee
 
Posts: 3349
Joined: Fri Aug 24, 2007 5:34 pm

Post » Sun Nov 18, 2012 2:38 pm

Nice one mate, glad you got it sorted

- Hypno

Cheers mate it was a challenge.
User avatar
*Chloe*
 
Posts: 3538
Joined: Fri Jul 07, 2006 4:34 am


Return to V - Skyrim