Author Topic: how to make a client spectate another client  (Read 1114 times)

I wish to use serverDirectSaveFileLoad() to load maps, then delete them later. I don't really want to name all the bricks just so I can easily delete them later, I'd rather have it as a seperate person's ID so I can delete all of their bricks without interfering with mine.

How do I change the ID of every brick that's loaded using this function to a custom ID?
« Last Edit: January 23, 2014, 07:26:37 AM by PurpleMetro »

I don't think you can set an ID for it to use, but you can do this:
serverDirectSaveFileLoad(%fileName, 3, "", 2) to load the save as public bricks, putting it in brickgroup_999999 (or was it 888888?)

I believe that you can change $LoadingBricks::BrickGroup to something else.

edit:
These are the available $LoadingBricks variables:
Code: [Select]
$LoadingBricks_BrickGroup = "27739";
$LoadingBricks_Client = "";
$LoadingBricks_ColorMethod = "";
$LoadingBricks_DirName = "0";
$LoadingBricks_FileName = "saves/[CTF] BattleHall.bls";
$LoadingBricks_HandShakeSchedule = 0;
$LoadingBricks_Ownership = "1";
$LoadingBricks_PositionOffset = "0 0 0";
$LoadingBricks_Silent = 0;
$LoadingBricks_StartTime = "1445689";

I got this list by running export("$LoadingBricks*","base/loadingbricks.txt"); after loading a build.

You might also want to look at the serverLoadSaveFile_Tick() function.
« Last Edit: January 20, 2014, 04:35:57 PM by Greek2me »




the console prints that right after i load the bricks with my function, and the bricks still remain within the ownership i saved it in originally, my BL_ID

EDIT: For now, i'm going to go with Blocki's solution. It's BL_ID 888888 by the way. Nobody will get to build anyways, so there shouldn't be any harm about worrying who messes around with the public bricks
« Last Edit: January 20, 2014, 04:46:50 PM by PurpleMetro »


You need to put the brickgroup object, not your bl_id

Still won't work what the hell?

Even when I change $LoadingBricks_BrickGroup to "BrickGroup_888888", and try to load something manually by the Load GUI, it still loads it as my bricks.

Why is it doing this?

You could just package onLoadPlant and add them to a SimGroup to delete later

Still won't work what the hell?

Even when I change $LoadingBricks_BrickGroup to "BrickGroup_888888", and try to load something manually by the Load GUI, it still loads it as my bricks.

Why is it doing this?
Because using the Load GUI resets all the $LoadBricks_* variables.

Code: [Select]
$LoadingBricks_PositionOffset = "0 0 0";
It's odd that this one exists, as there is already a $LoadOffset variable that probably does the same thing.

It's odd that this one exists, as there is already a $LoadOffset variable that probably does the same thing.

The $LoadOffset variable is used to set the $LoadingBricks_PositionOffset variable.

I have another question now, how do I clear all the bricks on the server. serverCmdClearAllBricks() requires a client , so I was thinking I could get the Console to clear all bricks (if it's even a client?). Basically I just want to know how to /clearallbricks on the server with conditions like me not being on the server, or something.

If this isn't possible then is there a manual way to do it- without annoying lag..

Code: [Select]
%groupCount = mainBrickGroup.getCount();
for(%i = 0; %i < %groupCount; %i ++)
mainBrickGroup.getObject(%i).chainDeleteAll();

Code: [Select]
%groupCount = mainBrickGroup.getCount();
for(%i = 0; %i < %groupCount; %i ++)
mainBrickGroup.getObject(%i).chainDeleteAll();

Thanks.. Again.

I have another question, how do you make a client/player spectate another player, i'm going to put this in the onArmorDisabled function so they can spectate the player, until the game is over.

%client.camera.setMode("Orbit", %player);
%client.camera.setControlObject(%client.camera);

%client.setControlObject(%client.camera);