Game Development Community

Changing level after x amount of time

by Ted Jones · in Torque 3D Professional · 06/08/2012 (3:12 pm) · 5 replies

I searched around but all I could find for switching levels in t3d was to use a trigger. What I would like to do is after x amount of time, or even after x amount of enemies have been killed, move the player to the next level. I'm a bit of a script noob, so if anyone could point me in the right direction that would be great.

About the author

Recent Threads


#1
06/09/2012 (4:51 am)
The T3D, basic version of the engine is FPS style and does not support player level, mob exp drop etc. But it is easy to do it yourself.
Set sizes of level experience, and add on AI a variable for drops.
example:
%client.name = 'elf'; // ' = "
use an array $level50...
$level1 = 1000;
$level2 = 2200;
....
$level50 = 500000;
and
%player.client.name.exp = 0;
%player.client.name.lvl = 1;

in the npc datablock add dropExp = 500;

on system/player.cs on damage use this drop after npc die

%sourceObject.client.name.exp += %obj.datablock.dropExp; //%obj = npc, %sourceObject = player


remember level1 is 'level' @ 1, use this loop for level check


%thislevel = $level[%player.client.name.lvl +1];
if(%sourceObject.client.name.exp > %thislevel)
%player.client.name.lvl += 1;
#2
06/09/2012 (5:05 am)
because every time a player makes login have another id, use for saves the player name and make a mini account manager to check for name duplicate.
#3
06/09/2012 (9:56 am)
I'm assuming level change here means mission change? If your project is based upon the Full Template there is already code in place to do both of those: cycle level based upon score and/or cycle level based upon time limit, but the cycle level mechanism may be disabled.

In ?GameType? ::initGameVars() you'll find this:
// Set the gameplay parameters
%game.duration = $Game::Duration;
%game.endgameScore = $Game::EndGameScore;
%game.endgamePause = $Game::EndGamePause;
%game.allowCycling = false;   // Is mission cycling allowed?
Change that bool to true and level cycling will occur on the conditions of a certain score being reached or upon the set time limit. Those $Game variables are set at the top of game.cs, but certain GameTypes may override them.

For example in GameDM::initGameVars()
// Set the gameplay parameters
%game.duration = 30 * 60;
%game.endgameScore = 20;
%game.endgamePause = 10;
%game.allowCycling = false;   // Is mission cycling allowed?
This means that for the DeathMatch gametype these settings will override those that were declared in game.cs or the default GameType
#4
06/09/2012 (11:17 am)
Yes I should have been more clear, I did mean mission change. Now I feel stupid that it was so simple lol. Thanks for the help Micheal
#5
06/10/2012 (11:27 am)
Just remember, doing so will make you need to load the new mission every time the timer does go off.

I'd recommend using a really.... "really" big mission, with different zones, that way when you complete a phase, you can just move the player to the new zone. For skies and such, you can hide or create the new skies for each zone as you move into them, thus removing the loading factor for each new mission.

You'll also save on file count/size in the long run if you're concerned about that.

Either way, both solutions should accomplish what you want. Good Luck!