Author Topic: Creating a default minigame, then adding players  (Read 1160 times)

Quite simple, but I have poor knowledge on Minigames and how they work.

I simply wish to know how it is to be done, and so it forces players into the minigame that it creates.

Here's what I do know.

Code: [Select]
new scriptObject(MainMinigame)
{
class = miniGameSO;

brickDamage = false;
brickRespawnTime = 1000;
colorIdx = -1;

enableBuilding = false;
enablePainting = false;
enableWand = false;
fallingDamage = true;
inviteOnly = false;

points_plantBrick = 0;
points_breakBrick = 0;
points_die = 0;
points_killPlayer = 1;
points_killSelf = 0;

playerDatablock = playerNoJet;
respawnTime = 10;
selfDamage = true;

playersUseOwnBricks = false;
useAllPlayersBricks = true;
useSpawnBricks = true;
VehicleDamage = true;
vehicleRespawnTime = 10000;
weaponDamage = true;

numMembers = 0;

...

The rest I do not know.

Help is very appreciated!

I know there are several dedicated minigame mods, why don't you look at those?

I know there are several dedicated minigame mods, why don't you look at those?
Those are different, you're applying it to a minigame. I want mine to be creating upon server start.

Those are different, you're applying it to a minigame. I want mine to be creating upon server start.
Copy default minigame code and then copy a minigame as if someone had created it.

The part that involves force joining (the part you're asking us about) is already in the other mods, so look there first

I prefer to make a minigame on startup with Slayer because that already has force minigame joining and restricted leaving.

Hook into gameConnection::onClientEnterGame, serverCmdLeaveMiniGame and serverCmdCreateMiniGame. You can add or remove a client from a mini-game with mini-game object.addMember(client object); and mini-game object.removeMember(client object);, respectively. Keep in mind that mini-games are automatically deleted when they reach zero members, so you'll need to recreate it when that happens.

I prefer to make a minigame on startup with Slayer because that already has force minigame joining and restricted leaving.

Nice to know.

You may want to look at this old SS script: http://scatteredspace.com/forum/index.php?topic=6.0
It already does what you want.

Keep in mind that mini-games are automatically deleted when they reach zero members, so you'll need to recreate it when that happens.
Not the best method...

Not the best method...

You could also modify removeMember.