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

  1. // ZZ> This function makes the character wanders around its enemy
  2. IfSpawned
  3.   EnchantTarget  // Target is self...
  4. IfKilled                // This reduces the height of the char
  5.   tmpargument = 0                //
  6.   SendMessageNear                //
  7.   tmpargument = 40              //
  8.   SetBumpSize                  //
  9.   tmpargument = 45              //
  10.   SetBumpHeight                  //
  11.   tmpargument = 65535              // Drop money
  12.   DropMoney                  //
  13.   tmpargument = 2              //
  14.   tmpdistance = rand & 2047 + 6000      //
  15.   PlaySound                  //
  16. IfAttacked                // Counter attack
  17.   SetTargetToWhoeverAttacked          //
  18.     IfTargetIsOnHatedTeam            //
  19.       tmpargument = 1                  // Enter combat mode
  20.       SetState                      //
  21.     Else                    //
  22.       SetTargetToOldTarget              //
  23.   tmpargument = rand & 1          //
  24.   tmpdistance = rand & 2047 + 6000      //
  25.   PlaySound                  //
  26. IfTargetKilled                // Return to follow mode
  27.   tmpargument = 0              //
  28.   SetState                  //
  29. IfBumped                // Attack whoever it bumped
  30.   SetTargetToWhoeverBumped          //
  31.   IfTargetIsOnHatedTeam              // Make sure it's an enemy
  32.     IfHoldingMeleeWeapon                    // Got Weapon?
  33.       PressLatchButton                  //
  34.   Else                      // Scooch around friendly
  35.     tmpx = rand & 255 + targetx - 128        //
  36.     tmpy = rand & 255 + targety - 128        //
  37.     ClearWaypoints                //
  38.     AddWaypoint                    //
  39.     SetTargetToOldTarget            //
  40. IfTimeOut                // This is done every so often
  41.   SetTargetToWideEnemy              // Look for enemies
  42.     tmpargument = 1                // Enter combat mode
  43.     SetState                    //
  44.   IfStateIs0                  // State 0 ( Wander )
  45.     GetContent
  46.     tmpx = tmpargument
  47.     tmpy = 0
  48.     IfXIsEqualToY
  49.       tmpx = rand & 1023 - 512 + selfx        //
  50.       tmpy = rand & 1023 - 512 + selfy        //
  51.     Else
  52.       // Guard starting area
  53.       tmpx = rand & 511 - 256 + selfspawnx
  54.       tmpy = rand & 511 - 256 + selfspawny
  55.   Else                      // State 1 ( Combat )
  56.     tmpx = targetdistance            // Too far?
  57.     tmpy = 1400                    //
  58.     IfXIsMoreThanY                //
  59.       tmpargument = 0
  60.       SetState                      // Revert to follow mode
  61.       tmpx = selfx
  62.       tmpy = selfy
  63.     Else
  64.       tmpy = 150
  65.       IfXIsLessThanY
  66.         // Run away
  67.         tmpx = targetx
  68.         tmpy = targety
  69.         tmpturn = targetturnto + 32768
  70.         tmpdistance = 800
  71.         Compass         
  72.       Else
  73.         tmpy = 0  // Unarmed...
  74.         IfHoldingMeleeWeapon              // Got Weapon?
  75.           tmpy = 350
  76.         Else
  77.           IfHoldingRangedWeapon
  78.             tmpy = 800
  79.         IfXIsLessThanY
  80.           tmpx = 800
  81.           IfXIsEqualToY
  82.             // Ranged weapon, so lead the target
  83.             tmpx = targetspeedx * tmpx > 4 + targetx
  84.             tmpy = targetspeedy * tmpx > 4 + targety
  85.             IfFacingTarget
  86.               PressLatchButton
  87.           Else
  88.             // Melee weapon, so run around the target...
  89.             tmpx = rand & 511 - 256 + targetx
  90.             tmpy = rand & 511 - 256 + targety
  91.             IfFacingTarget
  92.               PressLatchButton
  93.               tmpx = targetx
  94.               tmpy = targety
  95.         Else
  96.           // Not close enough, so run at the target
  97.           tmpx = targetx
  98.           tmpy = targety
  99.           tmpturn = targetturnto
  100.           tmpdistance = 400
  101.           Compass
  102.   ClearWaypoints              //
  103.   AddWaypoint                  //
  104.   tmpargument = rand & 15 + 10          // Wait a while and try again
  105.   SetTime                  //
  106. End                    // Finished with this character
  107.