home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 2003 June / macformat-130.iso / mac / Reviewed⁄Demos / Spearhead Demo / demota / pak1.pk3 / global / cardgame.scr < prev    next >
Encoding:
Text File  |  2002-10-21  |  18.8 KB  |  858 lines

  1. //    Card Players scripted by Mackey McCandlish.
  2. //    
  3. //    Before level waittill prespawn "exec global/cardgame.scr".
  4. //    
  5. //    Used in m1l2a, m2l2a, and m4l3.
  6. //
  7. //    Create an animate_furniture_cardtable and give it targetname "cardgame".
  8. //
  9. //    Create a clip brush that fits it, and then move it in on the x and y by about 4 units from each direction (basically
  10. //    creating a mini table in the table because if the table was solid the AI would get stuck on it).
  11. //
  12. //    Create either 2 or 3 AI and make the table target them all (give them all a random targetname and make the table use
  13. //    that as its target).
  14. //
  15. //    If you don't lower the hearing/sight of the AI, you'll have a hard time getting close enough to the card game to actually
  16. //    see it.
  17.  
  18. main:
  19.     exec global/loadout.scr "maps/m5l3.scr"
  20.  
  21.     level waittill spawn
  22.  
  23.  
  24.     if ($cardgame == NULL)
  25.         level.cardgames = 0
  26.         else
  27.         level.cardgames = $cardgame.size
  28.  
  29.  
  30.     if (level.cardgames > 0)
  31.     {
  32.         level.cardgame = exec global/makearray.scr $cardgame
  33.  
  34.         for (local.i=1;local.i<level.cardgames+1;local.i++)
  35.         {
  36.  
  37.             if !(level.cardgame[local.i].target)
  38.                 exec global/error.scr ("Error, cardgame at " + level.cardgame[local.i].origin + " has no targets") 1
  39.                 else
  40.                 {
  41.  
  42.                     local.sizer = $(level.cardgame[local.i].target).size
  43.  
  44.                     if ((local.sizer != 2) && (local.sizer != 3))
  45.                         exec global/error.scr ("Error, cardgame at " + level.cardgame[local.i].origin + " does not have 2 or 3 targets") 1
  46.                         else
  47.                             if (local.sizer == 2)
  48.                                 level.cardgame[local.i] thread cardgame2 local.i
  49.                                 else
  50.                                 if (local.sizer == 3)
  51.                                     level.cardgame[local.i] thread cardgame3 local.i
  52.                 }
  53.     
  54.  
  55.         }
  56.  
  57.         println ("Spawned " + level.cardgames + " cardgames")
  58.     }
  59.  
  60.     for (local.i=1;local.i<$sit.size+1;local.i++)
  61.         $sit[local.i] thread sitman
  62.  
  63. end
  64.  
  65.  
  66. chairdeath:
  67. //    local.chair = self.chair
  68. //    local.rand = randomint (10)
  69.  
  70.     self waittill death
  71.  
  72.     if (self.fighting == 0)
  73.     {
  74.         self.chair delete
  75.         local.chair = spawn script_model
  76.         local.chair model "furniture/cardchair.tik"
  77.         local.chair.origin = self.origin
  78.         local.chair.angles = self.angles
  79.         if (self.chairdeath == "chair_death_forwards")
  80.             local.chair solid
  81.         else
  82.             local.chair notsolid
  83.  
  84.         waitframe
  85.         println ("Chair is playing animation " + self.chairdeath)
  86.         local.chair anim self.chairdeath
  87.         wait 3
  88.         local.chair anim (self.chairdeath + "_end")
  89.         println ("Chair is playing animation " + (self.chairdeath + "_end"))
  90.         waitframe
  91.     }
  92.  
  93. //    wait 2
  94. end
  95.  
  96. sitman:
  97.     if !(self.target)
  98.     {
  99.         exec global/error.scr ("ERROR, sit at origin " + self.origin + " has no target") 1
  100.         end
  101.     }
  102.  
  103.     self.target.chair = self
  104.     self.target thread sitthink
  105.     self notsolid
  106.  
  107. end
  108.  
  109. sitthink:
  110.  
  111.     self.originalhealth = self.health
  112.     self.health = 1
  113.     self holster
  114.     self.origin = self.chair.origin
  115.     self.angles = self.chair.angles
  116.     self anim chair_radio_listenidle
  117.     
  118.     if (randomint (100) > 50)
  119.         self.chairdeath = "chair_death_forwards"
  120.     else
  121.         self.chairdeath = "chair_death_backwards"
  122.  
  123.     self.fighting = 0
  124.     self thread chairdeath
  125.  
  126.     self exec global/setdeathanim.scr self.chairdeath
  127.  
  128.     while (self.thinkstate == "idle")
  129.         waitframe
  130.  
  131.  
  132.     if (isalive self)
  133.     {
  134.         self lookat $player
  135.         self exec global/disable_ai.scr
  136.  
  137.         self anim chair_alert_stand
  138.         self.chair anim chair_alert_stand
  139.         self unholster
  140.         wait 0.5
  141. //        self waittill animdone
  142.         if (isalive self)
  143.         {
  144.             self.fighting = 1
  145.             self exec global/enable_ai.scr
  146.             self.health = self.originalhealth
  147.             self exec global/setdeathanim.scr NIL
  148.             self runto $player
  149.  
  150.             wait 1
  151.             self.chair anim chair_alert_stand_end
  152.         }
  153.     }
  154.  
  155.  
  156. end
  157.  
  158.  
  159.  
  160. cabinettrigger:
  161.     level waittill spawn
  162.  
  163.     self waittill trigger
  164.     while ($player istouching self)
  165.         waitframe
  166.  
  167.     for (local.i=1;local.i<level.cabinets+1;local.i++)
  168.     if ((level.cabinet[local.i].set == self.set) && (isalive level.cabinet[local.i]))
  169.         thread cabinetgo local.i
  170.  
  171. end
  172.  
  173.  
  174. cardgame2 local.set:
  175.  
  176.     self.set = local.set
  177.     self notsolid
  178. //    self solid
  179.     self.current = 1
  180.     level.carddone[local.set] = 0
  181.     
  182.     for (local.i=1;local.i<3;local.i++)
  183.     {
  184.         local.card[local.i] = $(self.target)[local.i]
  185.         local.card[local.i] type_disguise "none"
  186.         local.o = self gettagposition ("tag_actor0" + local.i)
  187.         local.a = self gettagangles ("tag_actor0" + local.i)
  188.  
  189.         local.card[local.i].mumble = 0
  190.         local.card[local.i] holster
  191.         local.card[local.i].no_idle = 1
  192. //        local.card[local.i].sight = 300
  193. //        local.card[local.i].hearing = 300
  194.         local.card[local.i].origin = local.o
  195.         local.card[local.i].angles = local.a
  196.         local.card[local.i].creator = self
  197. //        local.card[local.i] nodamage
  198.         local.card[local.i].originalhealth = local.card[local.i].health
  199.         local.card[local.i].health = 2
  200.         local.card[local.i].noticescale = 1
  201.  
  202. //        local.card[local.i] exec global/disable_ai.scr
  203.  
  204. //        local.card[local.i].painhandler = anim/pain.scr::
  205.         local.card[local.i] thread checkresponse
  206.  
  207.         if (randomint (100) > 50)
  208.             local.card[local.i].chairdeath = "chair_death_forwards"
  209.         else
  210.             local.card[local.i].chairdeath = "chair_death_backwards"
  211.  
  212.         local.card[local.i] exec global/setdeathanim.scr local.card[local.i].chairdeath
  213.  
  214.         local.card[local.i] thread cardgame2anim local.i
  215.         local.card[local.i].chairthread = parm.previousthread
  216.  
  217.         local.chair[local.i] = spawn script_model
  218.         local.chair[local.i] model "furniture/cardchair.tik"
  219.         local.chair[local.i].origin = local.o
  220.         local.chair[local.i].angles = local.a
  221.         local.chair[local.i] notsolid
  222.         local.card[local.i].chair = local.chair[local.i]
  223.  
  224.         local.card[local.i].fighting = 0
  225.         local.card[local.i] thread chairdeath
  226.  
  227.     }
  228.  
  229.     while (1)
  230.     {
  231.         for (local.current = 1;local.current<8;local.current++)
  232.         {
  233.             level.carddone[local.set] = 0
  234.             self.current = local.current
  235.             local.time = level.time + 3000
  236.             while ((level.carddone[local.set] == 0) && (level.time < local.time))
  237.                 waitframe
  238.         }
  239.     }
  240.  
  241.     
  242. end
  243.  
  244. /*
  245. cardgame2:
  246.  
  247.     for (local.i=1;local.i<3;local.i++)
  248.     {
  249.         local.card[local.i] = $(self.target)[local.i]
  250.  
  251.         local.card[local.i].sight = 500
  252.         local.card[local.i].hearing = 50
  253.         local.card[local.i].origin = self gettagposition ("tag_actor0" + local.i)
  254.         local.card[local.i].angles = self gettagangles ("tag_actor0" + local.i)
  255.         local.chair[local.i] = spawn script_model
  256.         local.chair[local.i] model "furniture/cardchair.tik"
  257.         local.chair[local.i].origin = self gettagposition ("tag_actor0" + local.i)
  258.         local.chair[local.i].angles = self gettagangles ("tag_actor0" + local.i)
  259.  
  260.     }
  261.  
  262. end
  263. */
  264. cardgame3 local.set:
  265.  
  266.     self.set = local.set
  267.     self notsolid
  268. //    self solid
  269.     self.current = 1
  270.     level.carddone[local.set] = 0
  271.     
  272.     for (local.i=1;local.i<4;local.i++)
  273.     {
  274.         local.card[local.i] = $(self.target)[local.i]
  275.         local.card[local.i] type_disguise "none"
  276.         local.o = self gettagposition ("tag_actor0" + local.i)
  277.         local.a = self gettagangles ("tag_actor0" + local.i)
  278.  
  279.         local.card[local.i].mumble = 0
  280.         local.card[local.i] holster
  281.         local.card[local.i].no_idle = 1
  282. //        local.card[local.i].sight = 300
  283. //        local.card[local.i].hearing = 300
  284.         local.card[local.i].origin = local.o
  285.         local.card[local.i].angles = local.a
  286.         local.card[local.i].creator = self
  287. //        local.card[local.i] nodamage
  288.         local.card[local.i].originalhealth = local.card[local.i].health
  289.         local.card[local.i].health = 2
  290.         local.card[local.i].noticescale = 1
  291.  
  292. //        local.card[local.i] exec global/disable_ai.scr
  293.  
  294. //        local.card[local.i].painhandler = anim/pain.scr::
  295.         local.card[local.i] thread checkresponse
  296.  
  297.         if (randomint (100) > 50)
  298.             local.card[local.i].chairdeath = "chair_death_forwards"
  299.         else
  300.             local.card[local.i].chairdeath = "chair_death_backwards"
  301.  
  302.         local.card[local.i] exec global/setdeathanim.scr local.card[local.i].chairdeath
  303.  
  304.         local.card[local.i] thread cardgame3anim local.i
  305.         local.card[local.i].chairthread = parm.previousthread
  306.  
  307.         local.chair[local.i] = spawn script_model
  308.         local.chair[local.i] model "furniture/cardchair.tik"
  309.         local.chair[local.i].origin = local.o
  310.         local.chair[local.i].angles = local.a
  311.         local.chair[local.i] notsolid
  312.         local.card[local.i].chair = local.chair[local.i]
  313.  
  314.         local.card[local.i].fighting = 0
  315.         local.card[local.i] thread chairdeath
  316.  
  317.     }
  318.  
  319.     while (1)
  320.     {
  321.         for (local.current = 1;local.current<15;local.current++)
  322.         {
  323.             level.carddone[local.set] = 0
  324.             self.current = local.current
  325.             local.time = level.time + 3000
  326.             while ((level.carddone[local.set] == 0) && (level.time < local.time))
  327.                 waitframe
  328.         }
  329.     }
  330.  
  331.     
  332. end
  333.  
  334. cardgame2anim local.num:
  335.     local.current = 0
  336.  
  337.     if (local.num == 1)
  338.     while (1)
  339.     {
  340.         if (self.creator.current == local.current)
  341.         {
  342.             self anim ("Chair_actor1_idleloop")
  343.             self waittill animdone
  344.         }
  345.         else
  346.         {
  347.             local.current = self.creator.current
  348.  
  349.             if (self.creator.current == 1)
  350.             {
  351.                 self anim ("Chair_actor1_queen")
  352.                 self waittill animdone
  353.                 level.carddone[self.creator.set] = 1
  354.             }
  355.             else
  356.             if (self.creator.current == 2)
  357.             {
  358.                 self anim ("Chair_actor1_idleloop")
  359.                 self waittill animdone
  360.             }
  361.             else
  362.             if (self.creator.current == 3)
  363.             {
  364.                 self anim ("Chair_actor1_drawcard")
  365.                 self waittill animdone
  366.                 level.carddone[self.creator.set] = 1
  367.             }
  368.             else
  369.             if (self.creator.current == 4)
  370.             {
  371.                 self anim ("Chair_actor1_idleloop")
  372.                 self waittill animdone
  373.             }
  374.             else
  375.             if (self.creator.current == 5)
  376.             {
  377.                 self anim ("Chair_actor1_fish")
  378.                 self waittill animdone
  379.                 level.carddone[self.creator.set] = 1
  380.             }
  381.             else
  382.             if (self.creator.current == 6)
  383.             {
  384.                 self anim ("Chair_actor1_idleloop")
  385.                 self waittill animdone
  386.             }
  387.             else
  388.             if (self.creator.current == 7)
  389.             {
  390.                 self anim ("Chair_actor1_idleloop")
  391.                 self waittill animdone
  392.             }
  393.         }
  394.     }
  395.     else
  396.     if (local.num == 2)
  397.     while (1)
  398.     {
  399.         if (self.creator.current == local.current)
  400.         {
  401.             self anim ("Chair_actor2_idleloop")
  402.             self waittill animdone
  403.         }
  404.         else
  405.         {
  406.             local.current = self.creator.current
  407.  
  408.             if (self.creator.current == 1)
  409.             {    
  410.                 self anim ("Chair_actor2_idleloop")
  411.                 self waittill animdone
  412.             }
  413.             else
  414.             if (self.creator.current == 2)
  415.             {
  416.                 self anim ("Chair_actor2_fish")
  417.                 self waittill animdone
  418.                 level.carddone[self.creator.set] = 1
  419.             }
  420.             else
  421.             if (self.creator.current == 3)
  422.             {
  423.                 self anim ("Chair_actor2_idleloop")
  424.                 self waittill animdone
  425.             }
  426.             else
  427.             if (self.creator.current == 4)
  428.             {
  429.                 self anim ("Chair_actor2_king")
  430.                 self waittill animdone
  431.                 level.carddone[self.creator.set] = 1
  432.             }
  433.             else
  434.             if (self.creator.current == 5)
  435.             {
  436.                 self anim ("Chair_actor2_idleloop")
  437.                 self waittill animdone
  438.             }
  439.             else
  440.             if (self.creator.current == 6)
  441.             {
  442.                 self anim ("Chair_actor2_drawcard")
  443.                 self waittill animdone
  444.                 level.carddone[self.creator.set] = 1
  445.             }
  446.             else
  447.             if (self.creator.current == 7)
  448.             {
  449.                 self anim ("Chair_actor2_idleloop")
  450.                 self waittill animdone
  451.                 level.carddone[self.creator.set] = 1
  452.             }
  453.         }
  454.     }
  455.  
  456. end
  457.  
  458.  
  459. cardgame3anim local.num:
  460.     local.current = 0
  461.  
  462.     if (local.num == 1)
  463.     while (1)
  464.     {
  465.         if (self.creator.current == local.current)
  466.         {
  467.             self anim ("Chair_actor1_idleloop")
  468.             self waittill animdone
  469.         }
  470.         else
  471.         {
  472.             local.current = self.creator.current
  473.  
  474.             if (self.creator.current == 1)
  475.             {
  476.                 self anim ("Chair_actor1_idleloop")
  477.                 self waittill animdone
  478.             }
  479.             else
  480.             if (self.creator.current == 2)
  481.             {
  482.                 self anim ("Chair_actor1_fish")
  483.                 self waittill animdone
  484.                 level.carddone[self.creator.set] = 1
  485.             }
  486.             else
  487.             if (self.creator.current == 3)
  488.             {
  489.                 self anim ("Chair_actor1_idleloop")
  490.                 self waittill animdone
  491.             }
  492.             else
  493.             if (self.creator.current == 4)
  494.             {
  495.                 self anim ("Chair_actor1_queen")
  496.                 self waittill animdone
  497.                 level.carddone[self.creator.set] = 1
  498.             }
  499.             else
  500.             if (self.creator.current == 5)
  501.             {
  502.                 self anim ("Chair_actor1_idleloop")
  503.                 self waittill animdone
  504.             }
  505.             else
  506.             if (self.creator.current == 6)
  507.             {
  508.                 self anim ("Chair_actor1_drawcard")
  509.                 self waittill animdone
  510.                 level.carddone[self.creator.set] = 1
  511.             }
  512.             else
  513.             if (self.creator.current == 7)
  514.             {
  515.                 self anim ("Chair_actor1_idleloop")
  516.                 self waittill animdone
  517.             }
  518.             else
  519.             if (self.creator.current == 8)
  520.             {
  521.                 self anim ("Chair_actor1_fish")
  522.                 self waittill animdone
  523.                 level.carddone[self.creator.set] = 1
  524.             }
  525.             else
  526.             if (self.creator.current == 9)
  527.             {
  528.                 self anim ("Chair_actor1_idleloop")
  529.                 self waittill animdone
  530.             }
  531.             else
  532.             if (self.creator.current == 10)
  533.             {
  534.                 self anim ("Chair_actor1_idleloop")
  535.                 self waittill animdone
  536.                 level.carddone[self.creator.set] = 1
  537.             }
  538.             else
  539.             if (self.creator.current == 11)
  540.             {
  541.                 self anim ("Chair_actor1_idleloop")
  542.                 self waittill animdone
  543.             }
  544.             else
  545.             if (self.creator.current == 12)
  546.             {
  547.                 self anim ("Chair_actor1_fish")
  548.                 self waittill animdone
  549.                 level.carddone[self.creator.set] = 1
  550.             }
  551.             else
  552.             if (self.creator.current == 13)
  553.             {
  554.                 self anim ("Chair_actor1_idleloop")
  555.                 self waittill animdone
  556.             }
  557.             else
  558.             if (self.creator.current == 14)
  559.             {
  560.                 self anim ("Chair_actor1_idleloop")
  561.                 self waittill animdone
  562.             }
  563.         }
  564.     }
  565.     else
  566.     if (local.num == 2)
  567.     while (1)
  568.     {
  569.         if (self.creator.current == local.current)
  570.         {
  571.             self anim ("Chair_actor2_idleloop")
  572.             self waittill animdone
  573.         }
  574.         else
  575.         {
  576.             local.current = self.creator.current
  577.  
  578.             if (self.creator.current == 1)
  579.             {    
  580.                 self anim ("Chair_actor2_king")
  581.                 self waittill animdone
  582.                 level.carddone[self.creator.set] = 1
  583.             }
  584.             else
  585.             if (self.creator.current == 2)
  586.             {
  587.                 self anim ("Chair_actor2_idleloop")
  588.                 self waittill animdone
  589.             }
  590.             else
  591.             if (self.creator.current == 3)
  592.             {
  593.                 self anim ("Chair_actor2_drawcard")
  594.                 self waittill animdone
  595.                 level.carddone[self.creator.set] = 1
  596.             }
  597.             else
  598.             if (self.creator.current == 4)
  599.             {
  600.                 self anim ("Chair_actor2_idleloop")
  601.                 self waittill animdone
  602.             }
  603.             else
  604.             if (self.creator.current == 5)
  605.             {
  606.                 self anim ("Chair_actor2_fish")
  607.                 self waittill animdone
  608.                 level.carddone[self.creator.set] = 1
  609.             }
  610.             else
  611.             if (self.creator.current == 6)
  612.             {
  613.                 self anim ("Chair_actor2_idleloop")
  614.                 self waittill animdone
  615.             }
  616.             else
  617.             if (self.creator.current == 7)
  618.             {
  619.                 self anim ("Chair_actor2_king")
  620.                 self waittill animdone
  621.                 level.carddone[self.creator.set] = 1
  622.             }
  623.             else
  624.             if (self.creator.current == 8)
  625.             {
  626.                 self anim ("Chair_actor2_idleloop")
  627.                 self waittill animdone
  628.             }
  629.             else
  630.             if (self.creator.current == 9)
  631.             {
  632.                 self anim ("Chair_actor2_drawcard")
  633.                 self waittill animdone
  634.                 level.carddone[self.creator.set] = 1
  635.             }
  636.             else
  637.             if (self.creator.current == 10)
  638.             {
  639.                 self anim ("Chair_actor2_idleloop")
  640.                 self waittill animdone
  641.             }
  642.             else
  643.             if (self.creator.current == 11)
  644.             {
  645.                 self anim ("Chair_actor2_idleloop")
  646.                 self waittill animdone
  647.             }
  648.             else
  649.             if (self.creator.current == 12)
  650.             {
  651.                 self anim ("Chair_actor2_idleloop")
  652.                 self waittill animdone
  653.             }
  654.             else
  655.             if (self.creator.current == 13)
  656.             {
  657.                 self anim ("Chair_actor2_idleloop")
  658.                 self waittill animdone
  659.             }
  660.             else
  661.             if (self.creator.current == 14)
  662.             {
  663.                 self anim ("Chair_actor2_idleloop")
  664.                 self waittill animdone
  665.             }
  666.         }
  667.     }
  668.     else
  669.     if (local.num == 3)
  670.     while (1)
  671.     {
  672.         if (self.creator.current == local.current)
  673.         {
  674.             self anim ("Chair_actor2_idleloop")
  675.             self waittill animdone
  676.         }
  677.         else
  678.         {
  679.         local.current = self.creator.current
  680.  
  681.             if (self.creator.current == 1)
  682.             {
  683.                 self anim ("Chair_actor2_idleloop")
  684.                 self waittill animdone
  685.             }
  686.             else
  687.             if (self.creator.current == 2)
  688.             {
  689.                 self anim ("Chair_actor2_idleloop")
  690.                 self waittill animdone
  691.             }
  692.             else
  693.             if (self.creator.current == 3)
  694.             {
  695.                 self anim ("Chair_actor2_idleloop")
  696.                 self waittill animdone
  697.             }
  698.             else
  699.             if (self.creator.current == 4)
  700.             {
  701.                 self anim ("Chair_actor2_idleloop")
  702.                 self waittill animdone
  703.             }
  704.             else
  705.             if (self.creator.current == 5)
  706.             {
  707.                 self anim ("Chair_actor2_idleloop")
  708.                 self waittill animdone
  709.             }
  710.             else
  711.             if (self.creator.current == 6)
  712.             {
  713.                 self anim ("Chair_actor2_idleloop")
  714.                 self waittill animdone
  715.             }
  716.             else
  717.             if (self.creator.current == 7)
  718.             {
  719.                 self anim ("Chair_actor2_idleloop")
  720.                 self waittill animdone
  721.             }
  722.             else
  723.             if (self.creator.current == 8)
  724.             {
  725.                 self anim ("Chair_actor2_idleloop")
  726.                 self waittill animdone
  727.             }
  728.             else
  729.             if (self.creator.current == 9)
  730.             {
  731.                 self anim ("Chair_actor2_idleloop")
  732.                 self waittill animdone
  733.             }
  734.             else
  735.             if (self.creator.current == 10)
  736.             {
  737.                 self anim ("Chair_actor2_idleloop")
  738.                 self waittill animdone
  739.             }
  740.             else
  741.             if (self.creator.current == 11)
  742.             {
  743.                 self anim ("Chair_actor2_king")
  744.                 self waittill animdone
  745.                 level.carddone[self.creator.set] = 1
  746.             }
  747.             else
  748.             if (self.creator.current == 12)
  749.             {
  750.                 self anim ("Chair_actor2_idleloop")
  751.                 self waittill animdone
  752.             }
  753.             else
  754.             if (self.creator.current == 13)
  755.             {
  756.                 self anim ("Chair_actor2_drawcard")
  757.                 self waittill animdone
  758.                 level.carddone[self.creator.set] = 1
  759.             }
  760.             else
  761.             if (self.creator.current == 14)
  762.             {
  763.                 self anim ("Chair_actor2_idleloop")
  764.                 self waittill animdone
  765.                 level.carddone[self.creator.set] = 1
  766.             }
  767.         }
  768.     }
  769.  
  770. end
  771.  
  772.  
  773. printtest local.saythis:
  774.     if (level.printtest == NIL)
  775.         level.printtest = 1
  776.  
  777.     if (local.saythis != NIL)
  778.     print (":::" + local.saythis + " ")
  779.  
  780.     level.printtest++
  781.  
  782.  
  783. end
  784.  
  785. broken:
  786.     wait randomfloat(1.5)
  787.     self.creator.broken = 1
  788. end
  789.  
  790.  
  791. checkresponse:
  792.     self.nosurprise = 1
  793.     self.noticescale = 1
  794.     self.creator.broken = 0
  795.  
  796.     while ((self.thinkstate == "idle") && (self.creator.broken == 0))
  797.         waitframe
  798.  
  799.     thread broken
  800.  
  801. //    if (self.thinkstate == "attack")
  802.     {
  803.         self lookat $player
  804.         self exec global/disable_ai.scr
  805.         self.chairthread delete
  806.  
  807.         self anim chair_alert_stand
  808.         if (self.chair)
  809.         self.chair anim chair_alert_stand
  810.         self unholster
  811.         wait 0.5
  812. //        self waittill animdone
  813.         if (isalive self)
  814.         {
  815.             self unholster
  816.             self exec global/enable_ai.scr
  817.             self.health = self.originalhealth
  818.             self exec global/setdeathanim.scr NIL
  819.             wait 0.1
  820.             self.fighting = 1
  821. //            self runto $player
  822.  
  823.             for (local.i=0;local.i<6;local.i++)
  824.             {
  825.                 if (isalive self)
  826.                 {
  827.                     self unholster
  828.                     wait 1
  829.                 }
  830.             }
  831.  
  832.             wait 1
  833.             self.chair anim chair_alert_stand_end
  834.         }
  835.  
  836.     }
  837. end
  838. //    else
  839. //    if (self.thinkstate == "curious")
  840.     {
  841.         self lookat $player
  842.         self exec global/disable_ai.scr
  843.         self.chairthread delete
  844.  
  845.         self anim chair_curious_stand
  846.         self.chair anim chair_curious_stand
  847.         self unholster
  848.         wait 0.8
  849. //        self waittill animdone
  850.         if (isalive self)
  851.         {
  852.             self exec global/enable_ai.scr
  853.             self.health = self.originalhealth
  854.             self exec global/setdeathanim.scr NIL
  855. //            self runto $player
  856.         }
  857.     }
  858. end