// Locates people
//  spawns yeow.obj when they fall in lava
//  and brings meteors crashing down

IfSpawned
  IfStateIs1
    JoinNullTeam
    tmpargument = 5
    SetTime
    tmpargument = rand & 255 + 128
    SetContent

IfHitGround
  IfStateIs0
    SetTargetToNearestFriend
      SetOwnerToTarget
      EnchantTarget
    Else
      tmpargument = 53 //Firehopper
      tmpx = selfx
      tmpy = selfy
      tmpdistance = selfz + 10
      tmpturn = selfturn
      SpawnExactCharacterXYZ
    GetContent
    IssueOrder
    ShowMap
    GoPoof

IfStateIs1
  IfOrdered
    SetOldTarget
    SetTargetToSelf
    tmpargument = selforder < 8
    GiveLifeToTarget
    SetTargetToOldTarget
  //draw a blip
  tmpx = selfx
  tmpy = selfy
  tmpargument = selflife > 8
  ShowBlipXY
  //handles falling into lava...
  GetWaterLevel
  tmpy = tmpargument + 51440
  tmpx = selfz < 2 + selfz < 1 //Long-way multiply by 10
  IfXIsLessThanY
    IfTimeOut
      tmpx = selfx
      tmpy = selfy
      tmpdistance = selfz + 2
      tmpturn = selfturn
      tmpargument = 37 //spawn yeow.obj
      SpawnExactCharacterXYZ
      tmpargument = 25
      SetTime
  //handles meteor falling
  tmpargument = 0
  IfContentIs
    tmpargument = 39 //spawn meteor.obj
    tmpx = rand & 256 + selfx - 256
    tmpx = rand & 256 + tmpx	//lessen the randomness
    tmpy = rand & 256 + selfy - 256
    tmpy = rand & 256 + tmpy	//lessen the randomness
    tmpdistance = selfz + 600
    tmpturn = rand & 65535
    SpawnExactCharacterXYZ
    tmpargument = rand & 127 + 192
    SetContent
  GetContent
  tmpargument = tmpargument - 1
  SetContent

IfKilled
  GoPoof

End
