Please help me decipher the workings of Meteor.esp

Post » Thu Jan 31, 2013 4:19 pm

So I'm not much of a scripter, I've only been able to make small edits to scripts and such and make script related mods with tons of help from others. That being said, I'd like some help deciphering how the http://planetelderscrolls.gamespy.com/View.php?view=Mods.Detail&id=9201 is actually working. If I could figure it out, it would open the possibility of many mods such as nebulae, rainbows, and other such weather features.

Anyways, here are the scripts included in the mod. As I said I'm no scripter so I'm interested in what the scripters can figure out from it.

This is the first script, "Meteor_Travel"
Spoiler
begin Meteor_Travelif ( MenuMode == 1 )	returnendifshort MeteorInitfloat MeteorLifeshort VectorLenfloat Timerfloat subamountshort subcheckshort substepfloat Xvaluefloat Yvaluefloat Zvalueshort MeteorStartshort MeteorDirif ( MeteorInit == 0 )  set MeteorInit to 1  set MeteorLife to random 3  set MeteorLife to ( MeteorLife + 0.3000000 )  SetScale 0.4000000  set Zvalue to ( MeteorLife / 2 )  ModScale Zvalue  SetAngle, x, 0  SetAngle, y, 0  set Zvalue to ( "player"-> GetPos z )  set Zvalue to ( Zvalue + 4096.0000000 )  set substep to random 7  if ( ShowerDir == 1 )   set MeteorStart to random 2   set MeteorStart to ( MeteorStart + 1 )  elseif ( ShowerDir == 2 )   set MeteorStart to random 2   set MeteorStart to ( MeteorStart + 2 )  elseif ( ShowerDir == 3 )   set MeteorStart to random 2   set MeteorStart to ( MeteorStart + 3 )  elseif ( ShowerDir == 4 )   set MeteorStart to random 2   set MeteorStart to ( MeteorStart + 4 )   if ( MeteorStart > 4 )	set MeteorStart to 1   endif  else   set MeteorStart to random 5  endif  set subamount to ( Random100 * 20.4800000 );MeteorStart  set Xvalue to ( "player"-> GetPos x )  set Yvalue to ( "player"-> GetPos y )  if (MeteorStart == 1)   set Yvalue to ( ( Yvalue + subamount ) + 4096.0000000 )   set MeteorDir to (5 + substep)  elseif (MeteorStart == 2)   set Xvalue to ( ( Xvalue + subamount ) + 4096.0000000  )   set MeteorDir to (9 + substep)  elseif (MeteorStart == 3)   set Yvalue to ( ( Yvalue - subamount ) - 4096.0000000  )   set MeteorDir to (13 + substep)   if (MeteorDir > 15)	set MeteorDir to (MeteorDir - 15)   endif  elseif (MeteorStart == 4)   set Xvalue to ( ( Xvalue - subamount ) -  4096.0000000  )   set MeteorDir to (1 + substep)  else   set MeteorDir to random 16  endif  setpos X Xvalue  setpos Y Yvalue  setpos Z Zvalue;MeteorDir  if (MeteorDir == 0)   SetAngle, z, 0  elseif (MeteorDir == 1)   SetAngle, z, 22.5  elseif (MeteorDir == 2)   SetAngle, z, 45  elseif (MeteorDir == 3)   SetAngle, z, 67.5  elseif (MeteorDir == 4)   SetAngle, z, 90  elseif (MeteorDir == 5)   SetAngle, z, 112.5  elseif (MeteorDir == 6)   SetAngle, z, 135  elseif (MeteorDir == 7)   SetAngle, z, 157.5  elseif (MeteorDir == 8)   SetAngle, z, 180  elseif (MeteorDir == 9)   SetAngle, z, 202.5  elseif (MeteorDir == 10)   SetAngle, z, 225  elseif (MeteorDir == 11)   SetAngle, z, 247.5  elseif (MeteorDir == 12)   SetAngle Z 270  elseif (MeteorDir == 13)   SetAngle, z, 292.5  elseif (MeteorDir == 14)   SetAngle, z, 315  else  ;15   SetAngle, z, 337.5  endif;  Messagebox "MeteorStart %g, MeteorDir %g, angle %f", MeteorStart, MeteorDir, Zvalueendifif ( MeteorLife <= 0 )  disable  SetDelete, 1  returnelse  Move Y 4096  ModScale -0.0050000  set MeteorLife to (MeteorLife - GetSecondsPassed)  if ( "player"-> CellChanged == 1 )   disable   SetDelete, 1   return  endifendif

And the second script, "Meteors"
Spoiler
Begin Meteors;0 = N;1 = NNE;2 = NE;3 = NEE;4 = E;5 = SEE;6 = SE;7 = SSE;8 = S;9 = SSW;10 = SW;11 = SWW;12 = W;13 = NWW;14 = NW;15 = NNW;0 = top;1 = N;2 = E;3 = S;4 = Wshort FireOneshort NightStagefloat subchanceif ( MenuMode == 1 )	returnendifif ( GetCurrentWeather > 1 )returnendifif (FireOne == 1)if ( subchance <= 0.0000000 )if ( GetWindSpeed == 0.0000000 )set FireOne to 0elsePlaceAtPC, "Meteor" 1 0 0set FireOne to 0endifelseset subchance to ( subchance - GetSecondsPassed )endifelseif ( NightStage == 0 )if ( GameHour >= 19.0000000 )if ( Random100 < 1 )set ShowerDir to random 4set ShowerDir to ( ShowerDir + 1 )set MeteorChance to Random 100set MeteorChance to ( MeteorChance + 1 )elseset ShowerDir to 0set MeteorChance to Random 100set MeteorChance to ( MeteorChance * 20.4800000 )set MeteorChance to ( MeteorChance + 1 )endifset NightStage to 1elseif ( GameHour <= 7.0000000 )if ( Random100 < 1 )set ShowerDir to random 4set ShowerDir to ( ShowerDir + 1 )set MeteorChance to Random 100set MeteorChance to ( MeteorChance + 1 )elseset ShowerDir to 0set MeteorChance to Random 100set MeteorChance to ( MeteorChance * 20.4800000 )set MeteorChance to ( MeteorChance + 1 )endifset NightStage to 1endifelseif ( GameHour < 19.0000000 )if ( GameHour > 7.0000000 )set NightStage to 0endifendifset subchance to ( MeteorChance / 100.0000000 )set subchance to ( subchance * Random100 )set FireOne to 1endifendifEnd Meteors

So what are these scripts doing? As far as I can observe ingame they appear to make the meteor mesh move across the night sky in different quantities and directions based on conditions I am unfamiliar with. It's also notable that when using Vanilla night skies the mesh only appears to travel across a small portion of the night sky, but if I use the modified night sky mesh from my mod then the meteor mesh is scaled up slightly and moves across what looked to be the entire night sky.

Again, your help would be greatly appreciated, as I am not much of a scripter, but utilizing the methods in this mod may or may not open the possibility of new weather mods.
User avatar
kevin ball
 
Posts: 3399
Joined: Fri Jun 08, 2007 10:02 pm

Return to III - Morrowind