Game Development Community

[Need Help]t A few things I'm trying to do.

by Neal Guzman · in Torque 3D Professional · 12/12/2010 (5:18 pm) · 6 replies

1. Load up different levels with a level select screen. Upon using the command Startlevel("levels/level1.mis"); The game just freezes.

2. Get health numbers to show above AI when hit. Like in RTS's or some RPG's

I have no idea how to do either of these.

I've tried several variations of coding before I posted here I would appreciate some sort of help here.

As you can see below I'm using my own MenuGui

/-----------------------------------------------------------------------------

function loadMainMenu()
{
   // Startup the client with the Main menu...
   if (isObject( Menu))
      Canvas.setContent( Menu);

   Canvas.setCursor("DefaultCursor");
      
   // first check if we have a level file to load
   if ($levelToLoad !$= "")
   {
      %levelFile = "levels/";
      %ext = getSubStr($levelToLoad, strlen($levelToLoad) - 3, 3);
      if(%ext !$= "mis")
         %levelFile = %levelFile @ $levelToLoad @ ".mis";
      else
         %levelFile = %levelFile @ $levelToLoad;
         
      // let's make sure the file exists
      %file = findFirstFile(%levelFile);
         
      if(%file !$= "")
      {
         createServer( "SinglePlayer", %file );

         %conn = new GameConnection(ServerConnection);
         RootGroup.add(ServerConnection);
         %conn.setConnectArgs($pref::Player::Name);
         %conn.setJoinPassword($Client::Password);
         %conn.connectLocal();
      }
   }
}
then using the playgui

function PlayGui::onWake(%this)
{

   // Turn off any shell sounds...
   // sfxStop( ... );

   $enableDirectInput = "1";
   activateDirectInput();

   // just update the action map here
   moveMap.push();

   // hack city - these controls are floating around and need to be clamped
   schedule(0, 0, "refreshCenterTextCtrl");
   schedule(0, 0, "refreshBottomTextCtrl");
   
   //push welcome GUI to call the "startourgame" function for our games
if(!$start)
 {
   canvas.pushdialog(startourgame);
   $start = 1;
   
 }
 
}

About the author

I am an GUI Artist, HUD Artist, Texture Artist, GUI Editor, and Programmer and Game Designer/Developer. I know and still am learning c# and torque script. I earned my Bachelors' of Science in Game Design and Development on 12/16/11


#1
12/12/2010 (5:50 pm)
1) didn't notice anything obviously wrong, what about the level select code itself? Check to make sure it's passing the correct parameter(s).

2) check this Resource
#2
12/12/2010 (6:10 pm)
It's a nice resource, however I couldn't find the directory to load it up. There isn't a Gui/game folder.
so would i put this in my scripts folder and the type is C++ and not the familure torque script that i'm familure with
#3
12/12/2010 (6:20 pm)
It is a C++ solution that you would have to add to the engine source and recompile.

If that is unfamiliar territory you could try using particles to display the damage information through script.... I remember something from the T2D forums that did this that I thought could be easily adapted to T3D. It simply used a "number set" of particles and figured out what to display through a string to image substitution. When the player is damaged you would then dynamically add a particle emitter node that would be used to pop up the particle "number".
#4
01/07/2011 (6:55 pm)
I figured out the level select on my own. Still need that RTS simplified code. Not C++ I don't get c++ I struggle grasping this. Maybe it be easier if I got the RTS kit?

//edit

Seems the RTS kit isn't available anymore.
#5
01/07/2011 (7:17 pm)
also trying to get a paper airplane to fly correctly

datablock FlyingVehicleData(FLYINGVEHICLE2)
{   
    category = "Vehicles";
    spawnOffset                = "0 0 4";  //0 0 4
    emap                           = true;
    shapeFile                     = "art/shapes/MyShapes/Airplane/Airplane.dae";
    multipassenger            = false;
    computeCRC                = true;
                	
    drag                            = 0.25; //0.25
    density                         = 1.0; //1.0

   // jetNozzle1 = playerWeaponExplosionParticle;

// Camera Settings
    cameraOffset                = 1.5;  // Vertical offset from camera mount point // 1.5
	cameraMaxDist           = 1;  //16
	cameraOffset            = 0.0;
	cameraLag               = 0.1;
    cameraRoll                  = false; // Roll the camera with the vehicle


    minDrag                   = 81; // Linear Drag (eventually slows you down when not thrusting...constant drag)
    rotationalDrag            = 100; // Anguler Drag (dampens the drift after you stop moving the mouse...also tumble drag) //60

    maxAutoSpeed	      = 10; // Autostabilizer kicks in when less than this speed. (meters/second) //10
    autoAngularForce          = 900; // Angular stabilizer force (this force levels you out when autostabilizer kicks in) //900
    autoLinearForce           = 300; // Linear stabilzer force (this slows you down when autostabilizer kicks in)
    autoInputDamping          = 0.55; // Dampen control input so you don't` whack out at very slow speeds

// Maneuvering
    maxSteeringAngle          = 1; // Max radiens you can rotate the wheel. Smaller number is more maneuverable. //1
    horizontalSurfaceForce    = 10; // Horizontal center "wing" (provides "bite" into the wind for climbing/diving and turning) //20

    verticalSurfaceForce      = 10; // Vertical center "wing" (controls side slip. lower numbers make MORE slide.) //20
	 maneuveringForce          = 1300; // Horizontal jets (W,S,D,A key thrust) //default 27000
    steeringForce             = 1200; // Steering jets (force applied when you move the mouse) //6000
    steeringRollForce         = 10; // Steering jets (how much you heel over when you turn) //500
    rollForce        		= 200; // Auto-roll (self-correction to right you after you roll/invert)//900
    hoverHeight        		= 1.5; // Height off the ground at rest //1.5
    createHoverHeight         = 1.0; // Height off the ground when created //0.5
    maxForwardSpeed        	= 20; // speed in which forward thrust force is no longer applied (meters/second) //90
	
	 
// Turbo Jet
//    jetForce        		= 3000; // Afterburner thrust (this is in addition to normal thrust)
//    minJetEnergy        	= 28; // Afterburner can't be used if below this threshhold.
//    jetEnergyDrain        	= 2.8; // Energy use of the afterburners (low number is less drain...can be fractional)
//    vertThrustMultiple        = 3.0; // Auto stabilize speed

// Rigid body
    mass                      = 10; // Mass of the vehicle //default 300
    integration               = 3; // Physics integration: TickSec/Rate
    collisionTol              = 0.6; // Collision distance tolerance
    contactTol                = 0.4; // Contact velocity tolerance

    bodyFriction              = 0; // Don't mess with this.
    bodyRestitution           = 0.8; // When you hit the ground, how much you rebound. (between 0 and 1)
    minRollSpeed              = 2000; // Don't mess with this.

    checkRadius               = 5.5;
    observeParameters         = "0 0 1";
//    shieldEffectScale         = "0.937 1.125 0.60";

// Ground Impact Damage (uses DamageType::Ground)
minImpactSpeed = 10; // If hit ground at speed above this then it's an impact. Meters/second
speedDamageScale = 0.06;

// Object Impact Damage (uses DamageType::Impact)
collDamageThresholdVel = 23.0;
collDamageMultiplier = 0.02;


  nameTag = 'FLYINGVEHICLE2';
};


function FLYINGVEHICLE::onCollision(%thisDB, %thisObj, %otherObj)
{       
        $PHealth --;
        Healthtext.settext("Health =" SPC $PHealth);
        if($PHealth > 0)
        GameOver();     
}

Added somethings that I thought were missing.

Any help would be nice.
#6
01/22/2011 (9:48 am)
Should Note the above code is for a paper airplane.