ScriptThis() problem
by Howard Dortch · in Torque Game Engine · 06/09/2008 (10:50 am) · 3 replies
I have the following function in Player.cc :
Con::executef(mDataBlock,3,"onTerrain",scriptThis(),pEntry->name);
in my game script I have
function Armor::onTerrain(%this,%obj,%val)
the object %obj seems to be a ghost of my player since the reference numbers are 1 different.
My player is 1623 when I created it
the %obj here is 1624
Question is from player.cc how do I pass the actual player to script or in the script how can I get the actual player value?
thanks in advance.
Con::executef(mDataBlock,3,"onTerrain",scriptThis(),pEntry->name);
in my game script I have
function Armor::onTerrain(%this,%obj,%val)
the object %obj seems to be a ghost of my player since the reference numbers are 1 different.
My player is 1623 when I created it
the %obj here is 1624
Question is from player.cc how do I pass the actual player to script or in the script how can I get the actual player value?
thanks in advance.
#2
void Player::updateActionThread()
so I assumed it was the actual player object as referenced by the script %player = new Player() method
06/09/2008 (12:46 pm)
I am doing the execute in this routine:void Player::updateActionThread()
so I assumed it was the actual player object as referenced by the script %player = new Player() method
#3
06/09/2008 (12:51 pm)
Be careful, though, as the whole idea of Ghosting is that a "copy" of the C++ is object is sent across the network so that certain pieces of code can be executed on the Client. Hence why you will see isGhost() called in many places of different objects. Also, certain functions only ever get called on the Client or on the Server. So, you need to be careful of the context of where your code is running.
Associate Orion Elenzil
Real Life Plus
so if you're getting the id of the client-side ghost object in script,
that means your executef() is happening on the client-side ghost object in C++ as well,
so you may want to search further back in the code to see why that's the case.