Help For Error Message
by Oguzcan · in Torque Game Engine · 08/13/2008 (9:26 am) · 10 replies
Hi !
Once of all i use this code's for ride a car during mission...
i see it console
"Starterfps/server/scripts/car.cs(307); Unable To Find Object; ' ' attempting to call function 'GetTransform'
Where İs My Wrong?How Can i fix it :S
My Codes (("Relative Ride A Car"))
>>Car.cs>>
function createCar(%spawnPoint)
{
%vehicle = new WheeledVehicle()
{
dataBlock = Car;
};
%vehicle.mountable = true;
%vehicle.setEnergyLevel(60);
%vehicle.setTransform( %spawnPoint.getTransform() );
//%vehicle.setGravity(0);// Optional recommended :)
%vehicle.nextWeaponFire = 1;
//%vehicle.schedule(5500, "playThread", $ActivateThread, "activate");
MissionCleanup.add(%vehicle);
return %vehicle;
}
>>Game.cs>>
// Spawn cars
%groupName = "MissionGroup/CarDropPoints";
%group = nameToID(%groupName);
if (%group != -1) {
%count = %group.getCount();
for (%i=0; %i<%count; %i++) {
%info = %group.getObject(%i);
$PIECES[%info.ID] = createCar(&spawnpoint);
>>Mission.mis>>
new SimGroup(CarDropPoints)
{
canSaveDynamicFields = "1";
new SpawnSphere() {
canSaveDynamicFields = "1";
position = "-38.0913 91.8671 111.815";
rotation = "0 0 1 178.191";
scale = "1 1 1";
dataBlock = "SpawnSphereMarker";
Radius = "10";
sphereWeight = "1";
indoorWeight = "1";
outdoorWeight = "1";
Once of all i use this code's for ride a car during mission...
i see it console
"Starterfps/server/scripts/car.cs(307); Unable To Find Object; ' ' attempting to call function 'GetTransform'
Where İs My Wrong?How Can i fix it :S
My Codes (("Relative Ride A Car"))
>>Car.cs>>
function createCar(%spawnPoint)
{
%vehicle = new WheeledVehicle()
{
dataBlock = Car;
};
%vehicle.mountable = true;
%vehicle.setEnergyLevel(60);
%vehicle.setTransform( %spawnPoint.getTransform() );
//%vehicle.setGravity(0);// Optional recommended :)
%vehicle.nextWeaponFire = 1;
//%vehicle.schedule(5500, "playThread", $ActivateThread, "activate");
MissionCleanup.add(%vehicle);
return %vehicle;
}
>>Game.cs>>
// Spawn cars
%groupName = "MissionGroup/CarDropPoints";
%group = nameToID(%groupName);
if (%group != -1) {
%count = %group.getCount();
for (%i=0; %i<%count; %i++) {
%info = %group.getObject(%i);
$PIECES[%info.ID] = createCar(&spawnpoint);
>>Mission.mis>>
new SimGroup(CarDropPoints)
{
canSaveDynamicFields = "1";
new SpawnSphere() {
canSaveDynamicFields = "1";
position = "-38.0913 91.8671 111.815";
rotation = "0 0 1 178.191";
scale = "1 1 1";
dataBlock = "SpawnSphereMarker";
Radius = "10";
sphereWeight = "1";
indoorWeight = "1";
outdoorWeight = "1";
About the author
#3
Unable To Find Object
and where your %spawnPoint is defined in game.cs
08/13/2008 (10:46 am)
Is it still giving the errorUnable To Find Object
and where your %spawnPoint is defined in game.cs
#4
%groupName = "MissionGroup/CarDropPoints"; // *** assign SpawnPointFolder
%group = nameToID(%groupName);
if (%group != -1) { // *** folder proof
%count = %group.getCount(); // *** Which Spawn Point on Folder >Take it
for (%i=0; %i<%count; %i++) { // *** Run it That Number
%info = %group.getObject(%i); // *** Take i. SpawnPoint
$PIECES[%info.ID] = createCar(&spawnpoint);
in this function %info = %SpawnPoint it same for this problem :)
08/13/2008 (10:55 am)
@Sailendu Behera About Ur Reply's.%groupName = "MissionGroup/CarDropPoints"; // *** assign SpawnPointFolder
%group = nameToID(%groupName);
if (%group != -1) { // *** folder proof
%count = %group.getCount(); // *** Which Spawn Point on Folder >Take it
for (%i=0; %i<%count; %i++) { // *** Run it That Number
%info = %group.getObject(%i); // *** Take i. SpawnPoint
$PIECES[%info.ID] = createCar(&spawnpoint);
in this function %info = %SpawnPoint it same for this problem :)
#5
08/13/2008 (11:11 am)
There is no %spawnPoint defined in your function. When you are passing the param %spawnPoint, it must be defined. And you are saying that %info = %SpawnPoint, how?
#6
08/13/2008 (11:18 am)
%info = spawnpoint's hold objective
#7
08/13/2008 (11:30 am)
No.. no.. you are doing something wrong. Your parameter is %spawnPoint, not &spawnpoint and it must be %spawnPoint and it must be defined, nothing else will work.
#8
2))OK.if this code's wrong.How can i add this car ? i dont want my game's player press alt+c...
i use BraveTree Bundle Car Pack >>http://www.garagegames.com/products/48/
08/13/2008 (11:34 am)
1 ))i use this function Add Npc and Bots:S2))OK.if this code's wrong.How can i add this car ? i dont want my game's player press alt+c...
i use BraveTree Bundle Car Pack >>http://www.garagegames.com/products/48/
#9
08/13/2008 (11:38 am)
It seems like you've created a new function to spawn the cars, in other way you can modify the default GameConnection::createPlayer function in the server game.cs to spawn the cars.
#10
%vehicle.setTransform( %spawnPoint.getTransform() );
to
%vehicle.setTransform( %spawnPoint );
and then change...
%info = %group.getObject(%i);
$PIECES[%info.ID] = createCar(&spawnpoint);
to
%info = %group.getObject(%i).getTransform();
$PIECES[%i] = createCar(%info);
.. Does that work?
12/16/2008 (4:11 pm)
Change...%vehicle.setTransform( %spawnPoint.getTransform() );
to
%vehicle.setTransform( %spawnPoint );
and then change...
%info = %group.getObject(%i);
$PIECES[%info.ID] = createCar(&spawnpoint);
to
%info = %group.getObject(%i).getTransform();
$PIECES[%i] = createCar(%info);
.. Does that work?
Sailendu Behera
$PIECES[%info.ID] = createCar(&spawnpoint);
I think the &spawnpoint is the problem, it should be %spawnPoint
and another thing is where your spawnpoint is defined in game.cs what you passing as a parameter in createCar(&spawnpoint);