Swithching missions using triggers
by Enemicalix · in Torque Game Engine · 06/28/2007 (3:02 am) · 7 replies
How can i use triggers to load a certain mission when i walk into it.
i also want to be able to choose a certain spawn point for the switch.
and also is it possible to fade out the screen and initialize a gui with a video in it while the level is loading and then fade in once the video is finisheda dn the mission has loaded.
thanks in advance
i also want to be able to choose a certain spawn point for the switch.
and also is it possible to fade out the screen and initialize a gui with a video in it while the level is loading and then fade in once the video is finisheda dn the mission has loaded.
thanks in advance
#2
EDIT: also, how do I paste this into a .cs without it all just sprawling out on a single line?
07/08/2007 (5:38 pm)
Where should this code be placed? In the triggers.cs in the server folder?EDIT: also, how do I paste this into a .cs without it all just sprawling out on a single line?
#3
07/31/2007 (2:59 pm)
Use Notepad/Wordpad instead of a code editor.
#4
08/01/2007 (7:35 am)
Can this be used with the free version of TGE or do I need access to source code for this?
#5
08/01/2007 (7:38 am)
Free version is fine, you only need script access.
#6
i cant seem to find a way to specify an actual mission. i have 3 "portals" in the level and a trigger placed on each of them. i want each trigger to launch a different mission.i want to be able to use just 1 trigger function and block. i also want to be able to specify what gui to load.
can it be done by creating some sort of dynamic variables where i can specify a certain value in each different trigger?
08/04/2007 (5:26 am)
Thats very similar to waht im currently using.i cant seem to find a way to specify an actual mission. i have 3 "portals" in the level and a trigger placed on each of them. i want each trigger to launch a different mission.i want to be able to use just 1 trigger function and block. i also want to be able to specify what gui to load.
can it be done by creating some sort of dynamic variables where i can specify a certain value in each different trigger?
#7
04/21/2009 (11:40 am)
Espero que me pueda servir
Employee Michael Perry
ZombieShortbus
Assuming you already have a fade-out GUI, or video gui built and ready for use and you know the filepath of the mission you want to connect to:
[b]///////////////////////////////////////////// // SERVER SIDE CODE[/b] datablock TriggerData(Test) { tickPeriodMS = 100; }; function Test::onEnterTrigger(%this,%trigger,%obj) { Parent::onEnterTrigger(%this,%trigger,%obj); commandToServer('changeLevel', "starter.fps\data\missions\nextMission.mis"); } function serverCmdchangeLevel(%client, %filePath) { commandToClient(%client, 'loadMission', %filePath); commandToClient(%client, 'pushTransitionGui'); } function Test::onLeaveTrigger(%this,%trigger,%obj) { Parent::onLeaveTrigger(%this,%trigger,%obj); } function Test::onTickTrigger(%this,%trigger) { Parent::onTickTrigger(%this,%trigger); } [b]// SERVER SIDE CODE /////////////////////////////////////////////[/b] [b]///////////////////////////////////////////// // CLIENT SIDE CODE[/b] function clientCmdloadMission(%mission) { // make sure we are not connected to a server already disconnect(); // Create the server and load the mission createServer("SinglePlayer", %mission); // Make a local connection %conn = new GameConnection(ServerConnection); RootGroup.add(ServerConnection); %conn.setConnectArgs("Player"); %conn.setJoinPassword("None"); %conn.connectLocal(); } function clientCmdpushTransitionGui() { Canvas.setContent(TransitionGui); TransitionGui.start(); [b]// Made up function that starts a video or fade-out, you have to code this yourself[/b] } [b]// CLIENT SIDE CODE /////////////////////////////////////////////[/b]That's some "starter" code, just one concept of loading a new mission with a transition. I'll go back over it and check syntax and stability in a bit, but I hope that helps a little.