Jump to content

Scripting help, Weather detection for armor


dominator42

Recommended Posts

Trying to create a mod that will allow model path change of armoraddon based on location (weather actually appears better reference)...

I am a scripting newb and have gotten stuck on properly detecting weather and realize it is likely a very simple oversight on my part but do not see it.

 

This script is attached to objectalias "player" in generic quest... There is also a script attached to the quest (not used at this time, more of placeholder)

It is returning false (warm) on every update even if in console I set weather. I have written this several different ways though since none worked any better than the other I guess there is no reason to go into specifics.

Scriptname _dm_PlayerRA Extends ObjectReference

Import Debug
import game
import weather
import utility


Quest Property _dm_RegionalArmors  Auto  



; snowy region weather
Weather Property SkyrimOvercastSnow auto ; 4D7FB
Weather Property SkyrimCloudySN auto ; 10A245
Weather Property SkyrimStormSnow auto ; C8221
Weather Property SkyrimClearSN auto ; 10A244
Weather Property SkyrimClearSN_A auto ; 10E1F0
Weather Property SkyrimCloudySN_A auto ; 10E1EF

Float property updateint = 20.0 auto hidden ; update time interval



Event OnInit()
	Debug.Notification("RegionalArmors Start")
	RegisterForSingleUpdate(updateint)
EndEvent

Event OnUpdate()
		if isColdRegion()
			debug.Notification("Update...Cold Location")
		else
			debug.Notification("Update...Warm Location")
		endif
	RegisterForSingleUpdate(updateint)
EndEvent


bool Function isColdRegion()
	bool iscold = false
	if GetCurrentWeather() == SkyrimOvercastSnow
		iscold = true
	elseif GetCurrentWeather() == SkyrimCloudySN
		iscold = true
	ElseIf GetCurrentWeather() == SkyrimStormSnow
		iscold = true
	ElseIf GetCurrentWeather() == SkyrimClearSN
		iscold = true
	ElseIf GetCurrentWeather() == SkyrimClearSN_A
		iscold = true
	ElseIf GetCurrentWeather() == SkyrimCloudySN_A
		iscold = true
	else
		iscold = false
	endif
	return iscold
EndFunction

The End Goal is that script populated formlists for Snow weather as well as armor and if a Snowy weather from the list is current weather the armors will have there default AA model path changed to have a more winter appropriate path.. and vice versa... This will be a global change on all armors, however, I will be looking to remove player worn armor from formlist at time of update so it is the only one not effected until unequipped as to not effect immersion... and possibly a LOS exclusion to match if it appears needed

 

Any help with my current issue and insight into future work of this mod is greatly appreciated.

Link to comment
Share on other sites

Try Debug.Messagebox instead of notification, you could change all those ifs to ORs:

If GetCurrentWeather() == SkyrimOvercastSnow || GetCurrentWeather() == SkyrimCloudySN || etc.
     iscold = true
EndIf

Do realize that you're currently waiting TWENTY SECONDS for that update. Why? Just change it to 1 second for testing. It won't continue until IsColdRegion has been called.

 

Make sure ALL YOUR PROPERTIES ARE FILLED.

Link to comment
Share on other sites

I figured it out... It was not so much how I was writing the script but that after declaring properties I was not associating a value to the property in the CK... missed that part in Cipscis.

"Once you've declared a property like this, you then need to associate a value with it. In order to do this, navigate to the object with your script attached to it in the Creation Kit, right click on your script, and select "Edit Properties"."

Cleaned it up and have it running off a formlist like I was trying to do in the first place.

 

Thx for the help

Link to comment
Share on other sites

  On 7/21/2015 at 1:58 AM, dominator42 said:

I figured it out... It was not so much how I was writing the script but that after declaring properties I was not associating a value to the property in the CK... missed that part in Cipscis.

"Once you've declared a property like this, you then need to associate a value with it. In order to do this, navigate to the object with your script attached to it in the Creation Kit, right click on your script, and select "Edit Properties"."

Cleaned it up and have it running off a formlist like I was trying to do in the first place.

 

Thx for the help

Yeah, you needed to fill the properties as I mentioned. ;)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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