home *** CD-ROM | disk | FTP | other *** search
- # DroidWorks
- # Assassin droid AI file
- #
- # Copyright (c) 1998 Lucas Learning Ltd. All Rights Reserved
-
- symbols
-
- message user6
- message user7
- message pulse
- message removed
- message killed
-
- int Assassin local
- int SoundChannel=-1 local
- int EffectHandle=-1 local
- int Attacking=0 local
- flex Flash=0.0 local
-
- end
-
- # ========================================================================================
-
- code
-
- #user6 is sent when the attack starts
- user6:
- if (Attacking == 0)
- {
- Attacking = 1;
- Assassin = GetSenderRef();
-
- # Freeze the player
- dwFreezePlayer();
-
- # Start the attack animation (mode 22 - attack)
- PlayMode(Assassin, 22);
-
- # Start the attack sound (mode 69 - fire1)
- SoundChannel = PlaySoundClass(Assassin, 69);
-
- # Start visual effect
- SetPulse(0.01);
- }
- return;
-
- #user7 is sent when the attack ends
- #also end the attack when assassin is killed or removed...
- killed:
- removed:
- user7:
- if (Attacking == 1)
- {
- Attacking = 0;
- Assassin = GetSenderRef();
-
- # Stop attack sound (quick fade out)
- if (SoundChannel > -1)
- {
- StopSound(SoundChannel, 0.1);
- SoundChannel = -1;
- }
-
- # Stop attack animation (mode 1 - stand)
- PlayMode(Assassin, 1);
-
- # Stop visual effect
- SetPulse(0);
- if (EffectHandle > -1)
- {
- FreeColorEffect(EffectHandle);
- EffectHandle = -1;
- }
-
- # Unfreeze the player
- dwUnfreezePlayer();
-
- # Damage the player
- DamageThing(GetLocalPlayerThing(), 15.0, 2, Assassin);
- }
- return;
-
- pulse:
- if (EffectHandle > -1)
- {
- FreeColorEffect(EffectHandle);
- EffectHandle = -1;
- }
-
- # Add 120-220 to intensities
- Flash = rand() * 100 + 120;
- EffectHandle = NewColorEffect(0, 0, 0, 0, 0, 0, Flash, Flash, Flash, 1.0);
-
- return;
-
- end
-