Game Development Community

Mission area collidable in tute base without compiling?

by Adam Fiannaca · in Torque Game Engine · 08/28/2004 (9:29 pm) · 7 replies

Is there any way of making the mission area unpassable / so player cant go out of mission area without having to compile?
have tried the resource stuff, it didnt work for us and under some time constraints - also shameless newbie:) when we input the code from the resource as its in the engine..all we get on tute playback is a visible mesh but no collision- would love to be able to do this withou compile.

what I was hoping to do is a quick fix thing for the tute base mission that wouldnt require finding a complier and would get it done fast...should the resource suggestion / code work in tute base mission without compiling?
the only way I can seem to work something out is to place shapes around it which is messy and time consuming.


any help would be greatly appreciated
sinder & kiah

#1
08/30/2004 (12:20 am)
Hello? any help on this...
#2
08/30/2004 (1:47 am)
Well, I'd look at Armor::onLeaveMissionArea() which is called (in script) when someone leaves the mission area, and you could put them back in it. The LakRabbit mod for Tribes 2 does this, google it and I'm sure you can find the source and how they did it, it's almost certainly applicable to the current Torque.

Ian
#3
09/04/2004 (10:59 pm)
Hi Omroth,
cant seem to find amor...but will take another peek. also for anyone is it true that joystick has trouble working? as we tried enabling etc but it still wont work - once again, not big on compiling right now so any in mission ways of doing it would be cool...had a look at the resources available for it but to no avail.
#4
09/06/2004 (12:04 pm)
You need to look in the server/player.cs file.

You should be able to set the position of the player back a bit once this script is triggered. (As a quick fix, I would probably just set the position of the player back a bit, towards the center of the mission area.)
#5
09/06/2004 (5:59 pm)
Thanks William,found it late last night and have played with all the settings but looks like I actually need the code as I have no idea what to change or set..very new to scripting stuff -this is one thng I am completely unsure about - am trying to locate the lakrabbit mod for its code apparnetly its in there...stressed!
#6
09/06/2004 (6:16 pm)
Thanks William,found it late last night and have played with all the settings but looks like I actually need the code as I have no idea what to change or set..very new to scripting stuff -this is one thng I am completely unsure about - am trying to locate the lakrabbit mod for its code apparnetly its in there...stressed!
#7
09/06/2004 (8:03 pm)
It's not too complicated. Although I've never tried it, I could probably give you a good direction to go in.

There is a global "variable" called MissionArea that you can always access. You can then call getArea on that. That function returns four numbers with spaces between them: start x, start y, x extent, y extent. There is a function called getWord which can get you those words (with word zero being the first word). The second argument in Armor::onLeaveMissionArea() is the player. You can then set their position to be closer to the center of the mission area.

Roughly:
Armor::onLeaveMissionArea( %this, %obj )
{
  %maAttributes = MissionArea.getArea();
  %maXCenter = getWord(%maAttributes,0) + getWord(%maAttributes,2)/2;
  %maYCenter = getWord(%maAttributes,1) + getWord(%maAttributes,3)/2;
  %maZCenter = 100; // Somewhere high-ish.
  %maCenter = %maXCenter SPC %maYCenter SPC %maZCenter;

  %mePos = %obj.getPosition();

  %pullBackDistance = 10; // How far back.
  %backDir = VectorNormalize( VectorSub( %maCenter, %mePos ) );
  %backDir = VectorScale( %backDir, %pullBackDistance );

  %obj.setTransform( VectorAdd( %mePos, %backDir ) );  
}
Like I said... I've never tried this, but it is a good place to start.