home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 42 / CDGAMER42.iso / Egoboo / egoboo.exe / egoboo / modules / palshad.mod / objects / lumpkin.obj / script.txt < prev    next >
Text File  |  2000-06-04  |  10KB  |  384 lines

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