Game Development Community

Netobject ghosted twice

by Lukas Joergensen · in Torque 3D Professional · 01/14/2013 (1:12 am) · 2 replies

Hello guys!
I'm trying to ghost a NetObject SpellDecalManager:
class SpellDecalManager : public NetObject, public ITickable
{
	typedef NetObject Parent;
	enum MaskBits{
		Init = BIT(4),
	};
However it seems to be ghosted twice, unpackUpdate runs 2 times on two different instances of the SpellDecalManager client object (I checked that it is the client object)

Is it supposed to create 2 ghosts?
It's causing quite a bit of trouble...

This is how I create the new SpellDecalManager:
SpellDecalManager* SDM = new SpellDecalManager();
	if(!SDM->registerObject())
	{
		Con::errorf("!SDM->registerObject()");
		delete SDM;
		callback(caller, Point3F(0), false);
		return;
	}

This is the constructor:
//--------------------------------------------
// Constructor
//--------------------------------------------
SpellDecalManager::SpellDecalManager()
{
	mNetFlags.set(Ghostable | ScopeLocal);
	setScopeAlways();
	mDecalInstance = NULL;
	mDecalController = NULL;
	caller = NULL;
	ServerID = 0;
	SpawnWhenPossible = 0;
}

I implement like this: IMPLEMENT_CO_NETOBJECT_V1(SpellDecalManager);


Any ideas on why this is happenning? Or how I can prevent it

#1
01/14/2013 (1:16 am)
Oh yeah, it shouldn't use the setScopeAlways() command, that was one of my attempts to get it to work.
Instead I wanted to add it to the scope like this:
conn->objectInScope(SDM);
But then it isn't ghosted at all.
#2
01/14/2013 (1:28 am)
Nevermind.. Seems to be working now.. No clue what I did to fix it..

Used this:
client->objectLocalScopeAlways(SDM);
Instead of objectInScope.
But that didn't work for me earlier.. Guess the planets are aligned correctly now. Sorry but can't be of any help to others facing the same problem! :)