Advertisement
Guest User

Untitled

a guest
Jun 27th, 2013
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.13 KB | None | 0 0
  1. begin EM_Kidsschedulescript
  2.  
  3. ; By Nigedo.
  4. ; This script is for all kids who require only scheduled behaviour and recall when attacked
  5. ; scripts disable/enable while unseen and timing reworked by abot
  6.  
  7. Short nolore
  8. Short knowyou
  9. Short OnPCHitMe
  10. Short removeDay
  11. Short count
  12. Short extraBounty
  13.  
  14. short i1
  15. float t1
  16. float x1
  17. float y1
  18. float x2
  19. float y2
  20. float x3
  21. float y3
  22.  
  23. if ( MenuMode == 1 )
  24. return
  25. endif
  26.  
  27. if ( i1 >= 10 )
  28. set x2 to ( GetDistance player )
  29. if ( x2 > 500 )
  30. set i1 to 1
  31. set x1 to ( player->GetPos X )
  32. set y1 to ( player->GetPos Y )
  33. set y3 to ( player->GetAngle Z )
  34.  
  35. set x2 to GetPos X
  36. set y2 to GetPos Y
  37.  
  38. set x2 to ( x2 - x1 )
  39. set y2 to ( y2 - y1 )
  40.  
  41. set x3 to ( y2 * y2 )
  42. if ( x3 < 0.000001 )
  43. return
  44. endif
  45.  
  46. set x3 to ( x2 / y2 )
  47.  
  48. if ( x2 > 0 )
  49. if ( y2 > 0 )
  50. if ( x3 > 1 )
  51. if ( y3 < -45 )
  52. set i1 to 0
  53. endif
  54. else
  55. if ( y3 < -90 )
  56. set i1 to 0
  57. endif
  58. if ( y3 > 135 )
  59. set i1 to 0
  60. endif
  61. endif
  62. else
  63. if ( x3 < -1 )
  64. if ( y3 < 0 )
  65. if ( y3 > -135 )
  66. set i1 to 0
  67. endif
  68. endif
  69. else
  70. if ( y3 < 45 )
  71. if ( y3 > -90 )
  72. set i1 to 0
  73. endif
  74. endif
  75. endif
  76. endif
  77. else
  78. if ( y2 > 0 )
  79. if ( x3 < -1 )
  80. if ( y3 > 45 )
  81. set i1 to 0
  82. endif
  83. else
  84. if ( y3 > 90 )
  85. set i1 to 0
  86. endif
  87. if ( y3 < -135 )
  88. set i1 to 0
  89. endif
  90. endif
  91. else
  92. if ( x3 > 1 )
  93. if ( y3 > 0 )
  94. if ( y3 < 135 )
  95. set i1 to 0
  96. endif
  97. endif
  98. else
  99. if ( y3 > -35 )
  100. if ( y3 < 90 )
  101. set i1 to 0
  102. endif
  103. endif
  104. endif
  105. endif
  106. endif
  107.  
  108. if ( i1 == 0 ) ; player is not looking at me
  109. if ( GetDisabled == 0 )
  110. disable
  111. else
  112. enable
  113. endif
  114. endif
  115. endif
  116. set i1 to 0
  117. endif
  118.  
  119. if ( t1 < 5 )
  120. set t1 to ( t1 + GetSecondsPassed )
  121. else
  122. set t1 to ( ( Random 10001 ) / 10000.0 )
  123. if ( GameHour > 20 )
  124. set i1 to 1
  125. elseif ( GameHour < 8 )
  126. set i1 to 1
  127. else
  128. set i1 to 0
  129. endif
  130. if ( i1 == 1 )
  131. if ( GetDisabled == 0 )
  132. set i1 to 10
  133. return
  134. endif
  135. else ; daytime
  136. if ( day != removeDay )
  137. if ( GetDisabled == 1 )
  138. set i1 to 20
  139. return
  140. endif
  141. endif
  142. endif
  143. endif
  144.  
  145. if ( CellChanged == 1 )
  146. if ( GameHour > 20 )
  147. set i1 to 1
  148. elseif ( GameHour < 8 )
  149. set i1 to 1
  150. else
  151. set i1 to 0
  152. endif
  153. if ( GetInterior == 1 )
  154. if ( i1 == 1 )
  155. if ( GetDisabled == 0 )
  156. disable
  157. endif
  158. elseif ( GetDisabled == 1 )
  159. enable
  160. endif
  161. return
  162. endif
  163. endif
  164.  
  165. if ( GetDisabled == 1 )
  166. return
  167. endif
  168.  
  169. if ( GetEffect sEffectRecall ) ; Recall cast completed
  170. set removeDay To Day; Trigger unscheduled disable for one day
  171. disable
  172. return
  173. elseif ( OnPCHitMe == 1 )
  174. SetHealth 1000 ; Prevent more attacks from killing kid
  175. Cast "1EM_kidsrecall" Player ; Face Player and cast kids recall spell
  176. if ( extraBounty == 0 )
  177. ModPCCrimeLevel 2000 ; Add extra fine for this crime
  178. set extraBounty To 1
  179. elseif ( GetPCCrimeLevel == 0 )
  180. set OnPCHitMe To 0
  181. set extraBounty To 0
  182. endif
  183. endif
  184.  
  185. End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement