Teleporting in game.
by michael · in General Discussion · 01/24/2009 (2:32 pm) · 11 replies
Hey All im new here and I was told by my instructor to come to these forums to get info on how to make a character teleport from one location to another with the push of a button in game. We are learning this week about "commandToServer” and “commandToClient” so this ties in with that. So im guessing there is a simple way to do this since the Torque engine seems to be one step ahead of me all the time.
Any ideas as to how I would go about this? What commands should I look into?
My guess is that I need to simple update my characters coordinates to another but since Ive just started Im not sure if thats what I need to do or not.
Thanks All!
Mike
Any ideas as to how I would go about this? What commands should I look into?
My guess is that I need to simple update my characters coordinates to another but since Ive just started Im not sure if thats what I need to do or not.
Thanks All!
Mike
About the author
#2
I tried this:
PlayerKeymap.Bind(keyboard, t, commandToServer('TeleportPlayer', %newPosition));
But it doesnt work I also tried:
if(PlayerKeymap.Bind(keyboard, t,null))
{
commandToServer('TeleportPlayer', %newPosition);
}
That didnt work either. Like I said im new to how everything works with torque script so what seems logical to me as far as programming im not sure if its the same here.
01/24/2009 (4:56 pm)
Thanks for that! I have a quick question for you I have implemented the teleporting but im having trouble binding the command to a keyI tried this:
PlayerKeymap.Bind(keyboard, t, commandToServer('TeleportPlayer', %newPosition));
But it doesnt work I also tried:
if(PlayerKeymap.Bind(keyboard, t,null))
{
commandToServer('TeleportPlayer', %newPosition);
}
That didnt work either. Like I said im new to how everything works with torque script so what seems logical to me as far as programming im not sure if its the same here.
#3
01/24/2009 (5:34 pm)
Get the Game Programmer's Guide to Torque. The game you make in the tutorial has you teleport. I can not tell you how helpful that book is. It covers SO much about the Torque Game Engine and TorqueScript.
#4
01/24/2009 (5:54 pm)
moveMap.bind(keyboard, "YOUR KEY", YOUR COMMAND);
#5
moveMap.bind(keyboard, "t", commandToServer('TeleportPlayer', %newPosition));
???
01/24/2009 (10:08 pm)
so would this execute correctly:moveMap.bind(keyboard, "t", commandToServer('TeleportPlayer', %newPosition));
???
#6
The best lessons learned are from mistakes one creates for themselves.
01/24/2009 (11:01 pm)
Is that a questing you truly need someone to answer for you? Where is your scientific spirit? Experiment! The best lessons learned are from mistakes one creates for themselves.
#7
moveMap.bind(keyboard, "t", commandToServer('TeleportPlayer', %newPosition));
and it didnt work so can someone please tell me how to bind commandToServer functions to keys??
01/25/2009 (3:23 pm)
I tired:moveMap.bind(keyboard, "t", commandToServer('TeleportPlayer', %newPosition));
and it didnt work so can someone please tell me how to bind commandToServer functions to keys??
#8
01/25/2009 (3:58 pm)
Seriously, look at the GPGT. It goes over that. I would tell you but that would be reproducing parts the book (which=illegal). And plus, the book is worth the money. It tells A LOT about the Torque Game Engine.
#9
01/25/2009 (4:04 pm)
Is there any one who can tell me how to simply bind a commanToServer Function to a key. I know its got to be easy but I just dont know the syntax for torque script to well.
#10
michael, i cant truly dig up my scripts right now, but use whatever edit program you use, and search for moveMap.bind and learn from the way OTHER commands are .bind to keys. I learn a good 80% of what i know by observing how others do the things i wish to do. The ability to research is truly your greatest asset as any type of game designer, content creator.
01/25/2009 (5:27 pm)
xxShanexx09, it would not be illegal, it would be helpful. michael, i cant truly dig up my scripts right now, but use whatever edit program you use, and search for moveMap.bind and learn from the way OTHER commands are .bind to keys. I learn a good 80% of what i know by observing how others do the things i wish to do. The ability to research is truly your greatest asset as any type of game designer, content creator.
#11
caylo actually did answer your question with a direct answer. You call your function to teleport in your keybind. Not the spawn point.
01/25/2009 (7:19 pm)
client/scripts/default_bind.cs is your friend when looking for how to bind a key to a function.caylo actually did answer your question with a direct answer. You call your function to teleport in your keybind. Not the spawn point.
Torque 3D Owner Caylo Gypsyblood