So I'm attempting to make a temperature mod. I've got most of it working, but I got really stuck on trying to find some way to have the mod give buffs/debuffs based on weather. Because I can't seem to figure out how weather works.
Anyone have any pointers about how to do this? I am assuming that there is something I could use here for either a bool or a switch function?
The other thing is clothing. I haven't started looking at this yet, but I'm betting I'll run into the same problem there. How can I detect if a character is wearing a cloak in one or both cloak "slots" on the paperdoll?
Detecting weather and clothing
- Ralzar
- Posts: 2211
- Joined: Mon Oct 07, 2019 4:11 pm
- Location: Norway
- BadLuckBurt
- Posts: 948
- Joined: Sun Nov 05, 2017 8:30 pm
Re: Detecting weather and clothing
The WeatherManager class has these properties:
Looking at some of the code, you should be able to get these values by calling:
or you could read it directly without assigning it to a variable. The GameManager seems to be a global object so you should have access to that already.
Code: Select all
public bool IsRaining { get; private set; }
public bool IsStorming { get; private set; }
public bool IsSnowing { get; private set; }
public bool IsOvercast { get; private set; }
Code: Select all
[s]bool isRaining = DaggerfallWorkshop.Game.GameManager.Instance.WeatherManager.IsRaining;[/s]
Last edited by BadLuckBurt on Sun Nov 24, 2019 6:03 pm, edited 1 time in total.
DFU on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt
.
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt
.
- Ralzar
- Posts: 2211
- Joined: Mon Oct 07, 2019 4:11 pm
- Location: Norway
Re: Detecting weather and clothing
That is pretty much what I expected to be able to do, but I get this back from VS and Unity:BadLuckBurt wrote: ↑Sun Nov 24, 2019 5:09 pm The WeatherManager class has these properties:
Looking at some of the code, you should be able to get these values by calling:Code: Select all
public bool IsRaining { get; private set; } public bool IsStorming { get; private set; } public bool IsSnowing { get; private set; } public bool IsOvercast { get; private set; }
or you could read it directly without assigning it to a variable. The GameManager seems to be a global object so you should have access to that already.Code: Select all
bool isRaining = DaggerfallWorkshop.Game.GameManager.Instance.WeatherManager.isRaining;
"Type `DaggerfallWorkshop.Game.WeatherManager' does not contain a definition for `isRaining' and no extension method `isRaining' of type `DaggerfallWorkshop.Game.WeatherManager' could be found. Are you missing an assembly reference?"
Edit: Oh what the hell? I think I suddenly got it to work. Have to test a bit more.
- Ralzar
- Posts: 2211
- Joined: Mon Oct 07, 2019 4:11 pm
- Location: Norway
Re: Detecting weather and clothing
Yep, it works now. No idea what made the difference as I literally copy-pasted from your post and got that error. Then when I started removing "isRaining" I suddenly got all the weather properties as suggestions. After that it just worked
- BadLuckBurt
- Posts: 948
- Joined: Sun Nov 05, 2017 8:30 pm
Re: Detecting weather and clothing
Yeah, I made a mistake in my example. I put 'isRaining' instead of 'IsRaining'. Derp
DFU on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt
.
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt
.
- Hazelnut
- Posts: 3016
- Joined: Sat Aug 26, 2017 2:46 pm
- Contact:
Re: Detecting weather and clothing
You copy pasted a lower case i instead of upper I.
Bert must be a trickster, lol.
Bert must be a trickster, lol.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods
- Ralzar
- Posts: 2211
- Joined: Mon Oct 07, 2019 4:11 pm
- Location: Norway
Re: Detecting weather and clothing
Figured out the cloak detection after a lot of trial and error
Code: Select all
var cloak1 = GameManager.Instance.PlayerEntity.ItemEquipTable.GetItem(EquipSlots.Cloak1);
var cloak2 = GameManager.Instance.PlayerEntity.ItemEquipTable.GetItem(EquipSlots.Cloak2);
if (cloak1 != null || cloak2 != null)
{}