Scripts

TR_m1_q_57_AttackCrabScript

TR_Mainland.esm
Variables 2
Local Variables
crabvar
timer
Source
1Begin TR_m1_q_57_AttackCrabScript 2 3;this makes the attackcrabs attack mudlap when you return 4;and disables them when appropriate 5 6Short crabvar 7Float timer 8 9If ( GetDisabled == 1 ) 10 SetDelete 1 11 Return 12Endif 13;deletes them when they're disabled 14 15 16If ( crabvar == 2 ) 17 If ( GetDistance, player > 5000 ) 18 Disable 19 return 20 Endif 21Endif 22;crabvar=2 is the toggle for disabling them when they're out of sight 23 24 25If ( GetJournalIndex "TR_m1_wil_MudlapMosslog" == 130 ) ;disable if mudlap has made his attack 26 Disable 27 Return 28ElseIf ( GetJournalIndex "TR_m1_wil_MudlapMosslog" == 110 ) ;disable if you waited too long 29 Disable 30 Return 31ElseIf ( GetJournalIndex "TR_m1_wil_MudlapMosslog" >= 90 ) ;toggle disable when out of sight 32 Set crabvar to 2 33ElseIf ( GetJournalIndex "TR_m1_wil_MudlapMosslog" >= 70 ) ;this handles them attacking mudlap 34 If ( crabvar == 0 ) ;if it's the first time 35 If ( player->GetDistance "TR_m1_q_57_Mudlap" < 2000 ) ;if player close enough to see 36 StartCombat "TR_m1_q_57_Mudlap" ;attack mudlap 37 SetFight 100 ;be aggressive 38 Set crabvar to 1 ;don't keep attacking every frame 39 Endif 40 Elseif ( crabvar == 1 ) ;this is the later attacks (so they don't attack player instead) 41 Set timer to ( timer + GetSecondsPassed ) ;count the seconds 42 If ( timer > 10 ) ;after every 10 seconds 43 If ( GetDeadCount "TR_m1_q_57_Mudlap" == 0 ) ;if mudlap isn't dead 44 StartCombat "TR_m1_q_57_Mudlap" ;keep attacking mudlap 45 Else ;if mudlap is dead (presumably they killed him) 46 Set crabvar to 0 ;relax or attack the player 47 Endif 48 Endif 49 Endif 50Elseif ( GetJournalIndex "TR_m1_wil_MudlapMosslog" == 60 ) ;disable if you reported mudlap 51 Disable 52 Return 53Endif 54;makes the crabs turn on Mudlap and disable when appropriate 55 56End