Egoboo Community Forum

The Legend of Egoboo Sporks of Yore
It is currently Mon Nov 20, 2017 11:47 am

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Zombi script
PostPosted: Sun Dec 07, 2008 10:11 pm 
Offline
Squirrel Knight (Administrator)
Squirrel Knight (Administrator)
User avatar

Joined: Wed Jul 23, 2008 1:27 am
Posts: 3818
Location: Norway
Here is yer zombi script ood:

Code:
//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


_________________
http://egoboo.sourceforge.net
Image

Coder


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Get Egoboo at SourceForge.net. Fast, secure and Free Open Source software downloads