Game Development Community

objects and in game gui screens.. and teleporting

by Michael Zajac · in Torque Game Engine · 08/22/2001 (1:58 pm) · 9 replies

How would I go about making a simple object that can be picked up? Also, I want to binds F1 to popping up a gui screen that will bring up the mouse..

Also, is there anyway of getting a gui button to teleport a player to a specified point on the map?

#1
08/23/2001 (6:34 pm)
Hrm.. no responses yet.. Maybe if I say exactly what I want to do..?

I want to make a linking book(if you played the game Myst, you know what I am talking about). You can use the book to link to other worlds, or in my case, other places on the map. I want to make this book pickup-able(?), and when you press a key, say um.. F1, a gui screen will popup. In the gui screen there would be a button that would make you spawn at a certain point on the map when pressed. And when you respawn, you drop that object, but only that one. I also need help with the HUD icon for when you pick it up.. heheh. I am not sure how I can go about doing all this.. Can anyone help? :-)
#2
08/23/2001 (7:34 pm)
As for making an item that can be picked up, look at the threads on weapons, with some scripting you can change the item from a weapon to whatever. You would want to change it so that it doesnt try to mount on to the player, but rather in the players inventory (look at the weapons.cs script in tribes2... the HandInventory items in particular) although I havnet figured out how to access the inventory items quite yet... Im a newbie at t2 scripting...

Teleporting.. no idea.. seen it in some of the t2 scripts but havent looked at it...
#3
08/23/2001 (8:25 pm)
Well... not quite teleporting.. just respawing at another drop point..
#4
08/24/2001 (9:04 pm)
Saw this in server.cs, maybe it'll point ya in the right direction...

if (%spawnLoc == -1) //if there is no spawn location...
%spawnLoc = "0 0 300 1 0 0 0"; //...spawn here
%player.setTransform( %spawnLoc ); //move to the spawn location

You'd have to play around with the numbers in %spawnLoc to find out what they are.. I would GUESS its
x,y,z.. then maybe a rotation heading... no idea really tho...
#5
08/25/2001 (5:10 pm)
I'm trying to make a serve function that respawns the play a certain point.. I used the current spawn functions and turn them into:

function respawnInPrison(%client)
{
   %spawnPoint = pickSpawnPoint(%client);
   createPlayerPenned(%client, spawnPoint);
}

function createPlayerPenned(%client, %spawnLoc)
{
   if (%client.player > 0)
      error( "Attempting to create an angus ghost!" );
   
   // Create the player object
   %player = new Player() {
      dataBlock = LightMaleHumanArmor;
   };
   MissionCleanup.add(%player);
   
//   if (%spawnLoc == -1)
      %spawnLoc = "100 100 350 1 0 0 0";

   %player.setTransform( %spawnLoc );
   %client.camera.setTransform(%player.getEyeTransform());

   // Setup some info
   %client.player = %player;
   %player.client = %client;
   %player.setEnergyLevel(60);

   // Give the client control of the player
   %client.setControlObject( %player );
}

I'm not very good with this scripting.. Would that function work if used? And would I be able to bind it to a key?
#6
09/01/2001 (7:36 am)
No on knows? :-(
#7
09/01/2001 (12:34 pm)
I actually find the question pretty interesting and I suspect we are working on similar projects although I wasn't going to copy Myst's book theme... :)

Try this. The terrain editor allows you to move a character around. Load the scorched earth mission. When it comes up hit F11 to call up the editors. Click on the mission area box in the upper right hand corner to bring up a map of the mission area. If you click with your mouse inside the mission area your character will jump to that point.

The gui code to perform those operations is in the editors and it should be easy enough to extract just the pieces necessary to use it to "bring up a book" with the map in it of your game area.

Instant (but imperfect) teleport...

Good luck.
#8
09/02/2001 (7:03 pm)
Er.. nevermind..

I just need to figure out now how to enable the player to drop an object..
#9
09/04/2001 (8:47 pm)
I've put together a short "article" example of how to throw an object, maybe not exactly what your looking for, but it may give you some ideas....