
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):
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:
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:
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
