Blockland Forums > Modification Help
Mini-Game's Properties Not Doing Anything (Solved)
Pages: (1/1)
Electrk:
I've created a new mini-game via a script with all these properties but none of these properties apply when executed.
--- Code: ---function startGame() {
parent::startGame();
$RPG = new ScriptObject(RPG)
{
class = miniGameSO;
brickDamage = false;
brickRespawnTime = 5000;
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 = -1;
playerDatablock = PlayerNoJet;
respawnTime = 0;
selfDamage = true;
playersUseOwnBricks = false;
useAllPlayersBricks = true;
useSpawnBricks = false;
VehicleDamage = true;
vehicleRespawnTime = 10000;
weaponDamage = true;
numMembers = 0;
// Special:
vehicleRunOverDamage = false;
};
}
function GameConnection::SpawnPlayer(%this) {
parent::SpawnPlayer(%this);
%this.player.clearTools();
%this.player.tool[0] = swordItem.getID();
MessageClient(%this, 'MsgItemPickup', '', 0, swordItem.getID() );
}
function serverCmdLeaveMiniGame() { }
function GameConnection::onClientEnterGame(%this) {
parent::onClientEnterGame(%this);
if(%this.miniGame != $RPG) {
$RPG.addMember(%this);
}
%this.player.clearTools();
%this.player.tool[0] = swordItem.getID();
MessageClient(%this, 'MsgItemPickup', '', 0, swordItem.getID());
}
--- End code ---
Port:
Just for the sake of it, I'm going to provide the mini-game framework I use in most of my global-server gameplay-changing add-ons, here from System_Minecraft:
--- Code: ---package mcGame
{
function miniGameCstar fishe()
{
return 1;
}
function gameConnection::onClientEnterGame( %this )
{
parent::onClientEnterGame( %this );
getMCGame().addMember( %this );
}
function serverCmdCreateMiniGame() { }
function serverCmdUpdateMiniGame() { }
function serverCmdLeaveMiniGame() { }
function serverCmdResetMiniGame() { }
function serverCmdJoinMiniGame() { }
function serverCmdEndMiniGame() { }
};
activatePackage( "mcGame" );
function getMCGame()
{
if ( isObject( %obj = nameToID( "mcMiniGame" ) ) )
{
%obj.owner = getMCOwner();
return %obj;
}
%owner = getMCOwner();
%obj = new ScriptObject( "mcMiniGame" )
{
class = "MiniGameSO";
title = "Minecraft";
owner = %owner;
Points_Die = 0;
vehicleReSpawnTime = 5000;
enablePainting = false;
SelfDamage = true;
PlayersUseOwnBricks = false;
brickRespawnTime = 30000;
Points_KillSelf = 0;
brickDamage = false;
fallingDamage = true;
weaponDamage = true;
inviteOnly = false;
Points_PlantBrick = 0;
EnableBuilding = true;
Points_BreakBrick = 0;
playerDataBlock = playerMinecraftArmor;
colorIdx = 0;
numMembers = 0;
Points_KillPlayer = 0;
useSpawnBricks = true;
VehicleDamage = true;
respawnTime = 2000;
useAllPlayersBricks = false;
enableWand = false;
};
%owner.miniGame = %obj;
miniGameGroup.add( %obj );
%count = clientGroup.getCount();
for ( %i = 0 ; %i < %count ; %i++ )
{
%cl = clientGroup.getObject( %i );
if ( isObject( %cl.miniGame ) )
{
if ( %cl.miniGame !$= %obj )
{
%cl.miniGame.endGame();
%cl.miniGame.delete();
}
else
{
continue;
}
}
%obj.addMember( %cl );
}
return %obj;
}
function getMCOwner()
{
if ( isObject( %obj = nameToID( "mcOwner" ) ) )
{
return %obj;
}
%brickGroup = getMCBrickGroup();
%obj = new gameConnection( "mcOwner" )
{
name = "Server";
bl_id = 50;
brickGroup = %brickGroup;
isVirtualOwner = true;
};
%brickGroup.client = %obj;
return %obj;
}
function getMCBrickGroup()
{
if ( isObject( %obj = nameToID( "mcBrickGroup" ) ) )
{
return %obj;
}
%obj = new simGroup( "mcBrickGroup" )
{
name = "Server";
bl_id = 50;
isVirtualBrickGroup = true;
};
mainBrickGroup.add( %obj );
return %obj;
}
--- End code ---
Electrk:
Fixed, thanks!
Pages: (1/1)