Need help with script to turn eaten ingredient into other in

Post » Wed Jun 20, 2012 5:43 am

Hi, I wanna make a script which will turn any ingredient player eats into something else, for example if you eat garlic you will get a custom item garlic extract.

But what is giving me the most trouble is how to check if the player eats something, I didn't find a function to do it, can someone help?
User avatar
Claudz
 
Posts: 3484
Joined: Thu Sep 07, 2006 5:33 am

Post » Wed Jun 20, 2012 4:27 am

You can add a custom magic effect that runs a script, to your actual food. This script would do something like:

Scriptname MyFancyGarlicScript Extends ActiveMagicEffectEvent OnEffectStartSelf.AddItem(etc.)EndEvent
User avatar
Claire Vaux
 
Posts: 3485
Joined: Sun Aug 06, 2006 6:56 am

Post » Tue Jun 19, 2012 9:29 pm

Ah yes, that seems much simpler, thank you very much
User avatar
Adriana Lenzo
 
Posts: 3446
Joined: Tue Apr 03, 2007 1:32 am

Post » Tue Jun 19, 2012 9:15 pm

i like doing such things with a formlist.. that way dont need to edit each food item.
put each food item in a formlist then compare to formlist
this also makes sure the food item it wasnt dropped or sold.

edit: you can also look into AddInventoryEventFilter(FormList), which will filter for events also, but won't differentiate betweeneaten, sold, or dropped.

.....................extends referencealiasFormList property FoodList AutoEvent OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)		 if akDestContainer == none && akItemReference == none  		  	  if (FoodList.HasForm(akBaseItem))	   ;do something		Debug.Notification("Very Tasty!")	  endif	 endifDebug.Trace("item event data: " + akBaseItem + ", " + aiItemCount + ", " + akItemReference + ", " + akSourceContainer)endevent
User avatar
Abel Vazquez
 
Posts: 3334
Joined: Tue Aug 14, 2007 12:25 am

Post » Tue Jun 19, 2012 5:11 pm

Hi, I wanna make a script which will turn any ingredient player eats into something else, for example if you eat garlic you will get a custom item garlic extract.

But what is giving me the most trouble is how to check if the player eats something, I didn't find a function to do it, can someone help?

You could use an Alias and its Script for the Player, with an OnObjectEquipped Event.

When the Player will equip (eat) garlic, it will read AddItem(GarlicExtract, 1, true).
User avatar
Scared humanity
 
Posts: 3470
Joined: Tue Oct 16, 2007 3:41 am


Return to V - Skyrim