Logged in as Guest | Group "Guests" | RSS
Friday, 31/03/2023, 12:00

Home | My profile

Total online: 1
Guests: 1
Users: 0

So, you want to have food on display in your mod, you want to be able to take it but you don't want it
jumping all over the shop just because you happen to walk somewhere vaguely near it! And it wouldn't
hurt if it refilled itself... so long as there are more in the main food container.
This resource contains 3 scripts & the entire food range from the vanilla game and Heartfire set to
be static to build yourself exactly this!

Self-refilling food displays!


You will need the Self Refilling Food Display Pack from my resources page on the Nexus, HERE

To start with you'll need some regular triggers, one for the food container and one each for the
foods it contains.
For this tutorial I'll only do one food-type and as it's always best to start at the beginning I'll
be doing A for apple!
Add an apple to any surface as a base for your triggers.

Create a trigger for each food container, with the apple selected hit the cubed T button to create a
new trigger, select New and give it an ID that represents the container for the food (you will require
one trigger per food container, depending on how you split you foods up).
All the foods will use this as a master activator for when you add/remove foods directly from the
container. As I'll only be using the small cupboard near the fire pit in Breezehome for food storage
I'll only need the one.

Thats all for now so hit OK and OK again to close the new trigger window and move the trigger to the
side (it's best to move it over the container you'll be using, just to keep it all together).
Now create a new trigger for EACH of the food items you'll be using, in this tutorial I'll only need
one for apples.

As you can see I've named this one blah_Apple_Master as this will be the enable/disable master for all
the apples in the house and will also carry the main script and I've given it the name AppleMaster, it
will need a name to be activatable from the fake apples.
OK out then double-click it, go to the Primatives tab and tick Player Activation.

Then along a few tabs to Activate Parents, Rigth-Click in the list area and select New.

When the new window opens, hit Select Reference In Window.

Which will turn your cursor into a small target, double click this on the containers Master Trigger to link them and OK all the way out.

Now you have your two main triggers for this food-type.
Create yet another trigger but this time give it a name and assign it the apple01 nif from the included
resources, these are set to static, trying to use the originals will leave them bouncing around like
normal apples.
Note I've added the word Take to the Activate Text Override at the bottom so in-game it will say
Take Red Apple instead of Activate Red Apple.

Ok out of that then double click the new trigger and in the Primatives tab tick Player Activation and
set Primative Type to None then hit OK to finish.

You will probably find when exiting your new apple will revert back to a trigger, select the trigger
and hit F5 to refresh, bingo, one apple trigger!

Now lets add some scripts.
Double-click your container, head to the Scripts tab and add the script _001_SCRPT_Food_Container.

Now open the script properties and link MasterActivator to the first trigger you made.

Now add the script _001_SCRPT_Food_Master to your other trigger (the apple master in this case) and
in it's properties link the container, the master activator and the type of food this is the master
for. Leave the message for now.

Now there's only one more script to add and this one goes on the BASE of the apple-niffed trigger,
so double-click your fake apple and select Edit Base then in the new window add the script
_001_SCRPT_ActivateHardLink and in it's properties link it to the apple master trigger.

You now have all the needed pieces, it's time to set them up!
Start by deleting your real apple (you don't need that one now) and your fake apple.
Using "real" food set up your displays, for this I'll do a bowl of apples.
I HIGHLY recommend you use static bowls and plates and do not place foods directly on top of
anything that can be activated, dressers and such, as their activation will override the fake food.
Place your "real" foods in place, hold Control and select all food items then hit the Havok button
for a more organic feel to things. Turn off Havok and do fine adjustment in case of floating or gaps.
One good-looking bowl of apples!

Now with your food items in place click Edit/Search & Replace on the toolbar, deselect Same Base Object
Type Only, tick Current Cell Only and change Replace With to the Slave version of your food, hit OK and
iit will replace all food of that type with the fake versions.

Now in the cell objects list find the fake apples, select the fiirst, then with Shift held down select
the last, this should select all in between as well (if they are not all in one bunch hit the Editor ID
bar at the top of the list to shuffle). Now Right-click any of the selected foods and select Set Enable Parent.

This will open a small Select Reference window, select the food-types master, in this case Apple_Master.
Click Select Reference In Render Window, this will turn your cursor into the target, double-click it on
the master of this food type.

OK that and now all thats left is the massage.
Create a new message and in the message area type something along the lines of "There are %.0f left in
house stores." and set it to Auto-Display.
Note the %.0f, (thats a zero by the way) this takes the count of items remaining in the container and
updates the message each time!

Link the message to the script properties on the food-type master trigger. The same message is used by
all food masters!

And you're all done!
Head in-game and try it out!

You now have a choice, as things stand all foods will be visible straight away and your users can grab
themselves one freebie of everything you have on display until they add to the container, after which
the freebie is gone.
Alternately you can edit each of the food masters and set them to Initially Disabled, this way there
will be no freebies and the player will have to fill the containers for foods to appear.
The choice is yours!

NOTE: For a tutorial this setup is fine but for a full mod there will be a LOT of food master
triggers, it is recommended that you build close to the container for each food then either drop all
non-niffed triggers below the floor or through a wall into the void so as not to be "found" by the
player while moving about.




Copyright MyCorp © 2023