Change Group depend players

dantedevil

Well-known member
Thinking in the mutiplayer mods and the different necessary difficulties when play alone or with others players, I have an idea.

Like when you set:
2pspawn 1
3 spawn 1
This make enemy appear depending number of  players is playing,  but the group set still the same.

So my idea is make something like this:
Group 4 4
2Group 5 5
3Group 6 6

Then the group change based on the amount of players in game.
Combined with this:
2pspawn 1
3 spawn 1
Would be great to create a better difficulty levels, appropriate to the number of players.

I hope this can work  via script.
 
You can't change group settings, but you can certainly get the same effect if you are willing to do some legwork. It requires using script to directly control spawns and movement though. Not really worth the effort IMO, but it is doable if you want to bad enough.

DC
 
So my idea is make something like this:
Group 4 4
2Group 5 5
3Group 6 6

Its pretty doable, but I think you are facing the issue from the wrong side. Why don't you make an invisible entity which counts how many players are on screen, counts how many enemies are there too and spawn more enemies?
 
im sure I have seen this in a mod already, cant recall which one but ill dig through them tonight and let you know

it didn't involve script and was declared in level text a certain way.
That is very interesting. Please let me know if you find it.

BTW you can also increase health of enemies if there are 2 or more players present
You are right my friend, this is a good alternative.

Its pretty doable, but I think you are facing the issue from the wrong side. Why don't you make an invisible entity which counts how many players are on screen, counts how many enemies are there too and spawn more enemies?
Great idea my friend!
Please show me how make that!
 
O Ilusionista said:
I won't risk to put a bad code here because I am very rusty, lol

But you can get the logic from the "Lonely" code here
http://www.chronocrash.com/forum/index.php?topic=719.0
Thanks my friend!
I know the script, but do not understand how to modify it to use for this purpose.
 
There's are small trick to achieve this:
Group 4 4
2Group 5 5
3Group 6 6

But it's not fully stable (I doubt the command would be any better if it were coded anyways)
The idea is to use the largest group setting of the above i.e group 6 6 then spawn dummy enemies to 'reduce' group size with script based on number of active players. These dummy enemies will be removed by script after all enemies have been defeated (OR anytime you want actually)
 
Couldn't you just insert script in empty spawns that summon based on the current players?


Code:
spawn   empty
@script
void main()
{

//INSERT CODE HERE

}
@end_script
coords   64 200 0
at   0

So you would just check if players exist or not, and spawn accordingly.

Code:
    int P1 = getplayerproperty(0, "entity");
    int P2 = getplayerproperty(1, "entity");

Not a proper code, but you get the idea....

Code:
if(getentityproperty(p1, "exists")) {

//SPAWN THIS
}

else if(getentityproperty(p2, "exists")) {

//SPAWN THIS INSTEAD
}
 
But it's not fully stable (I doubt the command would be any better if it were hardcoded anyways)

I should've said it not responsive instead of that

Anyways, my suggestion is something like this:

group 6 6
at 0

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

spawn FakeEn
@script
void main()
{
    void self = getlocalvar("self");
    int Players = openborvariant("count_players");
   
    if(Players == 3){
      killentity(self);
    }
}
@end_script
alias Dummy
coords 160 220
at 0

spawn enemy
coords 360 170
at 0

spawn enemy
coords 370 260
at 0

...

spawn killer
alias Dummy
coords 160 260
at 0

group 1 1
at 0

You can read more about Killer entity here:

http://www.chronocrash.com/forum/index.php?topic=1568.msg19049#msg19049

FakeEn is fake enemy to reduce grouping. It's invincible and undetectable in normal way yet it can be removed by killer entity at end of grouping

You can create fakeen yourself but here's mine:

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

defense setting is to protect it from damage all enemies attack

I said not responsive cause say when this grouping starts, there were only 1 player; Then while the battle is on, when more players join in, those fakeens won't remove themselves to change group setting aka allow more enemies to appear
If you're happy with this, then you can use this method but if you want more responsive grouping, I need to create special script for that
 
Back
Top Bottom