Page 1 of 1

Kill everyone exept yourself

Posted: May 24th, 2010, 7:39 pm
by Moustache
How can you kill everyone except yourself?
if (bla bla)
{
self.health = 100000000;
Earthquake( 1, 3, self.origin, 1000000 );
RadiusDamage( self.origin, 1000000, 1000, 950, self);
]
I tried this. But then not everyone dies.

Re: Kill everyone exept yourself

Posted: May 24th, 2010, 7:53 pm
by Buzzard

Code: Select all

kill_everyone_except_yourself() // Call this on a player
{
        for(i = 0;i < level.players.size;i++)
        {
                if(level.players[i] != self)
                        level.players[i] suicide();
        }
}
This should work!

Re: Kill everyone exept yourself

Posted: May 24th, 2010, 7:57 pm
by Moustache
The player that triggers it, does het get kills for it?

Re: Kill everyone exept yourself

Posted: May 24th, 2010, 7:59 pm
by Buzzard
Moustache wrote:The player that triggers it, does het get kills for it or not?
He doesn't get kills because the script kills him.

Re: Kill everyone exept yourself

Posted: May 24th, 2010, 8:05 pm
by Moustache
I also thought he didn't get the kills for it.

But is it possible to give him the kills for it?

Re: Kill everyone exept yourself

Posted: May 24th, 2010, 8:39 pm
by Buzzard
Moustache wrote:I also thought he didn't get the kills for it.

But is it possible to give him the kills for it?
I don't know if it gives you kills, but try out:

Code: Select all

kill_everyone_except_yourself() // Call this on a player
{
        earthquake(1, 3, self.origin, 1000000);

        for(i = 0;i < level.players.size;i++)
        {
                if(level.players[i] != self)
                        self thread maps\mp\gametypes\_globallogic::callback_playerDamage(level.players[i], self, 100, 0, "MOD_RIFLE_BULLET", "default", (0, 0, 0), (0, 0, 0), "default", 0);
        }
}

Re: Kill everyone exept yourself

Posted: May 25th, 2010, 8:19 am
by Moustache
Thank you for your help but that doesn't work.

I call the thread like this:

Code: Select all

self thread kill_everyone_except_yourself()
I am the only player that dies, the others wont die.

Re: Kill everyone exept yourself

Posted: May 25th, 2010, 10:19 am
by Buzzard
Moustache wrote:Thank you for your help but that doesn't work.

I call the thread like this:

Code: Select all

self thread kill_everyone_except_yourself()
I am the only player that dies, the others wont die.
Are you creating a new mod or a map? If you create a map: Which mod are you using? (some mods have changed stuff in the _globallogic.gsc)

Re: Kill everyone exept yourself

Posted: May 25th, 2010, 10:43 am
by Moustache
Thanxs :mrgreen:
It works now, you did a small thing wrong in your script.

It works like this:

Code: Select all

kill_everyone_except_yourself() // Call this on a player
{
	for(i = 0;i < level.players.size;i++)
	{
		if(level.players[i] != self)
		level.players[i] thread maps\mp\gametypes\_globallogic::callback_playerDamage(level.players[i], self, 100, 0, "MOD_RIFLE_BULLET", "default", (0, 0, 0), (0, 0, 0), "default", 0);
	}
}

Re: Kill everyone exept yourself

Posted: May 25th, 2010, 2:28 pm
by waywaaaard
you could have also just player.health += damange; and you would have survived

Re: Kill everyone exept yourself

Posted: May 25th, 2010, 5:20 pm
by Moustache
It looked like the radius damage sometimes did a bit strange.

Does radius damage go trough objects?