Mesh ID for camp fires

Discuss modding questions and implementation details.
Post Reply
User avatar
Ralzar
Posts: 815
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Mesh ID for camp fires

Post by Ralzar » Mon Feb 03, 2020 11:27 am

I am am looking at implementing camping functions for Climates & Cloaks. I figured I would use the bed resting function from Hazelnuts RP&R as a basis. This worked great for being able to rest by a fireplace, however, I am trying to figure out how to make it work for the campfires you find in dungeons and I'm running into a problem.

For Fireplaces I just needed:

Code: Select all

PlayerActivate.RegisterModelActivation(41116, CampActivation);
And then

Code: Select all

private static void CampActivation(Transform transform)
{
//Debug.Log("Camping");
IUserInterfaceManager uiManager = DaggerfallUI.UIManager;
uiManager.PushWindow(new DaggerfallRestWindow(uiManager, true));
}
However, when attmepting to identify a mesh ID for campfires I am running into the problem that thy are part of billboard mesh 210:
campfirebillboard.PNG
campfirebillboard.PNG (12.53 KiB) Viewed 120 times
Is there a way to refer to this in my code? Just doing

Code: Select all

PlayerActivate.RegisterModelActivation(210, CampActivation);
obviously doesn't work as I assume I need to refer to the index as well?
My released mods

"I feel like Ralzar specifically wrote those mods for me and then said "Use them". Just so he could watch me die more."
-FuzzyBeanPlays

BadLuckBurt
Posts: 296
Joined: Sun Nov 05, 2017 8:30 pm

Re: Mesh ID for camp fires

Post by BadLuckBurt » Mon Feb 03, 2020 12:39 pm

I don't think you can do that at the moment. There is no mesh ID for campfires, it's a flat / billboard and those are identified by the texture archive ID and the texture record ID and constructed in a different way. The mesh IDs only refer to the 3d models you can see in Daggerfall Modeling.

Take a look at the Update() function in PlayerActivate.cs and you'll see that the custom activations for models are handled all the way at the bottom. Something similar would need to be added for billboards too.

User avatar
Ralzar
Posts: 815
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: Mesh ID for camp fires

Post by Ralzar » Mon Feb 03, 2020 12:54 pm

Ah damn. I hope there's a way to get around that. I just realized the function could be used for a completely seperate mod as well: creating safespots in dungeons and only allow you to rest (or maybe save?) in those spots.
My released mods

"I feel like Ralzar specifically wrote those mods for me and then said "Use them". Just so he could watch me die more."
-FuzzyBeanPlays

BadLuckBurt
Posts: 296
Joined: Sun Nov 05, 2017 8:30 pm

Re: Mesh ID for camp fires

Post by BadLuckBurt » Mon Feb 03, 2020 1:04 pm

Ralzar wrote:
Mon Feb 03, 2020 12:54 pm
Ah damn. I hope there's a way to get around that. I just realized the function could be used for a completely seperate mod as well: creating safespots in dungeons and only allow you to rest (or maybe save?) in those spots.
I don't think there's a way around it but the function should probably be added because there's a lot to gain from custom activation on sprites. Up to this point nobody requested or needed it I guess so you have another first :D

User avatar
Hazelnut
Posts: 2005
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Mesh ID for camp fires

Post by Hazelnut » Tue Feb 04, 2020 12:56 pm

Campfires are flats, and with the exception of NPCs flats are not activate-able in the base game. It is possible to make new flats you add activate-able, like in harvestable plants mod, but not the campfires in the base game AFAIK. I could have missed something that TheLacus knows though.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

BadLuckBurt
Posts: 296
Joined: Sun Nov 05, 2017 8:30 pm

Re: Mesh ID for camp fires

Post by BadLuckBurt » Tue Feb 04, 2020 1:18 pm

Hazelnut wrote:
Tue Feb 04, 2020 12:56 pm
Campfires are flats, and with the exception of NPCs flats are not activate-able in the base game. It is possible to make new flats you add activate-able, like in harvestable plants mod, but not the campfires in the base game AFAIK. I could have missed something that TheLacus knows though.
I think you are correct. I looked over the PlayerActivate class while talking with Ralzar on Discord and apart from handling the custom activations you can assign to models, there is nothing similar for flats yet, just the built-in handlers for when you activate mobile / static NPCs, lootpiles, etc.

I plan to do some tests later on based on the custom model activation, the setup seems pretty straight forward so it could probably be adapted for flats.

Post Reply