home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 42 / CDGAMER42.iso / Egoboo / egoboo.exe / egoboo / modules / rogue.mod / objects / pchest.obj / script.txt < prev    next >
Text File  |  2000-05-25  |  5KB  |  220 lines

  1. // Someone cast an unlock spell
  2. IfOrdered
  3.   tmpx = selforder
  4.   tmpy = 491  // The unique code for an unlock order
  5.   IfXIsEqualToY
  6.     // Is it closed?
  7.     tmpargument = 0
  8.     IfStateIs
  9.       // Open it up
  10.       tmpargument = ACTIONMG
  11.       DoAction
  12.         tmpargument = 1
  13.         SetState
  14.         tmpargument = 60
  15.         SetBumpHeight
  16.         KeepAction
  17.         // Spawn the trap particles
  18.         SpawnPoof
  19.         tmpargument = 1
  20.         tmpdistance = 11025
  21.         PlaySound
  22.         // Wait a while
  23.         tmpargument = 40
  24.         SetTime
  25.         // Tell the players...
  26.         tmpargument = 3
  27.         SendMessageNear
  28.  
  29.  
  30. // Someone is trying to open it
  31. IfBumped
  32.   // Can they open the chest?
  33.   SetTargetToWhoeverBumped
  34.   IfTargetCanOpenStuff
  35.  
  36.  
  37.     // Is it closed?
  38.     tmpargument = 0
  39.     IfStateIs
  40.  
  41.  
  42.       // Are they in front?
  43.       IfFacingTarget
  44.  
  45.  
  46.         // Make target crouch
  47.         tmpargument = ACTIONMG
  48.         TargetDoAction
  49.  
  50.  
  51.  
  52.         // Open it up
  53.         tmpargument = ACTIONMG
  54.         DoAction
  55.           tmpargument = 1
  56.           SetState
  57.           tmpargument = 60
  58.           SetBumpHeight
  59.           KeepAction
  60.           // Check for disarm skill
  61.           tmpx = 0
  62.           tmpy = 8192  // 50% chance at 16 Dex
  63.           tmpargument = [DISA]
  64.           IfTargetHasSkillID
  65.             tmpx = rand & 8191 + targetdex
  66.           IfXIsLessThanY
  67.             // Trap sprung
  68.             SpawnPoof
  69.             tmpargument = 1
  70.             tmpdistance = 11025
  71.             PlaySound
  72.             tmpargument = 5
  73.             SendMessageNear
  74.             tmpargument = 5
  75.             tmpdistance = EXPDARE
  76.             GiveExperienceToTarget
  77.           Else
  78.             // Disarmed trap
  79.             tmpargument = 0
  80.             tmpdistance = 11025
  81.             PlaySound
  82.             tmpargument = 4
  83.             SendMessageNear
  84.             tmpargument = 25
  85.             tmpdistance = EXPROLEPLAY
  86.             GiveExperienceToTarget
  87.           // Wait a while
  88.           tmpargument = 40
  89.           SetTime
  90.     Else
  91.       // Wait before allowing a swap
  92.       IfTimeOut
  93.         // Reset the timer
  94.         tmpargument = 40
  95.         SetTime
  96.  
  97.  
  98.         // Make target crouch
  99.         tmpargument = ACTIONMG
  100.         TargetDoAction
  101.  
  102.  
  103.  
  104.  
  105.         // Say it's empty...  Or check for false bottom
  106.         IfStateIs2
  107.           // Say the chest is empty...
  108.           tmpargument = 0
  109.           SendMessageNear
  110.           // Content... 0 is normal chest, 2 is false bottom
  111.           GetContent
  112.           tmpargument = tmpargument & 2
  113.           SetState
  114.           IfStateIs2
  115.             // It has a false bottom
  116.             tmpargument = [DISA]
  117.             IfTargetHasSkillID
  118.               // Character easily finds the false bottom
  119.               tmpargument = 1
  120.               SendMessageNear
  121.  
  122.  
  123.               // Give some experience
  124.               tmpargument = 15
  125.               tmpdistance = EXPROLEPLAY
  126.               GiveExperienceToTarget
  127.  
  128.  
  129.               // Figure out what to drop...  Opposite of first drop
  130.               GetContent
  131.               tmpargument = tmpargument & 1
  132.               SetState
  133.               IfStateIs0
  134.                 DropItems
  135.               Else
  136.                 tmpargument = selfmoney
  137.                 DropMoney
  138.  
  139.  
  140.  
  141.               // No more false bottom
  142.               tmpargument = 0
  143.               SetContent
  144.               tmpargument = 2
  145.               SetState
  146.             Else
  147.               // Check wisdom until it is found
  148.               tmpx = targetwis
  149.               tmpy = rand & 4095 + 3584  // Need between 14 and 30 wisdom
  150.               tmpy = rand & 4095  // Need between 0 and 16 wisdom
  151.               IfXIsMoreThanY
  152.                 // Character finds the false bottom
  153.                 tmpargument = 1
  154.                 SendMessageNear
  155.  
  156.  
  157.                 // Give some experience
  158.                 tmpargument = 15
  159.                 tmpdistance = EXPSECRET
  160.                 GiveExperienceToTarget
  161.  
  162.  
  163.                 // Figure out what to drop...  Opposite of first drop
  164.                 GetContent
  165.                 tmpargument = tmpargument & 1
  166.                 SetState
  167.                 IfStateIs0
  168.                   DropItems
  169.                 Else
  170.                   tmpargument = selfmoney
  171.                   DropMoney
  172.  
  173.  
  174.  
  175.                 // No more false bottom
  176.                 tmpargument = 0
  177.                 SetContent
  178.                 tmpargument = 2
  179.                 SetState
  180.           IfStateIs0
  181.             // No false bottom
  182.             tmpargument = 2
  183.             SetState
  184.  
  185.  
  186.  
  187.  
  188.         // Drop the contents
  189.         IfStateIs1
  190.           // Content...  0 is money, 1 is items
  191.           GetContent
  192.           tmpargument = tmpargument & 1
  193.           SetState
  194.           IfStateIs0
  195.             tmpx = selfmoney
  196.             tmpy = 0
  197.             IfXIsMoreThanY
  198.               // Drop the money
  199.               tmpargument = selfmoney
  200.               DropMoney
  201.               tmpargument = 2
  202.               SendMessageNear
  203.             Else
  204.               // No money in a money chest...
  205.               tmpargument = 0
  206.               SendMessageNear
  207.           Else
  208.             // Found some items
  209.             DropItems
  210.             tmpargument = 2
  211.             SendMessageNear
  212.           tmpargument = 2
  213.           SetState
  214.  
  215.  
  216.  
  217.  
  218. // All done
  219. End
  220.