Game Development Community

What is the problem?

by Lee-Orr Orbach · in Torque Game Engine · 10/25/2005 (10:56 pm) · 27 replies

Hello!!!

I have been trying to make an object (in script). for some reason, the script code I wrote didn't work. I wanted to know if anyone could tell me what the problem with my script is, in his oppinion.

here is the script:
function onMissionLoaded()
{
   // Called by loadMission() once the mission is finished loading.
%grid_obj = new ItemData(Grid_1) {
      position = "12.193 -402.531 158.094";
      rotation = "1 0 0 0";
      scale = "1 1 1";mass = 1;friction = 1;elasticity = 0.3;category = "Objects";
      shapeName = "~/data/shapes/markers/octahedron.dts";
   };
MissionCleanup.add(%grid_obj)
%grid_obj = new ItemData(Grid_2) {
      position = "15.3199 -402.277 158.294";
      rotation = "1 0 0 0";
      scale = "1 1 1";mass = 1;friction = 1;elasticity = 0.3;category = "Objects";
      shapeName = "~/data/shapes/markers/octahedron.dts";
   }; MissionCleanup.add(%grid_obj);
  %grid_obj = new ItemData(Grid_3) {
      position = "18.9596 -401.742 157.894";
      rotation = "1 0 0 0";
      scale = "1 1 1";mass = 1;friction = 1;elasticity = 0.3;category = "Objects";
      shapeName = "~/data/shapes/markers/octahedron.dts";
   }; MissionCleanup.add(%grid_obj);
   %grid_obj = new ItemData(Grid_4) {
      position = "14.1596 -404.142 157.894";
      rotation = "1 0 0 0";
      scale = "1 1 1";mass = 1;friction = 1;elasticity = 0.3;category = "Objects";
      shapeName = "~/data/shapes/markers/octahedron.dts";
   }; MissionCleanup.add(%grid_obj);
   %grid_obj = new ItemData(Grid_5) {
      position = "17.7596 -403.542 157.894";
      rotation = "1 0 0 0";
      scale = "1 1 1";mass = 1;friction = 1;elasticity = 0.3;category = "Objects";
      shapeName = "~/data/shapes/markers/octahedron.dts";
   }; MissionCleanup.add(%grid_obj);
   %grid_obj = new ItemData(Grid_6) {
      position = "12.3596 -406.142 157.894";
      rotation = "1 0 0 0";
      scale = "1 1 1";mass = 1;friction = 1;elasticity = 0.3;category = "Objects";
      shapeName = "~/data/shapes/markers/octahedron.dts";
   }; MissionCleanup.add(%grid_obj);
   %grid_obj = new ItemData(Grid_7) {
      position = "16.3596 -405.542 157.894";
      rotation = "1 0 0 0";
      scale = "1 1 1";mass = 1;friction = 1;elasticity = 0.3;category = "Objects";
      shapeName = "~/data/shapes/markers/octahedron.dts";
   }; MissionCleanup.add(%grid_obj);
   %grid_obj = new ItemData(Grid_8) {
      position = "19.5596 -404.942 157.894";
      rotation = "1 0 0 0";
      scale = "1 1 1";mass = 1;friction = 1;elasticity = 0.3;category = "Objects";
      shapeName = "~/data/shapes/markers/octahedron.dts";
   }; MissionCleanup.add(%grid_obj);
   %grid_obj = new ItemData(Grid_10) {
      position = "17.9596 -407.142 157.894";
      rotation = "1 0 0 0";
      scale = "1 1 1";mass = 1;friction = 1;elasticity = 0.3;category = "Objects";
      shapeName = "~/data/shapes/markers/octahedron.dts";
   }; MissionCleanup.add(%grid_obj);
 %grid_obj = new ItemData(Grid_9) {
      position = "14.5596 -407.742 157.894";
      rotation = "1 0 0 0";
      scale = "1 1 1";mass = 1;friction = 1;elasticity = 0.3;category = "Objects";
      shapeName = "~/data/shapes/markers/octahedron.dts";
   }; MissionCleanup.add(%grid_obj);
   %grid_obj = new ItemData(Grid_13) {
      position = "19.7596 -408.742 157.894";
      rotation = "1 0 0 0";
      scale = "1 1 1";mass = 1;friction = 1;elasticity = 0.3;category = "Objects";
      shapeName = "~/data/shapes/markers/octahedron.dts";
   }; MissionCleanup.add(%grid_obj);
Page«First 1 2 Next»
#21
10/28/2005 (9:06 am)
Hah, I just ran into the same problem, I used TGE from home, I forgot mine at work is a little modifed.

ok, do this instead

function onMissionLoaded()
{
	datablock ItemData(GridItem) 
	{ 
		mass = 1; 
		friction = 1; 
		elasticity = 0.3; 
		category = "Objects"; 
		shapeName = "~/data/shapes/markers/octahedron.dts"; 
	};

	// Create the Grid object 
	%gridObj = new Item(Grid_1) 
	{ 
		dataBlock = GridItem; 
		position = "12.193 -402.531 158.094"; 
		rotation = "1 0 0 0"; 
		scale = "1 1 1"; 
	};
	MissionCleanup.add(%gridObj);

}

The reason I put the datablock inside the function is that when the game.cs is called, a few things are not setup yet. The proper way would be to create another cs file add the datablock into that, and then call the new cs file by using exec from the onServerCreated function.
#22
10/28/2005 (10:42 am)
Thanks - but there still is a problem. for some reason, the DTS won't load. I can see an object name and number in the mission editor, but I can't see the actual object.

Is this a problem with my version of Torque? because I simply don't understand whats happening.

thanks,
Lee-Orr
#23
10/28/2005 (11:03 am)
Take a pill and relax please, remember what I previously posted about developing Problem Solving Skills, they don't come over night.

OK lets see what we have done.

1) You didn't have the object being created; this was indicated by the editor and later by actually checking the log.

2) You now have the object created, as indicated by your last post, you see name of the object in the editor.

3) But you still don't see the object.

So, by pressing F11 and looking at the objects around you, you see the name of the grid object somewhere? Right?

Is it close to you? If not, did you move to where it would be?

What is the position coordinates of the object compared to where your player is?

I expected you just used the coordinates from my post. For all I know, in your world, they could be underground. So as previously posted, look though your mission file. Find the grouping for your player spawnpoints. Copy the position from the first spawnpoint. Now go to your game.cs file and paste the copy in place of the position in the item.

Start your application, and go to each of the spawn points if you don't know which is which. Remember, you will need to move a bit away from the spawn point to see if the item is there.

Please post the position of the item and the position of the spawn point you use so I can do the same on my end.
#24
10/28/2005 (11:32 am)
@ Simon - I can see the name of the object, and it isn't underground. I am using the coordinates from your post, since these are the coordinates I wanted. the name actually has all the phisics of Torque applied to it, but it is only a point that can't be seen outside the mission editor( the point at the center of an object).

I also tried something else, I used what you posted in the FPS starter kit, and it worked(in the end), I finished this test and logged on to say it when I saw your answer.

Thanks alot for the help!!!

I really appreciate this!!!

Lee-Orr

P.S. Have a GREAT weekend.
#25
10/28/2005 (11:36 am)
Glad you got to see it somehow. At least you have an idea of how to do it now.

And you too have a great weekend.
#26
10/28/2005 (12:05 pm)
Aaah your issue, use another shape if you want to see the actual model, you're not gonna see the marker shape. It does exist to the engine, you just can't see the marker object last I checked.
#27
10/28/2005 (12:31 pm)
@ Simon - I can see the name of the object, and it isn't underground. I am using the coordinates from your post, since these are the coordinates I wanted. the name actually has all the phisics of Torque applied to it, but it is only a point that can't be seen outside the mission editor( the point at the center of an object).

I also tried something else, I used what you posted in the FPS starter kit, and it worked(in the end), I finished this test and logged on to say it when I saw your answer.

Thanks alot for the help!!!

I really appreciate this!!!

Lee-Orr

P.S. Have a GREAT weekend.
Page«First 1 2 Next»