Two player group sizes

Hello everyone.  I'd like to have more enemies on screen depending on how many players are currently playing, but I'm having a bit of trouble tracking down a way to make this work in the manual.  Is there a predefined way to go about doing this much like 2pspawn? Or would this require a bit of scripting?

Logistically, I'm using a script for a boss that tracks the amount of enemies and then spawns more with a follow1 anim.  Would that be the route I'm taking with this?  I can already foresee issues doing it that way, though.
 
This would require a bit of scripting. You could spawn a Fake Enemy like this:
Code:
name    	FakeEn
health	 	100
type    	enemy
nomove  	1 1
stealth		350
antigravity	100
offscreenkill	3000
subject_to_wall	0
nodrop		2
nolife		1
defense 	normal10 0 2000


anim	idle
	loop	1
	delay	100
	offset	1 1
	frame	data/chars/misc/empty.gif

Then spawn it together with other enemies like this:
Code:
group	4 4
at	0

spawn	Soldier2
coords	360 170
at	0

spawn	Soldier2
coords	370 260
at	0

spawn	FakeEn
@script
void main()
{
    void self = getlocalvar("self");
    int Players = openborvariant("count_players");
    
    if(Players >= 2){
      killentity(self);
    }
}
@end_script
coords	-40 220
at	0
...

When there's only one player, FakeEn will reduce group size into 3 3. When there's two or more playes, script on FakeEn will remove FakeEn allowing group to function normally

Hmm... I used this on boss battle. For regular groupings, another script is needed. Just a minute

[couple hours later]

Okay that took more than just a minute  :-[

Anyways, in order to remove FakeEn, a script or rather an entity is required: Killer

Code:
name		Killer
type		none


anim idle
@script
    void self = getlocalvar("self");			//Caller.

    if(frame==1){
      char Name = getentityproperty(self,"name");
      void vEntity;                                       //Target entity placeholder.
      int  iEntity;                                       //Entity enumeration holder.
      char iName;                                         //Entity Name.
      int  iMax      = openborvariant("ent_max");         //Entity count.

      //Enumerate and loop through entity collection.
      for(iEntity=0; iEntity<iMax; iEntity++){
        vEntity = getentity(iEntity);                 //Get target entity from current loop.
        iName   = getentityproperty(vEntity, "name"); //Get target type.

        //Same alias but different entity?
        if(iName == Name && vEntity != self){
          killentity(vEntity);
        }
      }
    }
    if(frame==2){
      killentity(self);
    }
@end_script
	delay	10
	offset	1 1
	frame	data/chars/misc/empty.gif
	frame	data/chars/misc/empty.gif
	frame	data/chars/misc/empty.gif

This entity will kill active entities with same alias as itself
Here's an example of spawning:

Code:
group	2 2
at	500

spawn	FakeEn
@script
void main()
{
    void self = getlocalvar("self");
    int Players = openborvariant("count_players");
    
    if(Players >= 2){
      killentity(self);
    }
}
@end_script
alias	TF2
coords	160 220
at	500

spawn	Soldier
coords	400 200
at	500

spawn	Soldier
map	1
coords	400 240
at	500

spawn	Soldier
coords	400 200
at	500

spawn	Soldier
map	1
coords	400 240
at	500

spawn	Killer
alias	TF2
coords	320 220
at	0

Killer entity will remove FakeEn when it's spawned
 
Back
Top Bottom