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 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 00116 00117 00118 00119 00120 00121 00122 00123 00124 00125 00126 00127 00128 00129 00130 00131 00132 00133 00134 00135 00136 00137 00138 00139 00140 00141 00142 00143 00144 00145 00146 00147 00148 00149 00150 00151 00152 00153 00154 00155 00156 00157 00158 00159 00160 00161 00162 00163 00164 00165 00166 00167 00168 00169 00170 00171 00172 00173 00174 00175 00176 00177 00178 00179 00180 00181 00182 00183 00184 00185 00186 00187 00188 00189 00190 00191 00192 |
class ArtifactMonsterSummon extends RPGArtifact; var MutUT2004RPG RPGMut; var array<class<Monster> > MonsterList; // FIXME: obsolete, remove var class<Monster> ChosenMonster; var float AdrenalineUsed; var array<Monster> SummonedMonsters; var int MaxMonsters; var localized string TooManyMonstersMessage; static function bool ArtifactIsAllowed(GameInfo Game) { //make sure invasion monsters get loaded if (DynamicLoadObject("SkaarjPack.Invasion", class'Class', true) == None) return false; return true; } function PostBeginPlay() { Super.PostBeginPlay(); RPGMut = class'MutUT2004RPG'.static.GetRPGMutator(Level.Game); RPGMut.FillMonsterList(); } function BotConsider() { if (bActive) return; if ( Instigator.Health + Instigator.ShieldStrength < 100 && Instigator.Controller.Enemy != None && Instigator.Controller.Adrenaline > 2 * CostPerSec && FRand() < 0.15 && NoArtifactsActive() ) Activate(); } function Activate() { local int i; if (bActive) { Super.Activate(); return; } for (i = 0; i < SummonedMonsters.length; i++) if (SummonedMonsters[i] == None || SummonedMonsters[i].Health <= 0) { SummonedMonsters.Remove(i, 1); i--; } if (SummonedMonsters.length < MaxMonsters) Super.Activate(); else if (Instigator != None) Instigator.ReceiveLocalizedMessage(MessageClass, 2, None, None, Class); } static function string GetLocalString(optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2) { if (Switch == 2) return Default.TooManyMonstersMessage; return Super.GetLocalString(Switch, RelatedPRI_1, RelatedPRI_2); } function DoEffect(); state Activated { function BeginState() { local int x, Count; do { x = Rand(RPGMut.MonsterList.length); Count++; } until (Instigator.Controller.Adrenaline >= RPGMut.MonsterList[x].default.ScoringValue * 10 || Count > 10000) if (Count > 10000) { GotoState(''); return; } ChosenMonster = RPGMut.MonsterList[x]; bActive = true; AdrenalineUsed = ChosenMonster.default.ScoringValue * 10; } simulated function Tick(float deltaTime) { local float Cost; Cost = FMin(AdrenalineUsed, deltaTime * CostPerSec); AdrenalineUsed -= Cost; if (AdrenalineUsed <= 0.f) { //take the last bit of adrenaline from the player //add a tiny bit extra to fix float precision issues Instigator.Controller.Adrenaline -= Cost - 0.001; DoEffect(); } else { Global.Tick(deltaTime); } } function DoEffect() { local NavigationPoint N, BestDest; local float Dist, BestDist; local vector SpawnLocation; local rotator SpawnRotation; local FriendlyMonsterController C; local Monster P; local Inventory Inv; local RPGStatsInv StatsInv; local int x; BestDist = 50000.f; for (N = Level.NavigationPointList; N != None; N = N.NextNavigationPoint) { Dist = VSize(N.Location - Instigator.Location); if (Dist < BestDist && Dist > ChosenMonster.default.CollisionRadius * 2) { BestDest = N; BestDist = VSize(N.Location - Instigator.Location); } } if (BestDest != None) SpawnLocation = BestDest.Location + (ChosenMonster.default.CollisionHeight - BestDest.CollisionHeight) * vect(0,0,1); else SpawnLocation = Instigator.Location + ChosenMonster.default.CollisionHeight * vect(0,0,1.5); SpawnRotation.Yaw = rotator(SpawnLocation - Instigator.Location).Yaw; P = spawn(ChosenMonster,,, SpawnLocation, SpawnRotation); if (P == None) { //try again later return; } if (P.Controller != None) P.Controller.Destroy(); C = spawn(class'FriendlyMonsterController',,, SpawnLocation, SpawnRotation); C.Possess(P); C.SetMaster(Instigator.Controller); //allow Instigator's abilities to affect the monster for (Inv = Instigator.Controller.Inventory; Inv != None; Inv = Inv.Inventory) { StatsInv = RPGStatsInv(Inv); if (StatsInv != None) break; } if (StatsInv == None) //fallback, should never happen StatsInv = RPGStatsInv(Instigator.FindInventoryType(class'RPGStatsInv')); if (StatsInv != None) { C.Pawn.Health += StatsInv.Data.HealthBonus; C.Pawn.HealthMax += StatsInv.Data.HealthBonus; for (x = 0; x < StatsInv.Data.Abilities.length; x++) StatsInv.Data.Abilities[x].static.ModifyPawn(P, StatsInv.Data.AbilityLevels[x]); if (C.Inventory == None) C.Inventory = StatsInv; else { for (Inv = C.Inventory; Inv.Inventory != None; Inv = Inv.Inventory) {} Inv.Inventory = StatsInv; } } SummonedMonsters[SummonedMonsters.length] = P; GotoState(''); } } defaultproperties { CostPerSec=25 MinActivationTime=0.25 ItemName="Summoning Charm" PickupClass=class'ArtifactMonsterSummonPickup' IconMaterial=Material'UTRPGTextures.Icons.SummoningCharmIcon' MaxMonsters=4 TooManyMonstersMessage="The Summoning Charm cannot support any more monsters in this world." } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |