home *** CD-ROM | disk | FTP | other *** search
- // ZZ> This function makes the character wanders around its enemy
- IfCleanedUp // Respawn
- RespawnCharacter //
- IfKilled // This reduces the height of the char
- tmpargument = 0 //
- SendMessageNear //
- tmpargument = 40 //
- SetBumpSize //
- tmpargument = 45 //
- SetBumpHeight //
- tmpargument = 65535 // Drop money
- DropMoney //
- tmpargument = 2 //
- tmpdistance = rand & 4095 + 8000 //
- PlaySound //
- IfAttacked // Counter attack
- SetTargetToWhoeverAttacked //
- IfTargetIsOnHatedTeam //
- BecomeLeader //
- tmpargument = 1 // Enter combat mode
- SetState //
- Else //
- SetTargetToOldTarget //
- tmpargument = rand & 1 //
- tmpdistance = rand & 4095 + 8000 //
- PlaySound //
- IfTargetKilled // Return to follow mode
- tmpargument = 0 //
- SetState //
- IfBumped // Attack whoever it bumped
- SetTargetToWhoeverBumped //
- IfTargetIsOnHatedTeam // Make sure it's an enemy
- IfHoldingMeleeWeapon // Got Weapon?
- PressLatchButton //
- Else // Scooch around friendly
- tmpx = rand & 255 + targetx - 128 //
- tmpy = rand & 255 + targety - 128 //
- ClearWaypoints //
- AddWaypoint //
- SetTargetToOldTarget //
- IfTimeOut // This is done every so often
- SetTargetToNearbyEnemy // Look for enemies
- tmpargument = 1 // Enter combat mode
- SetState //
- BecomeLeader //
- tmpx = rand & 255 //
- tmpy = 25 //
- IfXIsLessThanY // Play a random grunt?
- tmpargument = 3 //
- tmpdistance = rand & 4095 + 9000 //
- PlaySound //
- IfStateIs0 // State 0 ( Follow )
- tmpx = rand & 1023 - 512 + leaderx //
- tmpy = rand & 1023 - 512 + leadery //
- Else // State 1 ( Combat )
- tmpx = targetdistance // Too far?
- tmpy = 2000 //
- IfXIsMoreThanY //
- tmpargument = 0
- SetState // Revert to follow mode
- tmpx = selfx
- tmpy = selfy
- Else
- tmpy = 150
- IfXIsLessThanY
- // Run away
- tmpx = targetx
- tmpy = targety
- tmpturn = targetturnto + 32768
- tmpdistance = 800
- Compass
- Else
- tmpy = 0 // Unarmed...
- IfHoldingMeleeWeapon // Got Weapon?
- tmpy = 350
- Else
- IfHoldingRangedWeapon
- tmpy = 800
- IfXIsLessThanY
- tmpx = 800
- IfXIsEqualToY
- // Ranged weapon, so lead the target
- tmpx = targetspeedx * tmpx > 4 + targetx
- tmpy = targetspeedy * tmpx > 4 + targety
- IfFacingTarget
- PressLatchButton
- Else
- // Melee weapon, so run around the target...
- tmpx = rand & 511 - 256 + targetx
- tmpy = rand & 511 - 256 + targety
- IfFacingTarget
- PressLatchButton
- tmpx = targetx
- tmpy = targety
- Else
- // Not close enough, so run at the target
- tmpx = targetx
- tmpy = targety
- tmpturn = targetturnto
- tmpdistance = 400
- Compass
- ClearWaypoints //
- AddWaypoint //
- tmpargument = rand & 15 + 10 // Wait a while and try again
- SetTime //
- End // Finished with this character
-