[WIP] [Resource] Ingredient Multiplication Arch-Mage Style

Post » Mon Nov 19, 2012 8:27 am

Title says it all.

Is this even possible? Going for essentially the same functionality (from TESIV). Player must wait in-game time before duplicated ingredients can be retrieved.

I think this could be a cool little feature for many mods. Like anything, the application is limited only by our imagination. Once the framework is there this could be applied to many things: Construction materials, crafting materials, weapon + armour production (for customizable armies), Skyrim Lottery!?

Something like:

AddInventoryEventFilter(Ingredient) so that any mod-added forms located in the CK's Ingredient branch will give us events.

I'm pretty new to Papyrus and I feel this may be a little too ambitious an undertaking for me to forge ahead alone. :tongue:
User avatar
LijLuva
 
Posts: 3347
Joined: Wed Sep 20, 2006 1:59 am

Post » Mon Nov 19, 2012 8:30 pm

Yes, it certainly is possible, it would be easier with SKSE, because you would have:

int Function http://www.creationkit.com/GetNumItems_-_ObjectReference()
Form Function http://www.creationkit.com/GetNthForm_-_ObjectReference(int index)

So you could just set a game time update, and after that amount of time you can loop through all items in the container.

You could just check for every single item if it's an ingredient, and then add one of the base item if it is. Then if you go through 5 of the same item, you will have added 5 copies of it. However, you should add them to a temporay container first and then add that container's inventory to the real one once you've looped through every item. Because if you don't, they may be added before "GetNthForm" runs again, which would change how many items are in the container and could result in putting too many/too few items in the container (or making infinitely many copies of an item depending on how you set it up).

AddInventoryEventFilter(Ingredient) so that any mod-added forms located in the CK's Ingredient branch will give us events.

Why?
I think there's just a keyword for ingredients, so I would just use that to know which items are ingredients and which are not. If mod creators add the keyword to their items (they should), it would work.

Also, I don't think it's too ambitious... it sounds like a good "first project".
User avatar
LuCY sCoTT
 
Posts: 3410
Joined: Sun Feb 04, 2007 8:29 am

Post » Mon Nov 19, 2012 7:49 am

Take a look at my mod here.
http://skyrim.nexusmods.com/mods/10045
It has an function to move all ingredients from you to an container. You could easy modify it to search until it found one ingredient, then empty the container and add say 10 of the same type.
User avatar
Stephanie I
 
Posts: 3357
Joined: Thu Apr 05, 2007 3:28 pm

Post » Mon Nov 19, 2012 5:57 pm

@SeventyFour:
Ideally, this mod would not require SKSE, but I'll keep that in mind. Thanks
Keywords won't work as some vanilla items are missing their keywords. Also to ensure maximum compatibility with mod-added content using keywords is fallible as author's may forget to assign keywords.
I already had the idea to have another container, that way stuff can actually get added to it in real time (much easier to track, plus the reason you mentioned) but is only accessible after a defined waiting period.

@Zaria:
Cheers, I'll look into it.


Also, I don't think it's too ambitious... it sounds like a good "first project".

Haha this is by no means my first project (but pretty close) it's supposed to be a feature included in a player-home mod I am working on. That is my main (and 1st) project currently and is taking up a lot of my time, so it takes precedence.
I say this because there may not be developments on my end for a few days.
User avatar
Blaine
 
Posts: 3456
Joined: Wed May 16, 2007 4:24 pm

Post » Mon Nov 19, 2012 9:59 am

Zaria, I see that you define each ingredient as a property in your script. This means mod-added ingredients will not be compatible.
Also, since every ingredient in your script is pre-determined you may be better served to include them all in an array.

I may have to resort to keywords. Can anyone confirm that AddInventoryEventFilter(Ingredient) will or won't work?
User avatar
T. tacks Rims
 
Posts: 3447
Joined: Wed Oct 10, 2007 10:35 am

Post » Mon Nov 19, 2012 9:37 am

Can anyone confirm that AddInventoryEventFilter(Ingredient) will or won't work?
It won't work unless "Ingredient" is the name of a FormList bearing all ingredients.

To catch mod/DLC added INGR forms, you'd need to use SKSE's http://www.creationkit.com/GetType_-_Form in a Player alias http://www.creationkit.com/OnItemAdded_-_ObjectReference event, then add them to your FLST, or something similar.
User avatar
Astargoth Rockin' Design
 
Posts: 3450
Joined: Mon Apr 02, 2007 2:51 pm

Post » Mon Nov 19, 2012 4:48 pm

It won't work unless "Ingredient" is the name of a FormList bearing all ingredients.

To catch mod/DLC added INGR forms, you'd need to use SKSE's http://www.creationkit.com/GetType_-_Form in a Player alias http://www.creationkit.com/OnItemAdded_-_ObjectReference event, then add them to your FLST, or something similar.

I was afraid of that.

SKSE it is then. I think that its safe to say this project will be relegated to the back-burner for me until Mzandahrk v1.0 is released. (Player home mod I'm working on)

Thanks for the tip JustinOther.
User avatar
Kortniie Dumont
 
Posts: 3428
Joined: Wed Jan 10, 2007 7:50 pm

Post » Mon Nov 19, 2012 11:48 am

Also, here's a snippet that'll work for the INGR additions:
Spoiler
  • Quest:
    ScriptName YourQuestScript Extends QuestBool bSKSEReferenceAlias Property PlayerAlias AutoEvent OnInit()	Maintenance()EndEventFunction Maintenance()	If bSKSE != (SKSE.GetVersionRelease() >= 17)		bSKSE = !bSKSE		If bSKSE			PlayerAlias.GoToState("SKSEDetected")		Else			PlayerAlias.GoToState("")		EndIf	EndIfEndFunction
  • Player Alias:
    ScriptName YourPlayerAliasScript Extends ReferenceAliasFormList Property YourIngredientFLST AutoKeyword Property VendorItemIngredient AutoYourQuestScript Property QuestScript AutoEvent OnPlayerLoadGame()	QuestScript.Maintenance()EndEventEvent OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akFormReference, ObjectReference akSourceContainer)	If YourIngredientFLST.HasForm(akBaseItem)	ElseIf akBaseItem.HasKeyword(VendorItemIngredient) ; ... This will catch some provided the keyword has been added.		YourIngredientFLST.AddForm(akBaseItem) 	EndIfEndEventState SKSEDetected	Event OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akFormReference, ObjectReference akSourceContainer)		If YourIngredientFLST.HasForm(akBaseItem)		ElseIf akBaseItem.GetType() == 30 ; kIngredient			YourIngredientFLST.AddForm(akBaseItem) 		EndIf	EndEventEndState
Edit: Added states. If your quest detects SKSE is/isn't installed http://www.creationkit.com/Complete_Example_Scripts#Maintenance.2Fupdate_code_which_runs_once_per_save_load_and_shows_a_message_when_a_mod_is_updated_or_first_loaded via http://www.creationkit.com/GetVersionRelease_-_SKSE, you can toggle states so the right code runs.

There's a convoluted way which you can detect plugins and add forms to the FLST without SKSE, but it would only work for mods you had taken the time to include and wouldn't catch anything else.
User avatar
helen buchan
 
Posts: 3464
Joined: Wed Sep 13, 2006 7:17 am

Post » Mon Nov 19, 2012 4:27 pm

Hey thanks. I appreciate that.
I'l let you know how it goes when the time comes.
User avatar
Enny Labinjo
 
Posts: 3480
Joined: Tue Aug 01, 2006 3:04 pm

Post » Mon Nov 19, 2012 10:05 pm

Try out the code above. I reworked/tested it and all should go well.
User avatar
Jessica Raven
 
Posts: 3409
Joined: Thu Dec 21, 2006 4:33 am

Post » Mon Nov 19, 2012 8:42 am

I'll definitely try it out. Implementation will probably be verbatim. I'm just busy with other things.
User avatar
matt white
 
Posts: 3444
Joined: Fri Jul 27, 2007 2:43 pm

Post » Mon Nov 19, 2012 4:43 pm

@SeventyFour:
Ideally, this mod would not require SKSE, but I'll keep that in mind. Thanks
Keywords won't work as some vanilla items are missing their keywords. Also to ensure maximum compatibility with mod-added content using keywords is fallible as author's may forget to assign keywords.
I already had the idea to have another container, that way stuff can actually get added to it in real time (much easier to track, plus the reason you mentioned) but is only accessible after a defined waiting period.

Oh, I just expected they would have keywords. That's lame that they don't. Oh well...

"I'm pretty new to Papyrus and I feel this may be a little too ambitious an undertaking for me to forge ahead alone. :tongue:"

I just said "first project" because you added that... well, either way it doesn't seem too ambitious that you should be concerned!
User avatar
Sophh
 
Posts: 3381
Joined: Tue Aug 08, 2006 11:58 pm


Return to V - Skyrim