Game Development Community

Mission Changing code in Trigger - difficult?

by Eric Morata · in Technical Issues · 03/20/2005 (9:31 pm) · 26 replies

Hello guys.I'm trying to make a functional warp to ANOTHER mission. It would unload the actual mission from memory and then load up an specified mission.
Doesn't work: application closes on my face with error. Here's the trigger code i'm trying to run:

at ...fps/server/scripts/trigger.cs :

]code start
datablock TriggerData(Teleporter1)
{
tickPeriodMS = 100;
};


$cenario1="starter.fps/data/missions/MissionOne.mis";

function Teleporter1::onEnterTrigger(%this,%trigger,%obj)
{
Parent::onEnterTrigger(%this,%trigger,%obj);
endMission(%this);
//endMission();
//loadMission( $cenario1, true ) ;
}

function Teleporter1::onLeaveTrigger(%this,%trigger,%obj)
{
Parent::onLeaveTrigger(%this,%trigger,%obj);
}

function Teleporter1::onTickTrigger(%this,%trigger) {
Parent::onTickTrigger(%this,%trigger);
}
]code end
Any help would be apreciated... I changed a load of things, but no sucess...
Thanks in advance;
Ericmor
Page«First 1 2 Next»
#21
08/14/2009 (12:14 pm)
I got it to work in T3D. Well, I haven't messed with spawn points yet, but I did get it to load the new mission. However, I have a couple of questions if anyone could be so kind to help me out with.

In post #1 of this thread, I can not figure out for the life of me why this function: function chat::onEnterTrigger(%this,%trigger,%obj) belongs to the namespace chat. Did this exist a while back, but not any more?

Also, now that I can go from one mission to another, I want to use that to simulate zones. But, the loading gui comes up between each mission. It completely destroys the game immersion, much worse than the several second pause itself. So, in missiondownload.cs I commented out this line:

//Canvas.setContent("LoadingGui");

which got rid of one gui, but then another one came up....

// Canvas.setContent(EndGameGui);

which I also commented out.

Now, I get a completey green screen (or black, depending on which mission I jump to) for about 2 to 3 seconds. If I quickly hit F10 it appears to be the playgui, but I don't think it actually is, at least not at that point. Can anyone tell me how to prevent that black screen from coming out, or suggest an alternative to my whole thought process?
#22
09/10/2009 (4:52 pm)
i cannot for the life of me figure out why i can't get this to work. I am attempting to get it to work in TGEA 1.8.1 and i can get it to switch missions just fine, but it never goes to the spawnsphere i tell it to.

i am positive i am naming the spawnspheres correctly because nameToID works perfectly for them.

if ( $Game::NextSpawn !$= "" ) {  
  
      %spawn = nameToID( %groupName @ "/" @ $Game::NextSpawn );
	  echo("*****LOOK*****");
	  echo(%spawn);
      $Game::NextSpawn = "";  
      if ( %spawn != -1 ){  
		 echo("THIS SHOULD BE WORKING");
         return %spawn.getTransform();  
		 }
   }

the echos i put in are showing correctly on the console, showing the correct ID for the spawnsphere i put in and passing the check for -1, so this should be working. i just don't get it. it seems like it doesn't end the function after it returns the %spawn.getTransform() and moves right on to the default
#23
09/10/2009 (4:59 pm)
i added in another echo in the default pickSpawnPoint and it is indeed going through that one after it already returns the first %spawn.getTransform()
#24
09/11/2009 (7:02 am)
>Damsky: the chat::onEnterTrigger reference was my bad as I copied a modified chat trigger when i posted. It is not needed and the already posted and completed working code should work.

>Patton: instead of changing the mission, you could combine two maps by going into the "repeat" landscape (if you run outside the map limit area, the landscapes repeat with no objects included) if the map area of the 1st map is the same landscape as the changing to map. Just put in either a timed respawn change for all players OR a trigger spawn change for all players. The old "PlanetBang" server had several maps that would change areas; thus changing the play slightly as flag/ball carriers could change the play area while holding the flag/ball.

HOWEVER, if u do use the repeated landscape trigger, DONT change the actual landscape in the repeated area or it may affect your original.

ALSO, somewhere on the forums is an older post citing a code for a layered map system; where there is no map boundaries per se, but a duplicated extension of the map area. If you included that coding, you could then change the repeated landscape area. Note this will increase the size of your map though, and as such, will take longer to d/l the map through the game engine to the connecting clients. BUT, no load mission screen and instant transport to game play for all players. Just requires multiple Spawnshere identities to be included into the map.
#25
09/11/2009 (12:06 pm)
>Chris.Ratliff:

it might help if i told you the scenario behind why i'm implementing this. basically i am doing a virtual college campus and we are instancing all of the rooms in each building.

so, for example, if we are in a hallway and go into door A, right now i can change missions to the room A mission, but when i exit the room, it will not spawn me at spawnsphereDoorA where i zoned into the room from even though i specified it in the trigger as the one i wanted to spawn at.

the echo i put in shows the correct spawnsphere being chosen, but then spawns me at index 0 showing that it never returned that spawn and just skipped to the next part of pickspawnpoint()


so really my problem isn't getting the missions to change, it's spawning at the correct spawnsphere that isn't working for me.


ps: i really do appreciate the help, and i never knew about that feature of repeating landscape :)
#26
09/11/2009 (4:35 pm)
Just a reminder, folks... this code was resourced, OUTDATED and abandoned already... look for mission changing code or something, someone had incorporated it into a real working one back in the day, didn't remember who or where now... that's because i'm not using torque anymore, i returned to use 3d gamestudio ;P
Page«First 1 2 Next»