home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 42 / CDGAMER42.iso / Egoboo / egoboo.exe / egoboo / modules / gnome.mod / objects / bosslump.obj / script.txt < prev    next >
Text File  |  2000-05-30  |  10KB  |  424 lines

  1. //------------------------------------------------------------------------------
  2. // ZZ> Boss stuff...
  3. IfSpawned
  4.   DisableExport
  5.  
  6.  
  7. //------------------------------------------------------------------------------
  8. // ZZ> Run away if too close to killer
  9. IfOrdered
  10.   tmpx = selforder
  11.   tmpy = 0
  12.   IfXIsEqualToY
  13.     // Someone said that there's an enemy around, so look for 'im
  14.     SetTargetToWideEnemy
  15.   Else
  16.     // Someone died, so make Scrub Lumpkins run away
  17.     tmpargument = 0
  18.     IfArmorIs
  19.       // It's a Scrub, so check distance
  20.       tmpx = selforder > 8
  21.       tmpy = selforder & 255
  22.       tmpx = selfx > 7 - tmpx
  23.       tmpy = selfy > 7 - tmpy
  24.       tmpturn = xydistance
  25.       tmpdistance = 5  // Number of tiles
  26.  
  27.       IfDistanceIsMoreThanTurn
  28.         tmpargument = 2
  29.         SendMessageNear
  30.         tmpargument = rand & 3 + 7
  31.         SetContent
  32.         tmpargument = STATERETREAT
  33.         SetState
  34.  
  35.  
  36.  
  37. //------------------------------------------------------------------------------
  38. // ZZ> Handle death by sending a message and telling allies to run away
  39. IfKilled
  40.   // Drop goodies
  41.   tmpargument = 65535
  42.   DropMoney
  43.   DropKeys
  44.  
  45.  
  46.   // Make the character body
  47.   tmpargument = 45
  48.   SetBumpHeight
  49.  
  50.   // Tell friends to run away
  51.   tmpx = targetx > 7
  52.   tmpy = targety > 7
  53.   tmpargument = tmpx < 8 + tmpy
  54.   IssueOrder
  55.  
  56.  
  57.   // Send the message
  58.   tmpx = selfmorale
  59.   tmpy = 0
  60.   IfXIsEqualToY
  61.     // The player won...
  62.     tmpargument = [BEAT]
  63.     AddIDSZ
  64.     EnableExport
  65.     BeatModule
  66.  
  67.  
  68.     // Finish text
  69.     ClearEndMessage
  70.     tmpargument = 6
  71.     AddEndMessage
  72.     tmpargument = 7
  73.     AddEndMessage
  74.     tmpargument = 8
  75.     AddEndMessage
  76.  
  77.  
  78.     IfTargetIsAlive
  79.       tmpargument = ACTIONMC
  80.       TargetDoAction
  81.       tmpargument = 4
  82.       tmpdistance = 11025
  83.       PlayFullSound
  84.  
  85.  
  86.     tmpargument = 100
  87.     tmpdistance = EXPQUEST
  88.     GiveExperienceToTargetTeam
  89.  
  90.  
  91.     tmpargument = 3
  92.     SendMessageNear
  93.   Else
  94.     IfTargetIsOnOtherTeam
  95.       tmpargument = MESSAGEDEATH
  96.       SendMessageNear
  97.     Else
  98.       tmpargument = 1
  99.       SendMessageNear
  100.  
  101.  
  102.   // Scream
  103.   tmpdistance = rand & 2047 + 11000
  104.   tmpargument = 3
  105.   PlaySound
  106.  
  107.  
  108. //------------------------------------------------------------------------------
  109. // ZZ> Respawn the character
  110. IfCleanedUp
  111.   RespawnCharacter
  112.  
  113.  
  114.  
  115. //------------------------------------------------------------------------------
  116. // ZZ> Handle being bumped by countering or wandering
  117. IfBumped
  118.   IfStateIsRetreat
  119.     GetState // NOP
  120.   Else
  121.     SetTargetToWhoeverBumped
  122.     IfTargetIsOnHatedTeam
  123.       tmpargument = [LUMP]
  124.       IfTargetHasID
  125.         SetTargetToOldTarget
  126.       Else
  127.         tmpargument = STATEPARRY
  128.         SetState
  129.     Else
  130.       SetTargetToOldTarget
  131.  
  132.  
  133.  
  134. //------------------------------------------------------------------------------
  135. // ZZ> Handle being attacked by blocking or countering or running away
  136. IfAttacked
  137.   // Scream
  138.   tmpdistance = rand & 2047 + 11000
  139.   tmpargument = 2
  140.   PlaySound
  141.   // Pick either 0 or 7, Parry or Combat
  142.   SetTargetToWhoeverAttacked
  143.   IfStateIsRetreat
  144.     GetState  // NOP
  145.   Else
  146.     IfTargetIsOnHatedTeam
  147.       tmpargument = 0
  148.       IssueOrder
  149.       tmpargument = rand & 1
  150.       tmpargument = tmpargument < 3 - tmpargument
  151.       // Check remaining life and remaining friends
  152.       tmpx = selfmorale < 8 + selflife
  153.       tmpy = 800
  154.       IfXIsLessThanY
  155.         tmpargument = rand & 3 + 7
  156.         SetContent
  157.         tmpargument = STATERETREAT
  158.       SetState
  159.  
  160.  
  161.  
  162. //------------------------------------------------------------------------------
  163. // ZZ> Handle being healed by spitting out a message and stopping retreat
  164. IfHealed
  165.   IfStateIsRetreat
  166.     tmpargument = STATECHARGE
  167.     SetState
  168.     tmpargument = 5
  169.   Else
  170.     tmpargument = 4
  171.   SendMessageNear
  172.  
  173.  
  174.  
  175. //------------------------------------------------------------------------------
  176. // ZZ> Handle blocking an attack by countering
  177. IfBlocked
  178.   IfStateIsRetreat
  179.     GetState  // NOP
  180.   Else
  181.     tmpargument = STATECOMBAT
  182.     SetState
  183.  
  184.  
  185. //------------------------------------------------------------------------------
  186. // ZZ> Handle an aggressive enemy by checking dexterity to block
  187. IfTargetIsAttacking
  188.   // If it's not a threat, circle around the enemy
  189.   IfStateIsParry
  190.     GetState  // NOP
  191.   Else
  192.     IfStateIsRetreat
  193.       GetState // NOP
  194.     Else
  195.       tmpargument = STATECOMBAT
  196.       tmpx = targetdistance
  197.       tmpy = 600
  198.       IfXIsLessThanY    
  199.         // Are the character and enemy facing opposite directions?
  200.         tmpturn = targetturn - selfturn
  201.         tmpx = tmpturn
  202.         tmpy = 16000
  203.         IfXIsMoreThanY
  204.           tmpy = 48000
  205.           IfXIsLessThanY
  206.             // Does it pass the Dex check...  8191 is perfect
  207.             tmpx = selfdex
  208.             tmpy = rand & 16383
  209.             IfXIsMoreThanY
  210.               // Is the enemy facing the character?
  211.               tmpx = targetturnto - targetturn
  212.               tmpy = 30000
  213.               IfXIsMoreThanY
  214.                 tmpargument = rand & 15 + 15
  215.                 SetTime
  216.                 tmpargument = STATEPARRY
  217.               tmpy = 0 - 30000
  218.               IfXIsLessThanY
  219.                 tmpargument = rand & 15 + 15
  220.                 SetTime
  221.                 tmpargument = STATEPARRY
  222.       SetState
  223.  
  224.  
  225.  
  226. //------------------------------------------------------------------------------
  227. // ZZ> This is the state chooser and interpreter
  228. IfTimeOut
  229.   // Choose a new state, by setting tmpargument
  230.   // Look for enemies
  231.   SetTurnModeToVelocity
  232.  
  233.  
  234.   // Find an enemy
  235.   tmpx = 0
  236.   IfTargetIsOnHatedTeam
  237.     // Already have an enemy
  238.     tmpx = targetdistance
  239.     tmpy = 900
  240.     IfXIsMoreThanY
  241.       tmpx = 0
  242.       // Find a new enemy
  243.       tmpargument = [LUMP]
  244.       tmpdistance = 18  // BLAHENEMIES | BLAHINVERTID
  245.       SetTargetToWideBlahID
  246.         tmpx = 1
  247.     Else
  248.       // Keep the current enemy
  249.       tmpx = 1
  250.   Else
  251.     tmpargument = [LUMP]
  252.     tmpdistance = 18  // BLAHENEMIES | BLAHINVERTID
  253.     SetTargetToWideBlahID
  254.       tmpx = 1
  255.  
  256.  
  257.  
  258.  
  259.   tmpy = 0
  260.   IfXIsMoreThanY
  261.     // Default to previous state
  262.     GetState
  263.  
  264.     // Switch to combat if close enough
  265.     IfStateIsCharge
  266.       tmpx = targetdistance
  267.       tmpy = 600
  268.       IfXIsLessThanY
  269.         tmpargument = STATECOMBAT
  270.  
  271.     // Fight 'em if there's nothing better to do
  272.     IfStateIsGuard
  273.       tmpargument = STATECOMBAT
  274.  
  275.     // Let courage come back ( content is used as a timer )
  276.     IfStateIsRetreat
  277.       GetContent
  278.       tmpargument = tmpargument - 1
  279.       SetContent
  280.       tmpargument = 0
  281.       IfContentIs
  282.         tmpargument = STATECHARGE
  283.       Else
  284.         GetState
  285.  
  286.     // Lower shield and attack
  287.     IfStateIsParry
  288.       tmpargument = STATECOMBAT
  289.  
  290.  
  291.   // No enemy in general area, so return to the guard post
  292.   Else
  293.     IfStateIsRetreat
  294.       GetState
  295.     Else
  296.       tmpargument = STATEGUARD
  297.  
  298.  
  299.  
  300.   // Now set the state to whatever tmpargument is
  301.   SetState
  302.  
  303.  
  304.   // Interpret the states and set the latches
  305.   // Defend
  306.   IfStateIsParry
  307.     IfHoldingShield
  308.       PressLatchButton
  309.       tmpx = selfx
  310.       tmpy = selfy
  311.       tmpargument = rand & 31 + 15
  312.  
  313.   // Return to guard post
  314.   IfStateIsGuard
  315.     tmpx = rand & 511 - 256 + selfspawnx
  316.     tmpy = rand & 511 - 256 + selfspawny
  317.     tmpargument = rand & 63 + 30
  318.  
  319.   // Run away
  320.   IfStateIsRetreat
  321.     tmpx = selfx
  322.     tmpy = selfy
  323.     tmpdistance = 400
  324.     tmpturn = rand & 32767 + targetturnto + 16384
  325.     Compass
  326.     tmpargument = rand & 15 + 10
  327.  
  328.   // Approach
  329.   IfStateIsCharge
  330.     tmpx = targetx + selfx > 1
  331.     tmpy = targety + selfy > 1
  332.     tmpargument = rand & 15 + 10
  333.  
  334.   // Attack with melee weapon, Keep back with ranged
  335.   IfStateIsCombat
  336.     tmpturn = targetturnto
  337.     IfHoldingRangedWeapon
  338.       tmpx = selfz
  339.       tmpy = targetz + 60
  340.       IfSitting
  341.         tmpy = targetz + 110
  342.       IfXIsLessThanY
  343.         IfSitting
  344.           tmpx = tmpturn - selfturn
  345.           tmpy = 6000
  346.           IfXIsLessThanY
  347.             tmpy = 0 - 6000
  348.             IfXIsMoreThanY
  349.               PressLatchButton
  350.           tmpx = targetx
  351.           tmpy = targety
  352.         Else
  353.           SetTurnModeToWatchTarget
  354.           tmpx = tmpturn - selfturn
  355.           tmpy = 6000
  356.           IfXIsLessThanY
  357.             tmpy = 0 - 6000
  358.             IfXIsMoreThanY
  359.               PressLatchButton
  360.           tmpx = selfx
  361.           tmpy = selfy
  362.       Else
  363.         tmpx = rand & 255 - 128 + selfx
  364.         tmpy = rand & 255 - 128 + selfy
  365.     Else
  366.       IfHoldingMeleeWeapon
  367.         tmpx = targetdistance
  368.         tmpy = 200
  369.         IfSitting
  370.           tmpy = 400
  371.         IfXIsLessThanY
  372.           tmpx = tmpturn - selfturn
  373.           tmpy = 6000
  374.           IfXIsLessThanY
  375.             tmpy = 0 - 6000
  376.             IfXIsMoreThanY
  377.               PressLatchButton
  378.         Else
  379.           // Wave weapon around if not mounted
  380.           IfSitting
  381.             GetState
  382.           Else
  383.             tmpx = rand & 1023
  384.             tmpy = 800
  385.             IfXIsMoreThanY
  386.               // Is it caught in a trap?
  387.               tmpx = selfaccel
  388.               tmpy = 1
  389.               IfXIsMoreThanY
  390.                 // Nope, so cheer...
  391.                 tmpargument = ACTIONMC
  392.                 DoAction
  393.                 tmpdistance = rand & 2047 + 11000
  394.                 tmpargument = tmpdistance & 1
  395.                 PlaySound
  396.         tmpx = targetx
  397.         tmpy = targety
  398.         tmpdistance = 200
  399.         Compass
  400.       Else
  401.         // Find a weapon!!!
  402.         tmpx = rand & 255 - 128 + selfx
  403.         tmpy = rand & 255 - 128 + selfy
  404.     tmpargument = rand & 7 + 8
  405.   ClearWaypoints
  406.   AddWaypoint
  407.   SetTime
  408. Else
  409.   // Hide behind shield until timer runs out
  410.   IfStateIsParry
  411.     IfHoldingShield
  412.       PressLatchButton
  413.       IfTargetIsAttacking
  414.         tmpargument = 5
  415.         SetTime
  416.     Else
  417.       tmpargument = 0
  418.       SetTime
  419.  
  420.  
  421. //------------------------------------------------------------------------------
  422. End
  423. //------------------------------------------------------------------------------
  424.