kucingkucing Posted May 8, 2024 Share Posted May 8, 2024 sorry for my bad English I tried to convert this from Python to papyrus, I looked for hours but not found, please help #get all item in player container playeritems = player.inv #check each item/element using "For Loop" for playeritem in playeritems : if playeritem.HasKeyword(ObjectTypeFood) : Player.EquipItem playeritem #after player consume item food, break the "For Loop" break Link to comment Share on other sites More sharing options...
SKKmods Posted May 8, 2024 Share Posted May 8, 2024 Player.inv is not a papyrus function. You need to look up the Papyrus functions. Most likely you will need to use GetInventoryItems() which is an F4SE function https://falloutck.uesp.net/wiki/GetInventoryItems_-_ObjectReference Then you need to look at some base game scripts to understand the Payrus script structure and format. Link to comment Share on other sites More sharing options...
kucingkucing Posted May 8, 2024 Author Share Posted May 8, 2024 35 minutes ago, SKKmods said: Player.inv is not a papyrus function. You need to look up the Papyrus functions. Most likely you will need to use GetInventoryItems() which is an F4SE function https://falloutck.uesp.net/wiki/GetInventoryItems_-_ObjectReference Then you need to look at some base game scripts to understand the Payrus script structure and format. thank you for the answer, and this is the result: Form[] items = player.GetInventoryItems() Bool bBreak = False int currentItem = 0 While (currentItem < items.Length) && !bBreak Form item = items[currentItem] If playeritem.HasKeyword(ObjectTypeFood) Player.EquipItem playeritem bBreak = True Endif currentItem += 1 EndWhile sadly I can't test the code because I use it in the console command, and this "form" must be run in a PSC extension, and do not have a clue how to trigger it to run Link to comment Share on other sites More sharing options...
SKKmods Posted May 8, 2024 Share Posted May 8, 2024 You will need to read or watch a how to create and compile papyrus scripts tutorial. There are many on youtube. The Bethesda Mod School series is good. Link to comment Share on other sites More sharing options...
kucingkucing Posted May 8, 2024 Author Share Posted May 8, 2024 sorry if i rude, after many times tried, the script is not run even the compile succeed but the result not appear Scriptname AutoConsume extends Quest MiscObject Property Caps001 Auto Actor PlayerRef Event OnInit() RegisterForKey(160); left shift endEvent Event OnKeyDown(Int KeyCode) If KeyCode == 160 PlayerRef = Game.GetPlayer() Game.GetPlayer().AddItem(Caps001,1000) EndIf EndEvent but when i press "left shift" the caps do not increase, why? and second, how to produce warning box like his : Link to comment Share on other sites More sharing options...
Recommended Posts