Zombi script

The development of the game itself or new resources for it. Any new stuff you're working on would go here, as well as the discussion of in-development stuff.

Moderator: Developers

Post Reply
User avatar
Zefz
Squirrel Knight (Administrator)
Squirrel Knight (Administrator)
Posts: 3820
Joined: Wed Jul 23, 2008 1:27 am
Location: Norway
Contact:

Zombi script

Post by Zefz »

Here is yer zombi script ood:

Code: Select all

//Become someones pet
IfSpawned
  SetTargetToWhoeverIsHolding
    IfTargetIsAPlayer
      SetOwnerToTarget
      JoinTargetTeam
      MakeNameKnown

IfGrabbed
  IfNameIsKnown
    SetTargetToWhoeverIsHolding
    IfTargetIsAPlayer
      SetOldTarget
      SetTargetToOwner
      IfTargetIsOldTarget
        tmpargument = 5
      Else
        tmpargument = 6
      SendMessageNear
  Else
    SetTargetToWhoeverIsHolding
    IfTargetIsAPlayer
      SetOwnerToTarget
      JoinTargetTeam
      MakeNameKnown
      tmpargument = 3
      SendMessageNear
      tmpargument = 4
      SendMessageNear
  tmpx = 0
  tmpy = 1
  SetTargetToSelf
  SetTargetToTargetLeftHand
    tmpargument = 17
    SendMessageNear
    tmpx = 1
  SetTargetToSelf
  SetTargetToTargetRightHand
    tmpargument = 17
    SendMessageNear
    tmpx = 1
  IfXIsEqualToY
    DropItems
IfDropped
  SetTargetToSelf
  StopTargetMovement
  UnkeepAction
  tmpargument = 2
  SetState
 
// Give stats and such
IfUsed
  SetTargetToWhoeverIsHolding
  tmpargument = 25
  SetTargetReloadTime
  IfTargetIsAPlayer
    // =Cuddles=
    SetTargetToSelf
    tmpargument = 7
    SendMessageNear

    // Level
    tmpx = targetlevel
    tmpy = 2
    IfXIsMoreThanY
      tmpdistance = targetlevel + 1
      tmpargument = 11
    Else
      tmpargument = 8 + tmpx
    SendMessageNear

    // Stats
    tmpx = targetlife > 9
    tmpy = 2
    IfXIsMoreThanY
      tmpx = 3
    tmpargument = 12 + tmpx
    tmpx = selfstr > 8
    tmpy = selfwis > 8
    SendMessageNear

    // Stats
    tmpx = selfint > 8
    tmpy = selfdex > 8
    tmpdistance = targetexp
    tmpargument = 16
    SendMessageNear

//Death stuff
IfKilled
  IfNameIsKnown
    SetOldTarget
    SetTargetToOwner
    IfTargetIsAlive
      tmpargument = 0
      SendMessageNear
    SetTargetToOldTarget
  Else
    tmpargument = 1
    SendMessageNear
  tmpargument = 30           // Dead height
  SetBumpHeight              //

//Ouch
IfAttacked
  SetTargetToWhoeverAttacked
  IfTargetIsOnSameTeam
    tmpargument = 3
  Else
    tmpargument = 4
  PlaySound

//Use shield and attack
IfTargetIsOnHatedTeam
  IfFacingTarget
    tmpx = targetdistance
    tmpy = 130
    IfXIsLessThanY
      IfHoldingMeleeWeapon
        PressLatchButton
      IfTargetIsAttacking
        IfHoldingShield
          PressLatchButton
         
//Main AI loop
IfTimeOut
  tmpargument = rand & 31 + 15
  SetTime
  IfHeld
    DoNothing
  Else
    //Follow boss
    IfStateIs0
      SetTurnModeToVelocity
      SetTargetToNearbyEnemy
        tmpargument = [LOCK]
        IfTargetHasID         //Dont attack lurking mimics
          GetTargetState
          tmpx = tmpargument
          tmpy = 1
          IfXIsEqualToY       //Its moving! Attack!
            tmpargument = 1
            SetState
          Else                //We know nothin..
            tmpx = ownerx
            tmpy = ownery
            ClearWaypoints
            AddWaypoint
        Else                  //It's not a mimic - Charge!
          tmpargument = 1
          SetState   
      Else
        tmpx = ownerdistance
        tmpy = 375
        IfXIsLessThanY                          //follow the boss
          tmpx = rand & 511 + selfx - 256
          tmpy = rand & 511 + selfy - 256
        Else
          tmpx = ownerx                 //catch up quickly
          tmpy = ownery
          tmpdistance = 1500
          tmpturn = ownerturnto
          Compass
        ClearWaypoints
        AddWaypoint
     
    //Combat
    IfStateIs1
      tmpx = ownerdistance
      tmpy = 800
      IfXIsLessThanY                //Follow boss if he is far away
        SetTargetToWideEnemy
          tmpx = targetx
          tmpy = targety
          tmpdistance = 1500
          tmpturn = targetturnto
          ClearWaypoints
          AddWaypoint
        Else
          tmpargument = 0
          SetState                  //No enemies around anymore
      Else
        tmpx = ownerx
        tmpy = ownery
        tmpdistance = 1500
        tmpturn = ownerturnto
        Compass
        ClearWaypoints
        AddWaypoint                     //Return to leader
        tmpargument = 0
        SetState

  //Get a shield if possible
  IfHoldingShield
    DoNothing
  Else
    tmpargument = 0
    SetXY                 //Remember waypoint if fails
    tmpdistance = 8       //Items
    tmpargument = [SHIE]
    SetTargetToWideBlahID
      tmpx = targetdistance
      tmpy = 75
      IfXIsLessThanY
        tmpargument = LATCHALTLEFT
        PressLatchButton
      tmpx = targetx
      tmpy = targety
    Else
      tmpargument = 0
      GetXY                   //Get the previous waypoint, we failed
    ClearWaypoints
    AddWaypoint
   
  //First priority is to find a weapon
  IfHoldingMeleeWeapon
    DoNothing
  Else
    tmpargument = 0
    SetXY                 //Store previous waypoint if fails
    tmpx = 0
    tmpdistance = 8           //Items
    tmpargument = [KNIF]
    SetTargetToWideBlahID
      tmpx = 1
    tmpargument = [HAMM]
    SetTargetToWideBlahID
      tmpx = 1
    tmpargument = [SPEA]
    SetTargetToWideBlahID
      tmpx = 1
    tmpargument = [TORC]
    SetTargetToWideBlahID
      tmpx = 1
    tmpargument = [AXEE]
    SetTargetToWideBlahID
      tmpx = 1
    tmpargument = [WHIP]
    SetTargetToWideBlahID
      tmpx = 1
    tmpargument = [MACE]
    SetTargetToWideBlahID
      tmpx = 1
    tmpargument = [POLE]
    SetTargetToWideBlahID
      tmpx = 1
    tmpargument = [SWOR]
    SetTargetToWideBlahID
      tmpx = 1
    tmpargument = [DAGG]
    SetTargetToWideBlahID
      tmpx = 1
    //Found something?
    tmpy = 1
    IfXIsEqualToY
      tmpx = targetdistance
      tmpy = 75
      IfXIsLessThanY
        tmpargument = LATCHALTRIGHT
        PressLatchButton
      tmpx = targetx            //Move towards it
      tmpy = targety
    Else
      tmpargument = 0         //Get the previous stored waypoint if failed
      GetXY
         
    ClearWaypoints
    AddWaypoint
     

End

Post Reply