Script Spawn Points
by Leonardo Ferrer · in Torque Game Engine · 09/13/2008 (8:20 am) · 4 replies
Hi,
I want to script spawn points as the following:
The user has a menu in which he selects 1 of 4 places to start, and each one has a different Spawn Point, how can I assign dynamically the spawn point of a certain level?
Thanks for your help :-)
I want to script spawn points as the following:
The user has a menu in which he selects 1 of 4 places to start, and each one has a different Spawn Point, how can I assign dynamically the spawn point of a certain level?
Thanks for your help :-)
About the author
#2
%player.setTransform(SpawnPoint);
But I can't assign it directly, nor launch the GUI at the initialization of the level.
So I tried to a MovePlayer(%this, 7 data transfrom); but it only crashed the engine, I need to restart the player?
09/14/2008 (2:25 pm)
Well I've actually thought about a:%player.setTransform(SpawnPoint);
But I can't assign it directly, nor launch the GUI at the initialization of the level.
So I tried to a MovePlayer(%this, 7 data transfrom); but it only crashed the engine, I need to restart the player?
#3
09/14/2008 (3:52 pm)
You would have to setup your spawn points as globals. ($SpawnPoint) and figure out a way for the player to spawn into it. You could also do it the way Ed Maurina does it in his first book and have the player spawn inside a box while the gui is over it, then just reset the players transform to your chosen spawn point before the gui disapears so they don't even know they've been imprisoned inside a black box.
#4
Nevertheless is nice that people in this forum are willing to help, thanks again for you time.
09/15/2008 (7:45 am)
Thanks you both for your help but I've already figured it out. I made a global $spawnPoint, just as Mike Rowley said, but I made a script for the GUI with 2 functions = setSpawn(Transform) and getSpawn(), just set the command of the GUI to the setSpawn and the transform I already knew it and modified pickSpawnPoint() to my getSpawn(), in the server init process.Nevertheless is nice that people in this forum are willing to help, thanks again for you time.
Torque 3D Owner Bruce Wallace
either have your menu set a variable to where your menu item will place the player, or the name of a spawnsphere might be better if you want to move it around a little.
then in game.cs at the bottom there is a function that picks a spawnpoint from a group in the mission file. you can either modify this function or redirect the spawning chain to your own code.
I don't know the details of how you want to spawn players or how far you are, but off the top of my head:
At first pass i'd just make a quick GUI with 2 buttons
When a button is pressed, call a command to server function to:
set the location
kill the player if he is already spawned, fade him out or whatever
then call createplayer (also in the bottom of game.cs) with the location of your new spawn point.