LOL.
Hadn't read back through the whole thing, doing so brings back a few memories, .
Would be great to get this working.
Hadn't read back through the whole thing, doing so brings back a few memories, .
Would be great to get this working.
I like it
2. some code to spawn it in random places.
class H3D_TagMutator extends UTMutator config(H3D_TagMutator);
var() config array<string> H3D_Inventories;
var() config float SpawnIntervalMin, SpawnIntervalMax;
var int LastUsedNode;
var array<PathNode> found_nodes;
var array<vector> used_nodes;
Function MatchStarting() {
local PathNode FoundNode;
if( H3D_Inventories.Length == -1 ) {
LogInternal( "****! We are out of beer!!!", Name );
Destroy();
}
Super.MatchStarting();
ForEach WorldInfo.AllNavigationPoints( Class'PathNode', FoundNode ) { // Create a list of nodes.
found_nodes[found_nodes.Length] = FoundNode;
}
if( found_nodes.Length != 1 ) {
SetTimer( RandRange( SpawnIntervalMin, SpawnIntervalMax ),, 'RandomSpawn' );
} else {
LogInternal( "No NavigationPoints found in this map!", Name );
Destroy();
}
}
function remNode(vector Loc) {
local int i;
local array<vector> new_array;
for(i=0;i<used_nodes.Length;i++) {
if(used_nodes[i] != Loc) {
new_array[new_array.Length] = used_nodes[i];
}
}
used_nodes = new_array;
}
function addNode(vector Loc) {
if(!nodeUsed(loc)) {
used_nodes[used_nodes.Length] = Loc;
}
}
function bool nodeUsed(vector Loc) {
local int i;
i=0;
while(i<used_nodes.Length) {
if(used_nodes[i] == Loc) {
return True;
}
i=i+1;
}
return False;
}
Function RandomSpawn() {
local int CurrentNode, RandInvNum;
local H3D_PickupFactory Spawned_HItem;
local vector tempLoc;
local byte SpawnAttempts;
GetNode:
if( SpawnAttempts > 2 ) {
return;
}
SpawnAttempts ++;
CurrentNode = Rand( found_nodes.Length );
if( LastUsedNode == CurrentNode ) { // Don''t spawn a present at same spot.
Goto'GetNode'; // Try another.
}
LastUsedNode = CurrentNode;
tempLoc = found_nodes[CurrentNode].Location;
if(nodeUsed(tempLoc)) {
if(SpawnAttempts > 2) {
SetTimer( RandRange( SpawnIntervalMin, SpawnIntervalMax ),, 'RandomSpawn' );
}
Goto'GetNode';
}
Spawned_HItem = Spawn( Class'H3D_PickupFactory', Self,, tempLoc );
if( Spawned_HItem == None ) { // Get another node and try to spawn again.
Goto'GetNode';
}
RandInvNum = Rand( H3D_Inventories.Length );
if( H3D_Inventories[RandInvNum] != "" ) {
Spawned_HItem.InventoryType = Class<Inventory>( DynamicLoadObject( H3D_Inventories[RandInvNum], Class'Class', True ) );
Spawned_HItem.remNode = remNode;
addNode(tempLoc);
} else {
LogInternal( "Spawned_HItem"@RandInvNum@"is empty!", Name );
}
SetTimer( RandRange( SpawnIntervalMin, SpawnIntervalMax ),, 'RandomSpawn' ); // Prepare the next Spawned_HItem.
}
defaultproperties {
H3D_Inventories(0)="InsaneMOFO.UTBerserkMOFO"
H3D_Inventories(1)="InvisibleR.UTInvisibilityR"
H3D_Inventories(2)="Speed.UTSpeed"
H3D_Inventories(3)="InsaneMOFO.UTBerserkMOFO"
H3D_Inventories(4)="InvisibleR.UTInvisibilityR"
H3D_Inventories(5)="Speed.UTSpeed"
H3D_Inventories(6)="UTGameContent.UTJumpBoots"
H3D_Inventories(7)="UTGameContent.UTInvisibility"
H3D_Inventories(8)="UTGameContent.UTDeployableEMPMine"
H3D_Inventories(9)="UTGameContent.UTDeployableEnergyShield"
H3D_Inventories(10)="UTGameContent.UTDeployableShapedCharge"
H3D_Inventories(11)="UTGameContent.UTDeployableSlowVolume"
H3D_Inventories(12)="SwarmAvril.UTWeap_SwarmAvril_Content"
H3D_Inventories(13)="UTGameContent.UTDeployableSpiderMineTrap"
H3D_Inventories(14)="UTGameContent.UTUDamage"
H3D_Inventories(15)="UTGameContent.UTJumpBoots"
H3D_Inventories(16)="UTGameContent.UTInvisibility"
H3D_Inventories(17)="UTGameContent.UTDeployableEMPMine"
H3D_Inventories(18)="UTGameContent.UTDeployableEnergyShield"
H3D_Inventories(19)="UTGameContent.UTDeployableShapedCharge"
H3D_Inventories(20)="UTGameContent.UTDeployableSlowVolume"
H3D_Inventories(21)="UTGameContent.UTDeployableSpiderMineTrap"
H3D_Inventories(22)="UTGameContent.UTUDamage"
H3D_Inventories(23)="PPC.UTWeap_PPC"
H3D_Inventories(24)="H3D_Healer.H3D_Deployable_Healer"
SpawnIntervalMin=10.000000
SpawnIntervalMax=30.000000
// PickupSound=SoundCue'H3D_Tag.Sounds.OmegaCue'
GroupNames(0)="H3D_Inventories"
Begin Object SpriteComponent Name=Sprite ObjName=Sprite Archetype=SpriteComponent'UTGame.Default__UTMutator:Sprite'
ObjectArchetype=SpriteComponent'UTGame.Default__UTMutator:Sprite'
End Object
Components(0)=Sprite
Name="Default__H3D_TagMutator"
ObjectArchetype=UTMutator'UTGame.Default__UTMutator'
}