home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 42 / CDGAMER42.iso / Egoboo / egoboo.exe / egoboo / modules / rogue.mod / objects / cobol.obj / script.txt < prev    next >
Text File  |  2000-06-24  |  18KB  |  711 lines

  1. IfSpawned
  2.   // Decide which weapon to use
  3.   IfHoldingRangedWeapon
  4.     tmpargument = 0
  5.     SetState
  6.   Else
  7.     tmpargument = 1
  8.     SetState
  9.   tmpargument = 2
  10.   IfArmorIs
  11.     // Sleeping
  12.     tmpargument = 8
  13.     SetState
  14.     tmpargument = rand & 63 + 32
  15.     SetTime
  16.     tmpargument = ACTIONMK
  17.     DoActionOverride
  18.     KeepAction
  19.   Else
  20.     tmpargument = 100
  21.     SetTime
  22.  
  23.  
  24. //------------------------------------------------------------------------------
  25. IfBumped
  26.   SetTargetToWhoeverBumped
  27.   IfStateIs8
  28.     IfTargetIsOnHatedTeam
  29.       // Bumping a sleeping Cobol...  How rude!
  30.       tmpargument = 8
  31.       tmpdistance = rand & 2047 + 13000
  32.       PlaySound
  33.  
  34.  
  35.       tmpargument = 4
  36.       SendMessageNear
  37.       tmpargument = ACTIONMJ
  38.       DoActionOverride
  39.       UnkeepAction
  40.       // Start combat
  41.       tmpargument = 2
  42.       IfHoldingMeleeWeapon
  43.         tmpargument = 5
  44.       SetState
  45.       tmpargument = 0
  46.       ChangeArmor
  47.       tmpargument = 15
  48.       SetTime
  49.   Else
  50.     // Jump over barriers, onto mounts
  51.     IfTargetIsAlive
  52.       IfTargetIsAPlatform
  53.         // Jump over some stuff
  54.         tmpargument = LATCHJUMP
  55.         PressLatchButton
  56.       IfTargetIsAMount
  57.         // Jump onto mounts
  58.         tmpx = targetx
  59.         tmpy = targety
  60.         ClearWaypoints
  61.         AddWaypoint
  62.  
  63.         tmpargument = 30
  64.         SetTime
  65.     Else
  66.       // Jump over corpses
  67.       tmpargument = LATCHJUMP
  68.       PressLatchButton
  69.     SetTargetToOldTarget
  70.  
  71.  
  72. //------------------------------------------------------------------------------
  73. IfStateIs7
  74.   // Blocking...  Need to keep that button pressed
  75.   IfTimeOut
  76.     // Revert to combat state
  77.     tmpargument = 5
  78.     SetState
  79.     // Attack now if possible
  80.     GetContent
  81.     tmpx = targetdistance
  82.     tmpy = tmpargument
  83.     IfXIsLessThanY
  84.       IfHoldingMeleeWeapon
  85.         PressLatchButton
  86.   Else
  87.     IfHoldingShield
  88.       PressLatchButton
  89.  
  90.  
  91. //------------------------------------------------------------------------------
  92. IfKilled
  93.   // Tell the players
  94.   tmpargument = 0
  95.   IfArmorIs
  96.     // A normal Cobol
  97.     tmpargument = rand & 2
  98.     ChangeArmor
  99.     tmpargument = 0
  100.     IfTargetIsOnSameTeam
  101.       tmpargument = 1
  102.     SendMessageNear
  103.   Else
  104.     tmpargument = 1
  105.     IfArmorIs
  106.       // A Cobol Captain
  107.       tmpargument = 2
  108.       IfTargetIsOnSameTeam
  109.         tmpargument = 3
  110.       SendMessageNear
  111.       // Give bonus points
  112.       tmpargument = 10
  113.       tmpdistance = EXPROLEPLAY
  114.       GiveExperienceToTarget
  115.  
  116.  
  117.  
  118.  
  119.   // Just to be sure
  120.   tmpargument = ACTIONKA
  121.   DoActionOverride
  122.   KeepAction
  123.  
  124.  
  125.   tmpargument = 1
  126.   tmpdistance = rand & 2047 + 13000
  127.   PlaySound
  128.  
  129.  
  130.   // Drop goodies
  131.   tmpargument = 65535
  132.   DropMoney
  133.  
  134.  
  135.   // Make the character body
  136.   tmpargument = 40
  137.   SetBumpHeight
  138.  
  139.  
  140.   // Make the next part not happen...
  141.   tmpargument = 50
  142.   SetTime
  143.  
  144.  
  145.  
  146. //------------------------------------------------------------------------------
  147. IfAttacked
  148.   SetTargetToWhoeverAttacked
  149.   IfStateIs8
  150.     // A sleeping Cobol
  151.     tmpargument = [DISA]
  152.     IfTargetHasSkillID
  153.       // This is what Rogues do best...
  154.       tmpargument = 5
  155.     Else
  156.       // Just a normal player
  157.       tmpargument = 6
  158.     SendMessageNear
  159.  
  160.  
  161.     // Give experience
  162.     tmpargument = 30
  163.     tmpdistance = EXPMURDER
  164.     GiveExperienceToTarget
  165.  
  166.  
  167.     // Do it
  168.     SetTargetToSelf
  169.     KillTarget
  170.   Else
  171.     IfTargetIsOnHatedTeam
  172.       // Counter attack
  173.       GetState
  174.       tmpargument = tmpargument & 1 + 4 // Preserve even/odd
  175.       SetState
  176.  
  177.       // Check for instant death
  178.       tmpargument = [DISA]
  179.       IfTargetHasSkillID
  180.         // Allow Rogues to backstab
  181.         GetDamageType
  182.         tmpx = tmpargument
  183.         tmpy = DAMAGEPOKE
  184.         IfXIsEqualToY
  185.           IfHitFromBehind
  186.             tmpargument = 8
  187.             SendMessageNear
  188.  
  189.             tmpargument = 30
  190.             tmpdistance = EXPMURDER
  191.             GiveExperienceToTarget
  192.  
  193.             // Do it
  194.             tmpargument = 2
  195.             ChangeArmor
  196.             SetTargetToSelf
  197.             KillTarget
  198.     Else
  199.       // Friendly fire, get out of the way
  200.       tmpx = rand & 511 - 256 + selfx
  201.       tmpy = rand & 511 - 256 + selfy
  202.       ClearWaypoints
  203.       AddWaypoint
  204.       SetTargetToOldTarget
  205.  
  206.  
  207.     // Tell everyone to charge
  208.     tmpargument = 5
  209.     IssueOrder
  210.  
  211.  
  212.     tmpargument = rand & 1 + 2
  213.     tmpdistance = rand & 2047 + 13000
  214.     PlaySound
  215.  
  216.  
  217.  
  218. //------------------------------------------------------------------------------
  219. IfTimeOut
  220.   // Check if the current target is alive or not
  221.   IfStateIs8
  222.     GetState // NOP
  223.   Else
  224.     IfTargetIsAlive
  225.       IfTargetIsOnHatedTeam
  226.         GetState // NOP
  227.       Else
  228.         // Revert to target acquisition state ( Invisible enemy? Dismount? )
  229.         GetState
  230.         tmpargument = tmpargument & 1  // Retain even/odd
  231.         SetState
  232.     Else
  233.       // Revert to target acquisition state
  234.       GetState
  235.       tmpargument = tmpargument & 1  // Retain even/odd
  236.       SetState
  237.  
  238.  
  239.   tmpargument = 100 // Default time...  Shouldn't be needed
  240.   IfSitting
  241.     // Riding some type of animal...
  242.     // Acquire a target
  243.     SetTurnModeToVelocity
  244.     SetTargetToNearestEnemy
  245.       // Charge towards enemy
  246.       tmpx = targetx
  247.       tmpy = targety
  248.       tmpturn = targetturnto
  249.       tmpdistance = 300
  250.       Compass
  251.       ClearWaypoints
  252.       AddWaypoint
  253.  
  254.  
  255.  
  256.       // Check for special mount attacks
  257.       tmpx = targetdistance
  258.       tmpy = 200
  259.       IfXIsLessThanY
  260.         tmpargument = [XFUN]
  261.         SetOldTarget
  262.         SetTargetToWhoeverIsHolding
  263.         IfTargetHasAnyID
  264.           tmpargument = LATCHRIGHT
  265.           PressLatchButton
  266.           SetTargetToOldTarget
  267.         Else
  268.           // Don't let the enemy jump over
  269.           SetTargetToOldTarget
  270.           tmpx = selfz
  271.           tmpy = targetz - 40
  272.           IfXIsLessThanY
  273.             IfHoldingMeleeWeapon
  274.               PressLatchButton
  275.  
  276.  
  277.       tmpargument = rand & 15 + 15 // TIme
  278.     Else
  279.       // Guard the start position
  280.       tmpx = rand & 511 - 256 + selfspawnx
  281.       tmpy = rand & 511 - 256 + selfspawny
  282.       ClearWaypoints
  283.       AddWaypoint
  284.       tmpargument = rand & 31 + 30 // TIme
  285.   Else
  286.     // Foot soldier...
  287.     // Behave according to state
  288.     IfStateIsOdd
  289.       // Odd states are for melee weapons
  290.       IfTargetIsAttacking
  291.         IfHoldingShield
  292.           // Is the enemy facing the character?
  293.           tmpturn = selfturn - targetturn
  294.           tmpx = tmpturn
  295.           tmpy = 24768
  296.           IfXIsMoreThanY
  297.             tmpy = 40768
  298.             IfXIsLessThanY
  299.               // Defend
  300.               PressLatchButton
  301.               tmpargument = 7
  302.               SetState
  303.  
  304.               // Tell everyone to attack while Cobol hides...  Coward
  305.               tmpargument = 5
  306.               IssueOrder
  307.               tmpargument = rand & 15 + 15 // Time
  308.       IfStateIs3
  309.         // Circle around the enemy
  310.         SetTurnModeToWatchTarget
  311.  
  312.  
  313.  
  314.         tmpx = targetx
  315.         tmpy = targety
  316.         SetTargetToNearestFriend
  317.           tmpdistance = 200
  318.           tmpturn = targetdistance
  319.           IfDistanceIsMoreThanTurn
  320.             // The friend is close, so move away
  321.             tmpturn = targetturnto + 32768
  322.             tmpdistance = 400
  323.             Compass
  324.             // Make it look better
  325.             tmpargument = ACTIONWB
  326.             DoAction
  327.           SetTargetToOldTarget
  328.         tmpturn = targetturnto + 32768
  329.         tmpdistance = 300
  330.         Compass
  331.         ClearWaypoints
  332.         AddWaypoint
  333.  
  334.  
  335.         // Randomly issue the battle cry
  336.         tmpx = rand & 1023
  337.         tmpy = 5
  338.         IfXIsLessThanY
  339.           tmpargument = 10
  340.           tmpdistance = rand & 2047 + 13000
  341.           PlaySound
  342.           tmpargument = 5
  343.           IssueOrder
  344.  
  345.  
  346.         // Issue the battle cry if there's a threat
  347.         tmpx = targetdistance
  348.         tmpy = 250
  349.         IfXIsLessThanY
  350.           tmpargument = 5
  351.           IssueOrder
  352.           IfHoldingMeleeWeapon
  353.             PressLatchButton
  354.  
  355.  
  356.         tmpargument = rand & 15 + 10 // Time
  357.       IfStateIs5
  358.         // Randomly issue the retreat order
  359.         tmpx = rand & 1023
  360.         tmpy = 20
  361.         IfXIsLessThanY
  362.           tmpargument = 9
  363.           tmpdistance = rand & 2047 + 13000
  364.           PlaySound
  365.           tmpargument = 3
  366.           IssueOrder
  367.  
  368.  
  369.  
  370.         // Charge and attack the enemy
  371.         GetContent  // Desired range
  372.         tmpx = targetdistance
  373.         tmpy = tmpargument
  374.         IfXIsLessThanY
  375.           // Close enough to attack
  376.           IfHoldingMeleeWeapon
  377.             PressLatchButton
  378.           // Circle up again
  379.           tmpx = targetx
  380.           tmpy = targety
  381.           tmpturn = targetturnto + 32768
  382.           tmpdistance = 600
  383.           Compass
  384.           ClearWaypoints
  385.           AddWaypoint
  386.           tmpargument = 3
  387.           SetState
  388.           tmpargument = rand & 15 + 40 // Time
  389.         Else
  390.           // Too far, so get closer
  391.           tmpx = targetx
  392.           tmpy = targety
  393.           tmpturn = targetturnto
  394.           IfHoldingMeleeWeapon
  395.             // 1 = left, 2 = right
  396.             tmpargument = tmpargument < 13   // 8192 or 16384
  397.             tmpturn = tmpturn + tmpargument - 12288
  398.           tmpdistance = 400
  399.           Compass
  400.           ClearWaypoints
  401.           AddWaypoint
  402.           tmpargument = rand & 15 + 8 // Time
  403.       IfStateIs1
  404.         // Rummage for a weapon
  405.         IfHoldingMeleeWeapon
  406.           // Acquire a target
  407.           SetTurnModeToVelocity
  408.           tmpdistance = 250000 // Square of distance to check
  409.           SetTargetToDistantEnemy
  410.             // Charge towards enemy
  411.             tmpx = targetx
  412.             tmpy = targety
  413.             ClearWaypoints
  414.             AddWaypoint
  415.  
  416.             // Next time, circle up
  417.             tmpargument = 3
  418.             SetState
  419.             tmpargument = 20 // Time
  420.           Else
  421.             // Guard the start position
  422.             tmpx = rand & 511 - 256 + selfspawnx
  423.             tmpy = rand & 511 - 256 + selfspawny
  424.             ClearWaypoints
  425.             AddWaypoint
  426.             tmpargument = rand & 15 + 30 // Time
  427.         Else
  428.           // Draw a new weapon
  429.           tmpargument = LATCHPACKRIGHT
  430.           PressLatchButton
  431.           tmpargument = 15 // Time
  432.     Else
  433.       // Even states are for ranged weapons...
  434.       IfStateIs8    // ...and sleeping
  435.         // Sleepy Z's
  436.         tmpx = selfx
  437.         tmpy = selfy
  438.         tmpdistance = selfz
  439.         tmpargument = 6
  440.         SpawnExactParticle
  441.  
  442.  
  443.         // Snore...
  444.         tmpargument = rand & 3 + 4
  445.         tmpdistance = rand & 2047 + 15000
  446.         PlaySound
  447.  
  448.  
  449.         tmpargument = ACTIONMK
  450.         DoAction
  451.         tmpdistance = 160000  // Distance to check
  452.         SetTargetToDistantEnemy
  453.           IfTargetIsSneaking
  454.             tmpargument = 100 // Time
  455.           Else
  456.             // Too Loud
  457.             // Too close...  Wake up
  458.             tmpargument = 8
  459.             tmpdistance = rand & 2047 + 13000
  460.             PlaySound
  461.  
  462.  
  463.             tmpargument = 4
  464.             SendMessageNear
  465.             tmpargument = ACTIONMJ
  466.             DoActionOverride
  467.             UnkeepAction
  468.             // Start combat
  469.             tmpargument = 2
  470.             IfHoldingMeleeWeapon
  471.               tmpargument = 5
  472.             SetState
  473.             tmpargument = 0
  474.             ChangeArmor
  475.             tmpargument = 30 // Time
  476.           Else
  477.             tmpargument = 100 // Time
  478.       IfStateIs6
  479.         // Decide whether to shoot again or not
  480.         tmpy = 120
  481.         tmpargument = 1
  482.         IfArmorIs
  483.           tmpy = 0 // Captains don't run away
  484.         GetContent
  485.         tmpx = targetdistance
  486.         IfXIsLessThanY
  487.           // Too close
  488.           tmpargument = 0
  489.           SetState
  490.         Else
  491.           // Fire again
  492.           tmpy = tmpargument + 200
  493.           IfXIsMoreThanY
  494.             // Enemy is too far
  495.             tmpargument = 0
  496.             SetState
  497.           Else
  498.             // Fire again
  499.             tmpargument = 4
  500.             SetState
  501.         // Time needn't be set here
  502.       IfStateIs4
  503.         // Fire at the enemy
  504.         tmpargument = 6
  505.         SetState
  506.  
  507.  
  508.         // Don't shoot if friends are too close
  509.         SetTargetToNearestFriend
  510.           tmpx = targetdistance
  511.           tmpy = 00
  512.           IfXIsLessThanY
  513.             // Keep distance from friends
  514.             tmpx = targetx
  515.             tmpy = targety
  516.             tmpturn = rand & 8191 + 28000 + targetturnto
  517.             tmpdistance = 300
  518.             Compass
  519.             ClearWaypoints
  520.             AddWaypoint
  521.           Else
  522.             // Safe to fire
  523.             SetTargetToOldTarget
  524.             IfHoldingRangedWeapon
  525.               SetTurnModeToWatchTarget
  526.               IfFacingTarget
  527.                 PressLatchButton
  528.             Else
  529. //              // Reload the weapon...
  530. //              SetOldTarget
  531. //              SetTargetToSelf
  532. //              tmpargument = [WOOD]
  533. //              RestockTargetAmmoIDAll
  534. //              SetTargetToOldTarget
  535.  
  536.  
  537.               // Draw a new weapon
  538.               DropWeapons
  539.               // Go to close range mode
  540.               tmpargument = 100
  541.               SetContent
  542.               // Now using melee weapons
  543.               tmpargument = 1
  544.               SetState
  545.         Else
  546.           // Safe to fire
  547.           IfHoldingRangedWeapon
  548.             IfFacingTarget
  549.               PressLatchButton
  550.           Else
  551. //            // Reload the weapon...
  552. //            SetOldTarget
  553. //            SetTargetToSelf
  554. //            tmpargument = [WOOD]
  555. //            RestockTargetAmmoIDAll
  556. //            SetTargetToOldTarget
  557.  
  558.  
  559.             // Draw a new weapon
  560.             DropWeapons
  561.             // Go to close range mode
  562.             tmpargument = 100
  563.             SetContent
  564.             // Now using melee weapons
  565.             tmpargument = 1
  566.             SetState
  567.  
  568.  
  569.  
  570.         tmpargument = rand & 7 + 10 // Time before next check
  571.       IfStateIs2
  572.         // Get into firing position
  573.         SetTurnModeToVelocity
  574.         tmpx = targetx
  575.         tmpy = targety
  576.  
  577.  
  578.         SetTargetToNearestFriend
  579.           tmpx = targetdistance
  580.           tmpy = 100
  581.           IfXIsLessThanY
  582.             // Keep distance from friends
  583.             tmpx = targetx
  584.             tmpy = targety
  585.             SetTargetToOldTarget
  586.           Else
  587.             SetTargetToOldTarget
  588.             tmpx = targetx
  589.             tmpy = targety
  590.         // Keep running away
  591.         tmpturn = xyturnto + 32768
  592.         GetContent
  593.         tmpdistance = tmpargument // Desired range
  594.         Compass
  595.         ClearWaypoints
  596.         AddWaypoint
  597.  
  598.  
  599.  
  600.         // Check distance to target
  601.         tmpx = targetx - selfx
  602.         tmpy = targety - selfy
  603.         tmpx = xydistance // Pythag thing...  targetdistance isn't as good
  604.         GetContent
  605.         tmpy = tmpargument - 300 // The desired range ( MIN )
  606.         tmpargument = rand & 15 + 15 // Default time
  607.         IfXIsMoreThanY
  608.           tmpy = tmpy + 600 // The desired range ( MAX )
  609.           IfXIsLessThanY
  610.             // Target is in range, so switch to fire state
  611.             tmpargument = 4
  612.             SetState
  613.             SetTurnModeToWatchTarget
  614.             tmpargument = 30 // Time before shooting
  615.       IfStateIs0
  616.         // Acquire a target
  617.         SetTurnModeToVelocity
  618.         SetTargetToNearestEnemy
  619.           // Move away from enemy
  620.           tmpx = targetx
  621.           tmpy = targety
  622.           tmpturn = targetturnto + 32768
  623.           tmpdistance = 650
  624.           Compass
  625.           ClearWaypoints
  626.           AddWaypoint
  627.  
  628.           // Go to position state
  629.           tmpargument = 2
  630.           SetState
  631.           tmpargument = 50 // Time
  632.         Else
  633.           // Guard the start position
  634.           tmpx = selfspawnx
  635.           tmpy = selfspawny
  636.           ClearWaypoints
  637.           AddWaypoint
  638.           tmpargument = rand & 15 + 30 // Time
  639.  
  640.  
  641.   // tmpargument is set above
  642.   SetTime
  643.  
  644.  
  645.  
  646. //------------------------------------------------------------------------------
  647. IfOrdered
  648.   // Someone said to wake up
  649.   IfStateIs8
  650.     tmpx = selforder
  651.     tmpy = [WAKE]
  652.     IfXIsEqualToY
  653.       // Always awaken
  654.       tmpx = 0
  655.     Else
  656.       // Check distance to enemy
  657.       tmpx = 9999
  658.       SetTargetToNearestEnemy
  659.         tmpx = targetdistance
  660.     tmpy = 800
  661.     IfXIsLessThanY
  662.       // Wake up
  663.       tmpargument = 8
  664.       tmpdistance = rand & 2047 + 13000
  665.       PlaySound
  666.  
  667.  
  668.       tmpargument = 4
  669.       SendMessageNear
  670.       tmpargument = ACTIONMJ
  671.       DoActionOverride
  672.       UnkeepAction
  673.       // Start combat
  674.       tmpargument = 2
  675.       IfHoldingMeleeWeapon
  676.         tmpargument = 5
  677.       SetState
  678.       tmpargument = 0
  679.       ChangeArmor
  680.       tmpargument = 15
  681.       SetTime
  682.   Else
  683.     // Ignore wake orders...
  684.     tmpx = selforder
  685.     tmpy = [WAKE]
  686.     IfXIsEqualToY
  687.       GetState  // NOP
  688.     Else
  689.       // Someone said to attack ( hand to hand )
  690.       IfStateIsOdd
  691.         IfStateIs3
  692.           tmpargument = 5
  693.           SetState
  694.         IfStateIs5
  695.           tmpargument = selforder
  696.           SetState
  697.           tmpargument = rand & 7
  698.           SetTime
  699.  
  700.  
  701. //------------------------------------------------------------------------------
  702. IfHealed
  703.   tmpargument = 7
  704.   SendMessageNear
  705.  
  706.  
  707.  
  708. //------------------------------------------------------------------------------
  709. End
  710. //------------------------------------------------------------------------------
  711.