Array help

Post » Sat Jun 08, 2013 12:23 am

Hey all, I've had much less time to work on my mods lately and need to turn to the community to help consolidate my Real Shelter script with array usage. It's currently over 400 lines and I'm sure it can be cut at least in half. If you would be willing to help please let me know and I will share the code. The mod (Real Shelter, link in signature) is fairly popular and I will be sure to provide appropriate credit on the front page. I would need a fairly quick turnaround as the next release (.99) is almost ready. Thanks in advance!

User avatar
Sophh
 
Posts: 3381
Joined: Tue Aug 08, 2006 11:58 pm

Post » Fri Jun 07, 2013 10:21 pm

Request this thread to be moved to the Creation Kit forum, and post the script there.
User avatar
Danielle Brown
 
Posts: 3380
Joined: Wed Sep 27, 2006 6:03 am

Post » Sat Jun 08, 2013 1:43 am

Here's an implementation with 2 formlists and the find function instead of the If-Else chain.
You'll need to make 2 formlists though, WeatherCheckList and WeatherForceList as I named them,
And you must fill both lists in the appropriate order with the appropriate weather records.

This should work? granted I could have made a typo and I've never used the "Find" function for formlists before.
Just try it out I guess.

Scriptname GetShelterTBScript extends ObjectReference  ;0416132032ACTOR PROPERTY PlayerREF AUTOGLOBALVARIABLE PROPERTY IsSheltered AUTOGLOBALVARIABLE PROPERTY ShelterSwitch AUTOGLOBALVARIABLE PROPERTY  DebugMode AUTOOBJECTREFERENCE PROPERTY rainsoundfx1 AUTOOBJECTREFERENCE PROPERTY rainsoundfx2 AUTOFORMLIST PROPERTY WeatherCheckList AUTOFORMLIST PROPERTY WeatherForceList AUTOWEATHER CurrentWeatherint listIndexEvent OnTriggerEnter(ObjectReference akActionRef)  If akActionRef == PlayerREF    If  ShelterSwitch.getvalue() == 1      Utility.wait(0.3)      CurrentWeather = Weather.GetCurrentWeather()      IsSheltered.setvalue(1)      listIndex = WeatherCheckList.Find(Weather.GetCurrentWeather() AS FORM)      If listIndex > -1        rainsoundfx1.Enable()        rainsoundfx2.Enable()	(WeatherForceList.GetAt(listIndex) AS WEATHER).ForceActive(True)      EndIf    EndIf  EndIfEndEventEvent OnTrigger(ObjectReference akActionRef)  If akActionRef == PlayerREF      IsSheltered.setvalue(1)  EndIfEndEventEvent OnTriggerLeave(ObjectReference akActionRef)  If akActionRef == PlayerREF    If  ShelterSwitch.getvalue() == 1      Utility.wait(0.3)      If  IsSheltered.getvalue() != 1        IsSheltered.setvalue(0)        Utility.wait(0.3)      EndIf      If IsSheltered.getvalue() == 0        CurrentWeather.forceactive()      EndIf      If Weather.GetCurrentWeather().GetClassification() == 2        rainsoundfx1.Disable()        rainsoundfx2.Disable()      EndIf    Utility.wait(0.3)    rainsoundfx1.Disable()    rainsoundfx2.Disable()    EndIf  EndIfEndEvent
PS: no need to credit me
User avatar
Scott
 
Posts: 3385
Joined: Fri Nov 30, 2007 2:59 am

Post » Sat Jun 08, 2013 3:01 am

Thanks Morionic for the quick work. I can do the form lists and should be able to see and correct any syntax issues. I'll get back to you on the functionality of it.

User avatar
Sammygirl500
 
Posts: 3511
Joined: Wed Jun 14, 2006 4:46 pm


Return to V - Skyrim