Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 |
//============================================================================= // VolatileWeapon. - Your active weapon discharges when you are killed. // Steve Sinclair, Digital Extremes, Jan 4, 2000 (Updated Sept 5,2000) //============================================================================= class VolatileWeapon expands Mutator; var int mMaxDischarges; function ScoreKill(Pawn Killer, Pawn Other) { local Weapon w; local int ammo_count; local int num_shots; local int i; local Vector vec; local Rotator rot; local float rand; rand = FRand(); // get a random number 0.0 - 1.0 if (Other.Weapon != None) // if victim has a weapon { // we will be 'activating' the weapon through a base class reference // this is good because we don't require any specific knowledge of the actual object w = Other.Weapon; if ( w.AmmoType != None ) // has ammo? { ammo_count = w.AmmoType.AmmoAmount; if (ammo_count > mMaxDischarges) // cap the number of discharges ammo_count = 15; num_shots = ammo_count * ( rand + 0.3); for (i=0; i<num_shots; i++) { if ( w.bInstantHit ) { // instant hit weapons use 'TraceFire' ... 2.0 is amount of accuracy 'error' w.TraceFire(2.0); } else { // fire projectile in random direction rot = RotRand(); Instigator = Killer; Spawn(w.ProjectileClass,Killer,, Other.Location, rot ); } } Other.Weapon = None; // remove the weapon } } // call the next mutator if ( NextMutator != None ) NextMutator.ScoreKill(Killer, Other); } defaultproperties { mMaxDischarges=15 } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |