Spawn as Player, respawn as Vehicle...
by rcdisprogrammer · in Torque 3D Beginner · 04/22/2013 (6:19 pm) · 2 replies
I've set up a few test scenarios using only vehicle spawns and only player spawns (with vehicles pre-added). Since the game is a space flight/action hybrid, I'm trying to avoid mounting and dismounting existing vehicles (good for GTA style but sloppy for this example), prefering to respawn as a flying vehicle chosen through a gui button command. I must be doing something wrong because when I attempt to use the "setControlObject" command my player just respawns as himself at the designated spawn sphere and not as the vehicle.
Any suggestions?
Any suggestions?
#2
%player.setControlObject(%vehicle)
%player.setControlObject(%obj)...Among some others
most of the time the console just tells me "Unable to find object '' "
new SpawnSphere(PlayerSpawn) {
spawnClass = "Player";
spawnDatablock = "DefaultPlayerData";
autoSpawn = "0";
spawnTransform = "0";
radius = "1";
sphereWeight = "1";
indoorWeight = "100";
outdoorWeight = "100";
isAIControlled = "0";
dataBlock = "SpawnSphereMarker";
position = "16.2475 489.62 506.749";
rotation = "1 0 0 0";
scale = "1 1 1";
canSave = "1";
canSaveDynamicFields = "1";
};
new SpawnSphere(VehicleSpawn) {
spawnClass = "FlyingVehicle";
spawnDatablock = "Spaceship";
spawnScript = "%player.setControlObject(%obj);";
autoSpawn = "0";
spawnTransform = "1";
radius = "1";
sphereWeight = "1";
indoorWeight = "100";
outdoorWeight = "100";
isAIControlled = "0";
dataBlock = "SpawnSphereMarker";
position = "-232.071 483.438 499.052";
rotation = "1 0 0 0";
scale = "1 1 1";
canSave = "1";
canSaveDynamicFields = "1";
};
And in the "VehicleSelection.gui"....
new GuiBitmapButtonTextCtrl() {
bitmap = "screenshot_005-00000.png";
bitmapMode = "Stretched";
autoFitExtents = "0";
useModifiers = "0";
useStates = "1";
text = "Spaceship";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "23 208";
extent = "233 182";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
command = "VehicleSpawn.spawnObject();Canvas.popDialog(VehicleSelection);";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
04/23/2013 (9:05 am)
Thank you Ahsan...Heres the code for the Spawn Spheres in the .mis file and .gui. I've tried various versions of the "setControlObject"...%player.setControlObject(%vehicle)
%player.setControlObject(%obj)...Among some others
most of the time the console just tells me "Unable to find object '' "
new SpawnSphere(PlayerSpawn) {
spawnClass = "Player";
spawnDatablock = "DefaultPlayerData";
autoSpawn = "0";
spawnTransform = "0";
radius = "1";
sphereWeight = "1";
indoorWeight = "100";
outdoorWeight = "100";
isAIControlled = "0";
dataBlock = "SpawnSphereMarker";
position = "16.2475 489.62 506.749";
rotation = "1 0 0 0";
scale = "1 1 1";
canSave = "1";
canSaveDynamicFields = "1";
};
new SpawnSphere(VehicleSpawn) {
spawnClass = "FlyingVehicle";
spawnDatablock = "Spaceship";
spawnScript = "%player.setControlObject(%obj);";
autoSpawn = "0";
spawnTransform = "1";
radius = "1";
sphereWeight = "1";
indoorWeight = "100";
outdoorWeight = "100";
isAIControlled = "0";
dataBlock = "SpawnSphereMarker";
position = "-232.071 483.438 499.052";
rotation = "1 0 0 0";
scale = "1 1 1";
canSave = "1";
canSaveDynamicFields = "1";
};
And in the "VehicleSelection.gui"....
new GuiBitmapButtonTextCtrl() {
bitmap = "screenshot_005-00000.png";
bitmapMode = "Stretched";
autoFitExtents = "0";
useModifiers = "0";
useStates = "1";
text = "Spaceship";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
position = "23 208";
extent = "233 182";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiDefaultProfile";
visible = "1";
active = "1";
command = "VehicleSpawn.spawnObject();Canvas.popDialog(VehicleSelection);";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "0";
canSave = "1";
canSaveDynamicFields = "0";
};
Ahsan Muzaheed
Default Studio Name
1.set your player's datablock.
2.set player's class.
in script files u will find
"$Game::defaultPlayerClass = "Player";
$Game::defaultPlayerDataBlock = "DefaultPlayerData";
;"
these variable are defined in several places.u have to adjust them all on your need.
" through a gui button command. I must be doing something wrong because when I attempt to use the "setControlObject" command my player just respawns as himself at the designated spawn sphere and not as the vehicle. "
better if u post your gui buttons definition
and
spawnsphere's definition from *.mis file.