This one:
begin 1runs_comp3Scriptfloat axfloat ayfloat bxfloat byfloat bzfloat cxfloat cyfloat czfloat t1float t2float t3float t4float coDistfloat coDist2float playzfloat timerfloat sheatheTimerfloat moveTimerfloat h_checkshort doOnceshort doOnce2short combatDoneshort weapUseshort combatCheckshort soundPlayedshort flyCheckshort wwCheckshort oneTimeMoveshort compMoveshort c_moveshort warpshort c_marksmanshort c_speedshort c_athleticsshort companionshort nohelloshort noLoreshort countershort addOnceshort p_Checkshort oldcellif ( MenuMode == 1 ) if ( GetPCSleep == 0 ) return endifendifif ( weapUse == 1 ) if ( Player->GetWeaponType <= 8 ) setmarksman 0 elseif ( weapUse == 1 ) if ( Player->GetWeaponType >= 9 ) setmarksman 200 endif endifendifif ( combatCheck == 1 ) set sheathetimer to sheatheTimer + GetSecondsPassed if ( GetSoundPlaying, "Weapon Swish" == 1 ) set sheatheTimer to 0 return elseif ( GetSoundPlaying, crossbowShoot == 1 ) set sheatheTimer to 0 return elseif ( GetSoundPlaying, bowShoot == 1 ) set sheatheTimer to 0 return elseif ( sheatheTimer > 4 ) if ( GetSoundPlaying "Weapon Swish" == 0 ) set sheatheTimer to 0 set soundPlayed to 1 elseif ( sheatheTimer > 4 ) if ( GetSoundPlaying "crossbowShoot" == 0 ) set sheatheTimer to 0 set soundPlayed to 1 elseif ( sheatheTimer > 4 ) if ( GetSoundPlaying "bowShoot" == 0 ) set sheatheTimer to 0 set soundPlayed to 1 endif endif endif endifendifif ( soundPlayed == 1 ) equip "silver dagger" removeitem "silver dagger" 1; messagebox "Working" set soundPlayed to 0 set combatCheck to 0 set combatDone to 1endifif ( combatDone == 1 ) set timer to timer + GetSecondsPassed if ( timer > 6 ) set timer to 0 set combatDone to 0 set warp to 0 endifendif if ( GetCurrentAIPackage == 3 ) if ( GetPCSleep == 1 ) StartScript 1runs_compLevel endif if ( GetPCSneaking == 1 ) ForceSneak elseif ( GetPCSneaking == 0 ) ClearForceSneak endif if ( Player->GetEffect sEffectLevitate == 1 ) if ( flyCheck == 0 ) cast 1gr_comp2_lev_bog player addspell 1gr_comp2_lev set flyCheck to 1 endif endif if ( Player->GetEffect sEffectLevitate == 0 ) if ( flyCheck == 1 ) removespell 1gr_comp2_lev set flyCheck to 0 endif endif if ( Player->GetEffect sEffectWaterWalking == 1 ) if ( wwCheck == 0 ) cast 1gr_comp2_ww_bog player addspell 1gr_comp2_ww set wwCheck to 1 endif endif if ( Player->GetEffect sEffectWaterWalking == 0 ) if ( wwCheck == 1 ) removespell 1gr_comp2_ww set wwCheck to 0 endif endif if ( flyCheck == 1 ) if ( GetWeaponDrawn == 0 ) set playz to ( Player->GetPos z ) SetPos z playz elseif ( flyCheck == 1 ) if ( GetCurrentAIPackage != 3 ) if ( GetWeaponDrawn == 0 ) set playz to ( GetPos z ) SetPos z playz endif endif endif endif if ( GetWeaponDrawn == 1 ) if ( flyCheck == 0 ) set combatCheck to 1 set timer to 0 set warp to 1 return elseif ( GetWeaponDrawn == 1 ) if ( flyCheck == 1 ) set combatDone to 1 set timer to 0 set warp to 1 return endif endif endif set ax to ( Player->GetPos x ) set ay to ( Player->GetPos y ) if ( doOnce == 0 ) set bx to ( Player->GetPos x ) set by to ( Player->GetPos y ) set bz to ( Player->GetPos z ) set doOnce to 1 endif set t1 to ( ax - bx ) set t1 to ( t1 * t1 ) set t2 to ( ay - by ) set t2 to ( t2 * t2 ) set t1 to ( t1 + t2 ) set coDist to ( GetSquareRoot, t1 ) if ( coDist > 360 ) set doOnce to 0 endif if ( coDist > 180 ) if ( doOnce2 == 0 ) set cx to ( Player->GetPos x ) set cy to ( Player->GetPos y ) set cz to ( Player->GetPos z ) set doOnce2 to 1 endif endif set t3 to ( ax - cx ) set t3 to ( t3 * t3 ) set t4 to ( ay - cy ) set t4 to ( t4 * t4 ) set t3 to ( t3 + t4 ) set coDist2 to ( GetSquareRoot, t3 ) if ( coDist2 > 360 ) set doOnce2 to 0 endif if ( warp == 0 ) if ( coDist > 350 ) if ( GetDistance Player > 680 ) SetPos x bx SetPos y by SetPos z bz AiFollow Player 0 0 0 0 elseif ( warp == 0 ) if ( coDist2 > 350 ) if ( GetDistance Player > 680 ) SetPos x cx SetPos y cy SetPos z cz AiFollow Player 0 0 0 0 endif endif endif endif endifendif;IF ADDITIONS ARE DESIRED, PLEASE ADD THEM BELOW HERE...if ( GetCurrentAIPackage == 3 ) if ( compMove == 1 ) if ( c_move == 0 ) if ( GetDistance Player < 70 ) AIWander 300 0 0 0 0 set c_move to 1 endif endif endifendifif ( c_move == 1 ) if ( GetDistance Player > 100 ) AIFollow Player 0 0 0 0 set c_move to 0 endifendifif ( oneTimeMove == 1 ) set moveTimer to moveTimer + GetSecondsPassed if ( moveTimer > 4 ) set moveTimer to 0 AiFollow Player 0 0 0 0 set oneTimeMove to 0 endifendif; to allow my companion to not stand on me when we went through load;doors and to help prevent her from dying if we levitated through a load doorif ( CellChanged == 0 ) if ( GetInterior == 1 ) set oldcell to 1 ;sets oldcell to interior cell else set oldcell to 0 ;sets oldcell to exterior cell endif endif if ( CellChanged == 1 ) if ( flyCheck == 1 ) if ( GetInterior == 1 ) AiWander 256 0 0 0 set warp to 0 set moveTimer to 0 set oneTimeMove to 3 elseif ( oldcell == 1 ) AiWander 256 0 0 0 set warp to 0 set moveTimer to 0 set oneTimeMove to 3 endif endifendif if ( CellChanged == 1 ) if ( oneTimeMove == 0 ) if ( GetInterior == 1 ) set oneTimeMove to 2 AIWander 300 0 0 0 0 set moveTimer to 0 elseif ( oldcell == 1 ) set oneTimeMove to 2 AIWander 300 0 0 0 0 set moveTimer to 0 endif endif endifendif if ( oneTimeMove == 3 ) set moveTimer to moveTimer + GetSecondsPassed if ( moveTimer > 5.0 ) set oneTimeMove to 0 set warp to 0 endif endif if ( oneTimeMove == 2 ) set moveTimer to moveTimer + GetSecondsPassed if ( moveTimer > 2.25 ) set moveTimer to 0 AiFollow Player 0 0 0 0 set oneTimeMove to 0 endif endif ;AND ABOVE HERE.;ADDITIONS CAN ALSO BE ADDED TO THIS FOLLOWING SECTION, BUT BEWARE OF THE COUNTER.;Counter can pooch some functions if they need to be checked every frame.if ( counter < 20 ) set counter to counter + 1 returnendifset counter to 0if ( GetCurrentAIPackage == 3 ) if ( GetDistance Player < 300 ) setSpeed 15 setAthletics 15 elseif ( GetDistance Player > 300 ) set c_speed to ( ( Player->GetSpeed ) * 2.25 ) set c_athletics to ( ( Player->GetAthletics ) * 2.25 ) setSpeed c_speed setAthletics c_athletics endif if ( GetItemCount p_restore_health_b >= 1 ) set p_Check to 1 elseif ( GetItemCount p_restore_health_c >= 1 ) set p_Check to 1 elseif ( GetItemCount p_restore_health_e >= 1 ) set p_Check to 1 elseif ( GetItemCount p_restore_health_q >= 1 ) set p_Check to 1 elseif ( GetItemCount p_restore_health_s >= 1 ) set p_Check to 1 else set p_Check to 0 endifendifif ( GetCurrentAIPackage != 3 ) setspeed 40endif;ADD ADDITIONAL TOPICS IN THIS SECTION IF REQUIRED.if ( addOnce == 0 ) AddTopic "Lamia La Loca" AddTopic "-Combatir" AddTopic "-Seguirme" AddTopic "-Otros" StartScript 1runs_compLevel set companion to 1 set addOnce to 1endifend
Plus the default Grumpy leveling script.
Any suggestion to improve it?