gman517 Posted August 25, 2019 Share Posted August 25, 2019 I am aware that a form list can be used as the parameter for container.GetItemCount. I am having trouble however getting it to check for specific amounts of said list. In my case i just have a form list containing only TinCan02 and tried this:if player.GetItemCount ScrapMetalrecipe >=3 In the interests of learning scripting and to achieve something hopefully bigger.Form List EG; Let's call it PancakeRecipe.Fry PanPotato MashEggs (lol i know but this is only an example after all yeah? :wink: ) I want my recipe to check if I have 1 Fry Pan1 Potato Mash2 Eggs I'm hoping to use form lists to minimise code size:instead of If player.GetItemCount FryPan >= 1 && player.GetItemCount PotatoMash >=1 && player.GetItemCount Eggs >=2 player.RemoveItem PotatoMash 1 player.RemoveItem Eggs 2 player.AddItem Pancake 1 endif Im hoping for, With Fry pan removed from form list for obvious reasons if player.GetItemCount PancakeRecipe && player.GetitemCount FryPan >= 1 player.Removeitem PancakeRecipe player.AddItem Pancake 1 endif I noticed that in form lists you can't specify amounts in the form list itself.So for a super long recipe how would I best achieve this if there are specific numbers in the recipe higher than 1? Or is this New Vegas only territory? This isn't mentioned in the geck wiki however... Link to comment Share on other sites More sharing options...
JW1 Posted August 27, 2019 Share Posted August 27, 2019 According to the GECK documentation, GetItemCount with a form list returns a count of all items in the list that are in the inventory. So, if you had a form list of FryPan Eggs and Mash as in your example, and the container had 3 eggs only then GetItemCount would return 3, just as it would if the container had one pan, one egg and one mash. In other words, if GetItemCount returns > 0 it simply tells you that at least one of the items in the form list is in the container. I'm not sure how helpful that really is. Link to comment Share on other sites More sharing options...
gman517 Posted August 27, 2019 Author Share Posted August 27, 2019 (edited) Guess I need to just mess around with the code in that case. So my question should be:How do I check for a specific number of each item from the form list?Since GECK only allows you to add the items to the form list but not specify how many. I have not seen this on the geck wiki and I couldn't get it to check for 3 Bent Tin Cans when I had 4 Bent Tin Cans In my inventory and my original form list only had Bent Tin Cans in it My code: which currently has hasperk commented out for testing Edit: Also how do I correctly mark code as GECK script on this forum? scn MetalWorkerAutoCraftingSCR Begin GameMode ;if player.HasPerk Metalworker If player.GetItemCount SparePartsRecipe >=3 ;Form list only has Bent Tin Cans to convert to Scrap Metal ;This isn't firing player.RemoveItem TinCan02 3 player.AddItem SpareParts 1 endif ;endif End But for the sake of those trying to also find this out. And for the sake of my pancake example since I have multiples items in my example form list. Since I've hit a dead end.Is it maybe something like if player.GetItemCount Eggs.PancakeRecipe =>2 && player.GetItemCount Mash.PancakeRecipe >=1 player.RemoveItem Eggs.PancakeRecipe 2 player.Removeitem Mash.PancakeRecipe 1 endif Edit2: In which case I might as well just use player.GetItemCount, player.AddItem and player.RemoveItem for each item. Right now a Form list just seems like an extra step that lengthens the code for recipes and are only useful as reference lists... Unless someone knows a bit more about this. Or do I just skip fo3 entirely since NV actually has recipes as part of NV GECK? Edit3: Or does this type of checking need FOSE? But at the same time it still makes my code longer if that's the case. So does anyone know for certain if this type of check will even make my code shorter? So far all I'm seeing is that it won't. Edited August 27, 2019 by gman517 Link to comment Share on other sites More sharing options...
gman517 Posted August 30, 2019 Author Share Posted August 30, 2019 (edited) So from strenuous testing. I found that when using. if player.GetItemCount <FormlistID> >=1 It will still fire even if some of the items on the list are 0.Does anyone know how to get this simple check working 100% without specifically checking for each item individually in code like below?Is this even possible? or should I just stick with individual checking? if player.GetItemCount item1 >=1 && player.GetItemCount item2 >=1 && player.GetItemCount item3 >=1 && player.GetItemCount item4 >=1 && player.GetItemCount item5 >=1 ;etc Sorry about the bump but I need to know if anyone knows about this. Edit: Updated GetItemCount to include my findings. As that is the first result to a google search of GetItemCount. If there is a better place i should be updating let me know by PM. Also I just realized that the answer to my question is not that its for item testing. but in the case of schematics. It's for removing, and this is how code can be made smaller, it may not make a huge difference in some cases but EVERY LITTLE PIECE adds up in terms of clarity :wink:. See my example below, with the correct tweaks should work a charm for you: This is for those who are unaware of the full usage of FormLists. FormList Example: MySuperGrenadeRecipeScrap metalAbraxo cleanerturpentineFrag grenade5.56mm bullets My recipe:scrap metal x1Abraxo cleaner x1Turpentine x1Frag grenade x15.56mm bullets x10 if player.GetItemCount SpareParts >=1 && player.GetItemCount AbraxoCleaner >=1 && player.GetItemCount Turpentine >=1 && player.GetItemCount WeapGrenadeFrag >=1 && player.GetItemCount Ammo556mm >=10 player.RemoveItem MySuperGrenadeRecipe 1 player.Removeitem 556mmbullet 10 player.AddItem WeapMySuperGrenade endif ;note how short that got? imagine what difference this can make to your super long recipes! Hope this helps. And I will be adding clarity to some wiki pages in the form of notes over the next few days as an extra helper :wink: Edited August 30, 2019 by gman517 Link to comment Share on other sites More sharing options...
Recommended Posts