home *** CD-ROM | disk | FTP | other *** search
/ Classic Fond 52 / ClassicFond52.iso / GAMES / DROIDW.RAR / DWCD.GOB / mission_cog_assassin.cog < prev    next >
Encoding:
Text File  |  1998-11-04  |  1.7 KB  |  97 lines

  1. # DroidWorks
  2. # Assassin droid AI file
  3. #
  4. # Copyright (c) 1998 Lucas Learning Ltd. All Rights Reserved
  5.  
  6. symbols
  7.  
  8. message    user6
  9. message    user7
  10. message    pulse
  11. message removed
  12. message killed
  13.  
  14. int        Assassin            local
  15. int        SoundChannel=-1        local
  16. int        EffectHandle=-1        local
  17. int        Attacking=0            local
  18. flex    Flash=0.0            local
  19.  
  20. end
  21.  
  22. # ========================================================================================
  23.  
  24. code
  25.  
  26. #user6 is sent when the attack starts
  27. user6:
  28.     if (Attacking == 0)
  29.     {
  30.         Attacking = 1;
  31.         Assassin = GetSenderRef();
  32.  
  33.         # Freeze the player
  34.         dwFreezePlayer();
  35.  
  36.         # Start the attack animation (mode 22 - attack)
  37.         PlayMode(Assassin, 22);
  38.  
  39.         # Start the attack sound (mode 69 - fire1)
  40.         SoundChannel = PlaySoundClass(Assassin, 69);
  41.  
  42.         # Start visual effect
  43.         SetPulse(0.01);
  44.     }
  45.     return;
  46.  
  47. #user7 is sent when the attack ends
  48. #also end the attack when assassin is killed or removed...
  49. killed:
  50. removed:
  51. user7:
  52.     if (Attacking == 1)
  53.     {
  54.         Attacking = 0;
  55.         Assassin = GetSenderRef();
  56.  
  57.         # Stop attack sound (quick fade out)
  58.         if (SoundChannel > -1)
  59.         {
  60.             StopSound(SoundChannel, 0.1);
  61.             SoundChannel = -1;
  62.         }
  63.  
  64.         # Stop attack animation (mode 1 - stand)
  65.         PlayMode(Assassin, 1);
  66.  
  67.         # Stop visual effect
  68.         SetPulse(0);
  69.         if (EffectHandle > -1)
  70.         {
  71.             FreeColorEffect(EffectHandle);
  72.             EffectHandle = -1;
  73.         }
  74.  
  75.         # Unfreeze the player
  76.         dwUnfreezePlayer();
  77.  
  78.         # Damage the player
  79.         DamageThing(GetLocalPlayerThing(), 15.0, 2, Assassin);
  80.     }
  81.     return;
  82.  
  83. pulse:
  84.     if (EffectHandle > -1)
  85.     {
  86.         FreeColorEffect(EffectHandle);
  87.         EffectHandle = -1;
  88.     }
  89.  
  90.     # Add 120-220 to intensities
  91.     Flash = rand() * 100 + 120;
  92.     EffectHandle = NewColorEffect(0, 0, 0, 0, 0, 0, Flash, Flash, Flash, 1.0);
  93.  
  94.     return;
  95.  
  96. end
  97.