Pawn Generators for infinite enemies.
| Author |
Message |
|
miguel
UNATCO
Joined: Tue Oct 12, 2010 10:35 pm Posts: 160 Location: Acheron LV-426 Hadley's Hope
|
 Pawn Generators for infinite enemies.
Changing the pawn class to be generated in the default options does nothing, no errors or warnings though. I've asked about the Spawn points in the last level of DeusEx that will respawn any Karkian, Greasel and spyder that you kill, but i had no luck on getting the information. spawn points are not exactly what i want anyway. I want this generator to spawn a determinate number of enemies in sertain areas and randomly if posible. I discovered a way to make a ProjectileGenerator to work somewhat like that. I Used an invisible BeamTriger that only reacts when the player pass through it to switch the generator on and off when the player enter or leaves the area. I think it is a bit risky and is not exactly what i want to achieve.
I'd really like to know all about the pawn generators and their options. Please Help.
|
| Sat Aug 13, 2011 6:31 am |
|
 |
|
Neveos
X-51
Joined: Wed Mar 03, 2010 1:29 am Posts: 834
|
 Re: Pawn Generators for infinite enemies.
I think there is a custom trigger for that found here: viewtopic.php?f=36&t=10761
_________________ http://www.youtube.com/watch?v=e3FfPUKuGsQ&t=8m0s
|
| Sat Aug 13, 2011 8:52 pm |
|
 |
|
miguel
UNATCO
Joined: Tue Oct 12, 2010 10:35 pm Posts: 160 Location: Acheron LV-426 Hadley's Hope
|
 Re: Pawn Generators for infinite enemies.
That sounds very useful, thanks. I'm going to play around with the trigers and see if i can get them to work.
|
| Sun Aug 14, 2011 12:11 am |
|
 |
|
DDL
Traditional Evil Scientist
Joined: Mon Oct 17, 2005 10:03 am Posts: 3641
|
 Re: Pawn Generators for infinite enemies.
The pawn generator supplied with the game simply doesn't really work. It works fine for fish, flies, rats etc, but then they already have their own generators. Actual NPCs are sufficiently more complicated to generally necessitate extra stuffs, which the generator can't do: in other words, even if it did work, it wouldn't be enough. The karks, spiderbots and greasels in the end mission were done via MS, incidentally. I've used this, which is a heavily modified version of a pawngenerator the sheep wrote, which I've added inventory, alliances and bindname shite to:  |  |  |  | Code: class SheepArmedPedestrianGenerator extends Actor;
struct InventoryItem { var() class<Inventory> Inventory; var() int Count; };
struct InitialAllianceInfo { var() Name AllianceName; var() float AllianceLevel; var() bool bPermanent; };
var(Pedestrian) int NumPedestrians; //max 32 var(pedestrian) bool bUseSpawnLimit; //should this generator use the threshold stuff? var(pedestrian) int Spawnlimit; //threshold for respawn, if set to numpedestrians-1, it'll bump up numbers after only a single death, if set to 0, requires all spawned peds to die before respawning occurs var(pedestrian) float Respawndelay; //how long it waits after a 'threshold' death to respawn pawns var float respawntimer; //internal counter var float counttime; //not sure if necessary, but can't playtest..such is life, eh? var bool bSleeping; //internal block on respawning var(Pedestrian) class<ScriptedPawn> PedClasses[8]; //classes to spawn, chosen randomly
var(SpawnLocation) bool bOutOfLOS; //if true, only spawn pedestrians when out of player's LOS var(SpawnLocation) name AltSpawnTag; //if bOutOfLOS is true, and the generator is in player's LOS, use alternate SpawnPoints with this tag
var(Pedestrian) name PedOrders,PedOrdersTag;
var(Pedestrian) string PedBindName; //if not blank, will set the pedestrians' bind name to this var(Pedestrian) string PedBarkBindName; //as above, for barks var(pedestrian) bool bUseRandomNames; //generate random names from our list? var(Pedestrian) string FirstNames[30]; //to allow random name generation var(Pedestrian) string LastNames[30]; var(pedestrian) int MaxTotalPeds; var(pedestrian) bool bSetMax; var(pedInventory) bool bSetInventory; var(pedInventory) InventoryItem PedInitialInventory[8];
var(PedAlliances) InitialAllianceInfo PedInitialAlliances[8]; var(pedAlliances) bool bSetAlliances; var (pedAlliances) name PedAlliance;
var ScriptedPawn pedestrians[32]; var int numClasses; //number of classes var int numFirstNames; //number of names var int numLastNames; var int numPedsSpawned;
function PostBeginPlay() { Super.PostBeginPlay();
if(PedClasses[0]==None) { Destroy(); return; } numPedsSpawned=0; //zero the count just in case
if(NumPedestrians>32) NumPedestrians=32;
if(bUseSpawnLimit) { if(Spawnlimit >= Numpedestrians) Spawnlimit = Numpedestrians-1; respawntimer=respawndelay; bSleeping=true; }
for(numClasses=0;(numClasses<8 && PedClasses[numClasses]!=None);numClasses++) {}
for(numFirstNames=0;(numFirstNames<30 && FirstNames[numFirstNames]!="");numFirstNames++) {}
for(numLastNames=0;(numLastNames<30 && LastNames[numLastNames]!="");numLastNames++) {}
SetTimer(1.0,True); }
function Timer() { if(bSetMax && (numpedsspawned >= maxTotalPeds)) { Destroy(); return; } if(GetNumPds() < NumPedestrians) { if(!bUseSpawnLimit) SpawnPed(); else { if(GetNumPds() <= Spawnlimit && !bSleeping) //is our total number of peds at or below the threshold? And have we been here before? { bSleeping=true; //starts us sleeping respawntimer=0; //sets the internal clock } else if(bSleeping) { respawntimer+=counttime; if(respawntimer >= respawndelay) { if(GetNumPds() == (NumPedestrians-1)) //are we one below the total numpeds desired? Then spawn one and stop us sleeping. { SpawnPed(); bSleeping=false; } else SpawnPed(); } } else return; //nothing to do for now } } }
function int GetNumPds() //returns the number of pedestrians { local int x,y;
y=0;
for(x=0;x<32;x++) { if(pedestrians[x]!=None) y++; }
return y; }
function SpawnPed() { local int x;
for(x=0;(x<32 && pedestrians[x]!=None);x++) {} if(x>=32) return; //no space for more peds
if(EstablishSpawnLoc()==vect(0,0,0)) //can't spawn at this time!! return;
pedestrians[x]=Spawn(PedClasses[Rand(numClasses+1)],self,,EstablishSpawnLoc());
if(pedestrians[x]==None) pedestrians[x]=Spawn(PedClasses[Rand(numClasses+1)],self,,EstablishSpawnLoc(True));
if(pedestrians[x]!=None && PedBindName!="") pedestrians[x].BindName=PedBindName;
if(pedestrians[x]!=None && PedBarkBindName!="") pedestrians[x].BarkBindName=PedBarkBindName;
if(pedestrians[x]!=None) { if(bSetMax) numpedsSpawned++; if(bUseRandomNames) { pedestrians[x].FamiliarName=FirstNames[Rand(numFirstNames)]@LastNames[Rand(numLastNames)]; pedestrians[x].UnfamiliarName=FamiliarName; } }
if(pedestrians[x]!=None && PedOrders!='None') pedestrians[x].SetOrders(PedOrders,PedOrdersTag,True); if(pedestrians[x] != none && bSetInventory) ArmPed(pedestrians[x]); if(pedestrians[x] != none && bSetAlliances) AllyPed(pedestrians[x]); }
function ArmPed(scriptedpawn ped) { local int i; local scriptedpawn P; local inventory Inv, invcheck;
P=ped;
if(P != none) { for (i=0;i<8;i++) { inv=P.FindInventoryType(P.InitialInventory[i].Inventory); //invcheck=pedInitialInventory[i]; if(inv != none) //get rid of anything already there { P.DeleteInventory(inv); Inv.Destroy(); } //if(invcheck !=none) if(pedInitialInventory[i].Inventory !=none) { P.InitialInventory[i].Inventory=pedInitialInventory[i].Inventory; P.InitialInventory[i].Count=pedInitialInventory[i].Count; //if(invcheck.IsA('Ammo') // P.InitialInventory[i].Count=NumClips; //else // p.InitialInventory[i].Count=1; } } P.InitializeInventory(); } }
function AllyPed(scriptedpawn ped) { local int i; local scriptedpawn P;
P=ped;
if(pedAlliance != '') P.Alliance=PedAlliance;
for (i=0; i<8; i++) if (PedInitialAlliances[i].AllianceName != '') P.ChangeAlly(PedInitialAlliances[i].AllianceName, PedInitialAlliances[i].AllianceLevel, PedInitialAlliances[i].bPermanent);
}
function Vector EstablishSpawnLoc(optional bool bUseAlt) //bUseAlt - if passed & true, use an alternate location { local SpawnPoint p; local Vector v,v2;
if((bOutOfLOS && PlayerCanSeeMe()) || bUseAlt) { if(AltSpawnTag=='None') return Vect(0,0,0);
foreach AllActors(class'SpawnPoint',p,AltSpawnTag) { if(p!=None) if( (!p.PlayerCanSeeMe()) || (bUseAlt && !bOutOfLOS)) { v=p.Location; v-=(Vect(1,1,0) * p.CollisionRadius); v2=VRand(); v2.Z=0.0; v2=v2*2*p.CollisionRadius; return v+v2; } } } else { v=Location; v-=(Vect(1,1,0) * CollisionRadius); v2=VRand(); v2.Z=0.0; v2=v2*2*CollisionRadius; return v+v2; }
return Vect(0,0,0); }
defaultproperties { bHidden=True NumPedestrians=8 MaxTotalPeds=50 bSetMax=false counttime=1.00 RespawnDelay=300 Spawnlimit=0 PedClasses(0)=class'LowerClassMale' PedClasses(1)=class'LowerClassMale2' PedClasses(2)=class'LowerClassFemale' bOutOfLOS=True PedBindName="" PedBarkBindName="" bUseRandomNames=true FirstNames(0)="Ashley" LastNames(0)="Smith" PedOrders=Wandering CollisionRadius=64.0 }
|  |  |  |  |
It...should be reasonably self-explanatory (it's fairly heavily annotated), and the code is also fairly ropy, since I wrote it maybe 5 years ago when my uscript wasn't so hot (it appears to check for an actor "not being none" about 5 times in one function, which is quite frankly dumb as TITS, but there you go)...nevertheless, it should give you something to work with. By default I think it'll spawn a random mix of lowerclass males and females all called ashley smith (because fuck you, that's why), but by tweaking (either in the editor once you've placed it, or in the code itself) you should be able to get something workable. And as ever, free to use, but management takes no responsibility. 
Last edited by DDL on Tue Aug 16, 2011 12:41 am, edited 1 time in total.
|
| Mon Aug 15, 2011 7:14 pm |
|
 |
|
Neveos
X-51
Joined: Wed Mar 03, 2010 1:29 am Posts: 834
|
 Re: Pawn Generators for infinite enemies.
You're too awesome DDL... are you even in TNM?
_________________ http://www.youtube.com/watch?v=e3FfPUKuGsQ&t=8m0s
|
| Mon Aug 15, 2011 10:10 pm |
|
 |
|
DDL
Traditional Evil Scientist
Joined: Mon Oct 17, 2005 10:03 am Posts: 3641
|
 Re: Pawn Generators for infinite enemies.
Sewers! Not exactly hidden, not exactly obvious. Not exactly acronymed, either. 
|
| Mon Aug 15, 2011 10:20 pm |
|
 |
|
nerdenstein
Illuminati
Joined: Thu Apr 24, 2008 7:40 pm Posts: 1500 Location: Leicester, England, UK.
|
 Re: Pawn Generators for infinite enemies.
I remember it took me awhile to make the link between the dude in the sewers and you. Not wanting to spoil the surprise: You asked for Ketchup as far as I can remember?Also, Did you voice your character?
_________________ The real trouble with reality is that there's no background music.
|
| Mon Aug 15, 2011 10:56 pm |
|
 |
|
Neveos
X-51
Joined: Wed Mar 03, 2010 1:29 am Posts: 834
|
 Re: Pawn Generators for infinite enemies.
Oh god that's you?! I was looking for PDX when I became consumed with wanting to figure out what was tucked away so deep in the sewer. It was so hard to get there and then when I found the Dr. I thought that it was a cool conversation on par with the rat-eating guy (which both were hilarious). Unfortunately it was my World Corp play through so I had to kill you... But the map got me to PDX
_________________ http://www.youtube.com/watch?v=e3FfPUKuGsQ&t=8m0s
|
| Mon Aug 15, 2011 11:16 pm |
|
 |
|
Jonas
Off Topic Productions
Joined: Sat Apr 24, 2004 9:21 pm Posts: 13850 Location: Hafnia
|
 Re: Pawn Generators for infinite enemies.
He did. With my microphone. I brought it to Manchester myself and had him record those lines. He got me so drunk in London I threw up all over the floor in a train station  You should know the killing is optional, even if you work for WorldCorp 
_________________ Jonas Wæver
Chief Poking Manager of TNM
Random Outbursts of Creativity
|
| Tue Aug 16, 2011 12:09 am |
|
 |
|
nerdenstein
Illuminati
Joined: Thu Apr 24, 2008 7:40 pm Posts: 1500 Location: Leicester, England, UK.
|
 Re: Pawn Generators for infinite enemies.
Haha brilliant! Such is life in British train stations. 
_________________ The real trouble with reality is that there's no background music.
|
| Tue Aug 16, 2011 12:22 am |
|
 |
|
miguel
UNATCO
Joined: Tue Oct 12, 2010 10:35 pm Posts: 160 Location: Acheron LV-426 Hadley's Hope
|
 Re: Pawn Generators for infinite enemies.
DDL You are great. I haven't been able to use it because When I try to compile , it gives me an error in the line 272 where the defaultproperties are. it must be a little thing i'm missing. The PawnSpawn triger worked fine but this one you made is exactly wath i was looking for.
|
| Tue Aug 16, 2011 12:24 am |
|
 |
|
DDL
Traditional Evil Scientist
Joined: Mon Oct 17, 2005 10:03 am Posts: 3641
|
 Re: Pawn Generators for infinite enemies.
Post the error? It's probably just something I've missed (like..a spelling error). EDIT: was an extra { in the random naming bit. Fucking notepad. My own version uses random naming automatically, but I figured that might not be industry standard, so added a bool to turn it off, and (as it turns out) an extra {. Whups. I've edited the code above, so should work now. Possibly maybe. 
|
| Tue Aug 16, 2011 12:39 am |
|
 |
|
DDL
Traditional Evil Scientist
Joined: Mon Oct 17, 2005 10:03 am Posts: 3641
|
 Re: Pawn Generators for infinite enemies.
Also, to give him credit, Jonas did match me drink for drink for quite some time. With almost totally not very much at all really much coercion on my part.
And nobody likes london underground stations.
|
| Tue Aug 16, 2011 12:48 am |
|
 |
|
miguel
UNATCO
Joined: Tue Oct 12, 2010 10:35 pm Posts: 160 Location: Acheron LV-426 Hadley's Hope
|
 Re: Pawn Generators for infinite enemies.
|
| Tue Aug 16, 2011 12:52 am |
|
 |
|
miguel
UNATCO
Joined: Tue Oct 12, 2010 10:35 pm Posts: 160 Location: Acheron LV-426 Hadley's Hope
|
 Re: Pawn Generators for infinite enemies.
Never mind. It works now You're a nice coder
|
| Tue Aug 16, 2011 12:57 am |
|
|