OBSE question: GetCurrentWeatherID

Post » Thu Jan 27, 2011 10:04 pm

Going by the CS Wiki and OBSE documentation, this function should "return the refID of the current weather." Am I correct in assuming this is Oblivion's standard refID, ie Rain = 00038EF2, Shivering Isles Fog = 00044F5A, etc.? I can't imagine what else it might mean, though for what I'm doing it shouldn't really matter.

OK, next question. Assume I have a script which OnActivate sets a ref on a persistent object script using this function, like so:

set weatherref to GetCurrentWeatherID

Should I not then be able to use ForceWeather weatherref to reset the weather after a change?

The problem I am having is this function does not appear to work as advertised in the latest OBSE. After setting the reference as illustrated I set up a message to show what the variable had grabbed:

Message "Current Weather: %.4f", weatherref

This returns 0.000 which is obviously not right.

Any ideas?
User avatar
Sheila Reyes
 
Posts: 3386
Joined: Thu Dec 28, 2006 7:40 am

Post » Thu Jan 27, 2011 5:36 pm

Use MessageEX "Current Weather: %i", weatherref and you will see that the ref has been loaded correctly.
User avatar
Rachel Briere
 
Posts: 3438
Joined: Thu Dec 28, 2006 9:09 am

Post » Thu Jan 27, 2011 2:20 pm

I see, thanks. Must be something else then. I think I have an idea too.

Basically I have a couple persistent refs that get called to the player's location before they (the player) are moved to a custom interior cell using PositionCell. Both those invisible objects get left behind as persistent scripted refs in the world. One is just a marker, for using MoveTo to bring them back when they exit this cell. That part works fine.

The other is the part I think is malfunctioning, because it isn't working forcing weather specifically (ForceWeather Rain) any better than it is with OBSE and a variable (ForceWeather obseref).

What I think is happening is that even though this second ref is persistent it is somehow only getting loaded once, so even when the player comes back out with MoveTo, and that object's script should pick up the line if GetDistance player < 1000 which i have running constantly in its GameMode block, I think the game is just ignoring it for whatever reason, and so it is never getting to the ForceWeather part.

There seem to be many goofy little bugs with MoveTo, so I wouldn't be surprised if this is yet another.

Right now I'm working on a way to force this reference object to reload itself when the player ports back out with MoveTo. Any help with that would be much appreciated!

:brokencomputer:
User avatar
Crystal Clarke
 
Posts: 3410
Joined: Mon Dec 11, 2006 5:55 am

Post » Thu Jan 27, 2011 10:05 pm

Your setup seems OK. The problem may be within the script code.

A couple of suggestions:
Turn your objects visible during tests, so you can confirm they are really there.
Some kinds of objects may snap back to their original location under certain conditions. Others don't. So people use creatures to mark the spot to go back to. Search "Marker Rats" on the WIKI/Forums and you will find a lot of supporting information.
But this does not seem to be your current problem, as you are going back to the proper spot.
User avatar
Prisca Lacour
 
Posts: 3375
Joined: Thu Mar 15, 2007 9:25 am

Post » Fri Jan 28, 2011 1:49 am

Thanks again, I ended up getting it to work. Turns out the best way to handle forcing weather changes is with a quest script, as they can run all the time and have an option to set how frequently their script conditions are checked, so they process (nearly) every frame.

I start the quest just before I get the weather variables, then have the quest script handle forcing the state when the conditions are correct, along with stopping itself to avoid any extra processor load. ;)
User avatar
Robyn Howlett
 
Posts: 3332
Joined: Wed Aug 23, 2006 9:01 pm


Return to IV - Oblivion