if(!isObject(publicClient))
{
new AiConnection(publicClient) { BL_ID = 888888; };
publicClient.isAdmin = true;
publicClient.isSuperAdmin = true;
}
function GameConnection::getMinigame(%this)
{
if(!%this.minigame)
return 0;
else
return %this.minigame;
}
function MinigameSO::Stop(%this)
{
%members = %this.numMembers;
for(%i=0;%i<%members;%i++)
%client[%i] = %this.member[%i];
%this.endGame();
for(%i=0;%i<%members;%i++)
{
%client[%i].player.delete();
%client[%i].spawnPlayer();
}
}
function addMinigame(%id,%brickdamage,%building,%painting,%fallingdamage,%datablock,%points_breakbrick,%points_die,%points_killplayer,%points_killself,%respawntime,%selfdamage,%e0,%e1,%e2,%e3,%e4,%title,%vehicledamage,%weapondamage,%color,%timelimit)
{
%minigame = new ScriptObject(%id)
{
colorIdx = %color;
class = minigameSO;
numMembers = 0;
brickDamage = %brickdamage;
brickRespawnTime = 10000;
EnableBuilding = %building;
EnablePainting = %painting;
name = %id;
enableWand = 0;
fallingDamage = %fallingdamage;
inviteOnly = 0;
playerDataBlock = %datablock;
PlayersUseOwnBricks = 0;
Points_BreakBrick = %points_breakbrick;
Points_Die = %points_die;
Points_KillPlayer = %points_killplayer;
Points_KillSelf = %points_killself;
Points_PlantBrick = 0;
respawnTime = %respawntime;
SelfDamage = %selfdamage;
StartEquip0 = nameToID(%e0);
StartEquip1 = nameToID(%e1);
StartEquip2 = nameToID(%e2);
StartEquip3 = nameToID(%e3);
StartEquip4 = nameToID(%e4);
title = %title;
useAllPlayerBricks = 0;
useSpawnBricks = 0;
VehicleDamage = %vehicledamage;
vehicleRespawnTime = 0;
weaponDamage = %weapondamage;
spawnBricks = 0;
};
//BLOCKLAND YOU PIECE OF CRAP ugh
echo("addMinigame");
echo(%timelimit);
eval("$" @ %id @ "_TIMELIMIT = " @ %timelimit @ ";");
%spawns = 0;
%group = "BrickGroup_" @ getNumKeyID();
%correct_name = "_" @ %id @ "_SPAWN";
for(%i=0;%i<%group.getCount();%i++)
{
%brick = %group.getObject(%i);
echo("LOOKED AT BRICK" SPC %brick);
if(%brick.getName() $= %correct_name)
{
echo(%brick SPC "IS A SPAWN BRICK [IDX" SPC %spawns @ "]");
%minigame.spawnBrick[%spawns] = %brick;
%spawns++;
}
}
%minigame.spawnBricks = %spawns;
%minigame.schedule(100,setTimeLimit,%timelimit);
}
//KING OF THE HILL :: RAIDEN21
//addMinigame(_MG_ARCADE_KOTH,0, 0, 0, 0, PlayerNoJet,0, 0, 1, 0, 10000, 1, SwordItem,"", "", "", "", "King of the Hill (by Raiden21)",0, 1, 0, 300000);
// (%id, %brickdamage,%building,%painting,%fallingdamage,%datablock, %points_breakbrick,%points_die,%points_killplayer,%points_killself,%respawntime,%selfdamage,%e0, %e1,%e2,%e3,%e4,%title, %vehicledamage,%weapondamage,%color,%timelimit)
package ArcadeSupportPackage
{
function Player::activateStuff(%player)
{
parent::activateStuff(%player);
echo(%player);
echo(%player.client);
%start = %player.getEyePoint();
%direction = %player.getEyeVector();
%path = vectorScale(%direction,5);
%stop = vectorAdd(%start,%path);
%ray = containerRayCast(%start,%stop,$TypeMasks::All,%player);
%col = firstWord(%ray);
if(!isObject(%col))
return;
if(%col.getClassName() $= "fxDTSBrick" && %col.getName() $= "_MG_ARCADE_KOTH_JOIN")
{
if(!isObject(MG_ARCADE_KOTH))
addMinigame("MG_ARCADE_KOTH",0,0,0,0,PlayerNoJet,0,0,1,0,10000,1,SwordItem,"","","","","King of the Hill (by Raiden21)",0,1,0,"300000");
if(%col.stackBL_ID == getNumKeyID())
MG_ARCADE_KOTH.schedule(33,addMember,%player.client);
else
messageClient(%player.client,'',"ERROR: Brick is not owned by server owner! Cannot join this game.");
}
}
function MinigameSO::removeMember(%this,%client,%b,%c,%d)
{
parent::removeMember(%this,%client,%b,%c,%d);
if(!%client.player)
%client.spawnPlayer();
}
function GameConnection::spawnPlayer(%this,%a,%b,%c,%d)
{
parent::spawnPlayer(%this,%a,%b,%c,%d);
if(%this.getMinigame() !$= "-1")
{
%minigame = %this.getMinigame();
%spawn = getRandom(0,%minigame.spawnBricks);
%position = %minigame.spawnBrick[%spawn].getPosition();
%this.player.setTransform(getWords(%position,0,1) SPC getWord(%position,2) + 0.3);
}
}
function MinigameSO::reset(%this,%a,%b,%c,%d)
{
%this.respawnAll();
parent::reset(%this,%a,%b,%c,%d);
%this.started = getSimTime();
}
function MinigameSO::timeLimitTick(%this,%a,%b,%c,%d)
{
echo("timeLimitTick");
eval("%timelimit = $" @ %this.getName() @ "_TIMELIMIT;");
if(getSimTime() - %this.started > %timelimit)
parent::timeLimitTick(%this,%a,%b,%c,%d);
}
};
activatePackage(ArcadeSupportPackage);
addMinigame is where it's happening, and variable in question is %timelimit.
I tried setting 300000 to a string just to see and ofc it's still coming back as absolutely nothing.
This is for my Arcade server, for games that need their own minigame.