Jump to content

Finding if food has been ingested?


Recommended Posts

Posted

I'm currently working on a mod that part of deals with finding if the player eats something. So far I've attached a script to the food items, then a global variable should get updated to some value when the player consumes it. However, I can't seem to find info anywhere on how to script that. I've tried things like using a MenuMode block, but that doesn't seem to work.

Posted

The two easy-to-use options for food added by your mod would be...

 

-Use an OnEquip script. Attach it to the food item, and when the player eats it, the game counts it as "equipped" and thus will trigger the script.

-Alternatively, add a scripted magic effect to the food that, once it's applied to the player, does whatever you want it to do with ScriptEffectStart.

 

Now, if you want to use it for all food in-game, and don't want to create major incompatibilities with other mods that change the food records, you're probably going to have to use an event handler.

Posted

The two easy-to-use options for food added by your mod would be...

 

-Use an OnEquip script. Attach it to the food item, and when the player eats it, the game counts it as "equipped" and thus will trigger the script.

-Alternatively, add a scripted magic effect to the food that, once it's applied to the player, does whatever you want it to do with ScriptEffectStart.

 

Now, if you want to use it for all food in-game, and don't want to create major incompatibilities with other mods that change the food records, you're probably going to have to use an event handler.

I'll be doing the event handler for sure, it's probably the best option. The weird thing is I was doing option one that you listed, but for whatever reason it had no effect on the variable I was trying to change when food was consumed - I'm guessing now that it's probably something to do with the basic primary needs mod I have installed. Originally I wasn't going to do that, I wanted to stay away from OBSE as much as possible. (I'm just weird like that, it's sort of the same thing with my fav programming language!)

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...