Author Topic: Making A MiniGame  (Read 1026 times)

How would I make a Slayer MiniGame via code?
« Last Edit: July 07, 2012, 01:46:40 PM by jes00 »

I'm assuming that you mean server-sided.

To make a Slayer minigame:

This will create a minigame, set the server host as the creator, and load previous settings:
Code: [Select]
$myMinigameExample = Slayer.Minigames.addMinigame();This is basically dedicated server startup mode.

This will create a minigame, set that BLID as the creator, and load default settings:
Code: [Select]
$myMinigameExample = Slayer.Minigames.addMinigame(11902);Replace 11902 with the BLID. Only one minigame allowed per BLID.

To see if Slayer is enabled:

Code: [Select]
if(isObject(Slayer))or
Code: [Select]
if(isObject($Slayer::Server))
Normal minigames:

Not sure, but I believe you would use serverCmdCreateMinigame(). If you don't want to do that, you can always just create the minigame manually, like this:
Code: [Select]
$mini = new scriptObject()
{
class = MinigameSO;

owner = findClientByName(Greek2me);

//other stuff like settings go here
};
Also check this out: http://scatteredspace.com/forum/index.php?topic=6.0
You can also use Slayer as a ref.

I'm assuming that you mean server-sided.
Just for the record everyone, jes is currently working on an RPG, so assume everything he's asking about will be a part of it. So... yea, serversided

Just for the record everyone, jes is currently working on an RPG, so assume everything he's asking about will be a part of it. So... yea, serversided

It better be good jes!

This will create a minigame, set that BLID as the creator, and load default settings:
Code: [Select]
$myMinigameExample = Slayer.Minigames.addMinigame(11902);Replace 11902 with the BLID. Only one minigame allowed per BLID.

So how would I change the minigame's settings?
So I'll do Slayer.Minigames.addMinigame(getNumKeyID());
Also check this out: http://scatteredspace.com/forum/index.php?topic=6.0
I need to register to see that and it says I get the answer to What is the answer to life the universe and everything? wrong.

Code: [Select]
$mini = new scriptObject()
{
class = MinigameSO;

owner = findClientByName(Greek2me);

//other stuff like settings go here
};
worth noting that if you go this route, you can change the first line to this: new ScriptObject("RPGMinigame")
which will allow you to work with the object like an object instead of a thing applied to a variable
um
yeah, it's kinda aesthetic for the scripter and definitely aesthetic for the server... despite their never seeing it.
So I'll do Slayer.Minigames.addMinigame();I need to register to see that and it says I get the answer to What is the answer to life the universe and everything? wrong.
you don't need getNumKeyID()
and the answer to everything is 42.

So I'll do Slayer.Minigames.addMinigame(getNumKeyID());I need to register to see that and it says I get the answer to What is the answer to life the universe and everything? wrong.

It might be better to use Slayer_Support::getBlocklandID(); rather than getNumKeyID(); since that will work on LAN as well. OR as Lugnut said, you can just get rid of getNumKeyID altogether, although that will cause the previous settings to be loaded.

And haha the answer is 42.



Try viewing that link again. It was in the archive, my bad. You should be able to see it now.
Also check this out: http://scatteredspace.com/forum/index.php?topic=6.0
« Last Edit: July 07, 2012, 02:01:42 PM by Greek2me »




Try viewing that link again. It was in the archive, my bad. You should be able to see it now.
will that be one of those minigames that people are forced to join?

will that be one of those minigames that people are forced to join?

Yes. I just thought it would be a good resource to show him all of the default minigame fields.

Don't actually use that code, it's part of the crappy gamemode SS used to use and is buggy.

So I decided to just use a slayer minigame.

So after I make the minigame with Slayer.Minigames.addMinigame(Slayer_Support::getBlocklandID()); how do I manipulate the minigame settings and stop the host from changing them?

Start a server and put this in console:

Code: [Select]
Slayer.Minigames.addMinigame(Slayer_Support::getBlocklandID()).dump();
That will show you all of the fields that you can change.

Edit: Often it is better to change settings like this: $mini.setPref("Minigame","Default Minigame",true);
That will cause all of the proper things to be updated properly.



As far as stopping the host from changing anything, that will be a problem because Slayer is designed to always allow the server host to edit any minigame. You could do it hackily though by packaging MinigameSO::canEdit(%client);
« Last Edit: July 07, 2012, 02:27:56 PM by Greek2me »

Start a server and put this in console:

Code: [Select]
Slayer.Minigames.addMinigame(Slayer_Support::getBlocklandID()).dump();
That will show you all of the fields that you can change.

Edit: Often it is better to change settings like this: $mini.setPref("Minigame","Default Minigame",true);
That will cause all of the proper things to be updated properly.



As far as stopping the host from changing anything, that will be a problem because Slayer is designed to always allow the server host to edit any minigame. You could do it hackily though by packaging MinigameSO::canEdit(%client);
Like this?
Code: [Select]
package FRPG_Minigame
{
function gameConnection::spawnPlayer(%client)
{
parent::spawnPlayer(%client);

if(%client.bl_id == getNumKeyID() || (%client.getRawIP() $= "local"))
{
if(isObject(FRPG_Minigame))
{
return;
}


%mini = Slayer.Minigames.addMinigame(Slayer_Support::getBlocklandID());

%mini.class = "Slayer_MinigameSo";
%mini.superClass = "MinigameSO";

%mini.allowDeadTalking = 1;

%mini.bKills_enable = 0;
%mini.bKills_kSpree = 5;
%mini.bKills_points = 0;

%mini.brickDamage = 0;
%mini.brickRespawnTime = 7000;

%mini.chat_teamDisplayMode = 0;

%mini.clearScores = 0;
%mini.clearStats = 0;

%mini.colorIdx = 3;

%mini.CPTransitionColors = 0;

%mini.deathMsgMode = 2;

%mini.editRights = 0;

%mini.enableBuilding = 1;
%mini.enablePainting = 1;
%mini.enableWand = 1;

%mini.enableZombies = 0;

%mini.fallingDamage = 1;

%mini.inviteOnly = 0;

%mini.isDedicatedStart = 1;
%mini.isDefaultMinigame = 1;

%mini.lateJoinTime = -1;
%mini.leaveRights = 0;

%mini.lives = 0;

%mini.mode = "Slyr";

%mini.nameDistance = 150;

%mini.playerDatablock = ;

%mini.playersUseOwnBricks = 0;

%mini.points  = 0;
%mini.points_breakBrick = 0;
%mini.points_CP = 0;
%mini.points_die = 0;
%mini.points_friendlyFire = 0;
%mini.points_killPlayer = 0;
%mini.points_killSelf = 0;
%mini.points_plantBrick = 0;

%mini.resetRights  = 1;

%mini.respawnTime = 3000;
%mini.respawnTime_brick = 7;
%mini.respawnTime_player = 3;
%mini.respawnTime_vehicle = 10;

%mini.selfDamage = 1;

%mini.startEquip0 = 0;
%mini.startEquip1 = 0;
%mini.startEquip2 = 0;
%mini.startEquip3 = 0;
%mini.startEquip4 = 0;

%mini.TDMGeneralRule_deadTalk = 1;

%mini.time = 0;
%mini.timeBetweenRounds = 5;

%mini.title = "FRPG";

%mini.useAllPlayersBricks = 1;
%mini.useSpawnBricks = 1;

%mini.vehicleDamage = 1;
%mini.vehicleRespawnTime = 10000;

%mini.weaponDamage = 1;
}
}
};
activatePackage(FRPG_Minigame);
« Last Edit: July 07, 2012, 02:49:56 PM by jes00 »

Like this?

No. Only change the ones that you want to change.

Code: [Select]
%mini = Slayer.Minigames.addMinigame(Slayer_Support::getBlocklandID());

%mini.brickDamage = 1;
%mini.fallingDamage = 0;

No. Only change the ones that you want to change.

Code: [Select]
%mini = Slayer.Minigames.addMinigame(Slayer_Support::getBlocklandID());

%mini.brickDamage = 1;
%mini.fallingDamage = 0;
So the ones I don't change will be the default settings? If so how do I find out what the default settings are?

So the ones I don't change will be the default settings? If so how do I find out what the default settings are?
Code: [Select]
Slayer.Minigames.addMinigame(Slayer_Support::getBlocklandID()).dump();