Game Development Community

BF2 Style Capture the Flag Updated

by mb · in Torque Game Engine · 02/27/2007 (10:29 pm) · 0 replies

I updated my trigger a while back to include models that get switched for capture the flag style game. I added the resource but I messed up and forgot to click the link to get the url so I'll have to wait for it to be approved. This goes along with the team implementation resource.

Here is how it is used.

1. Create a directory in \data\shapes\ called "flag"

2. Put three different dts models in you new directory called "flag1.dts", "flag2.dts", "sphere.dts" - the names can be changed just be sure to change the code that points to the dts objects.

3. Copy the areatrigger.cs into \server\scripts

4. Go into your game

5. Add a simset in world creator and name it whatever you want. Lets call it "flag1"

6. Add a trigger, and place it in the sim set you just created in step 5 : "flag1".

7. Add the "sphere.dts" object and place it in that same simset : "flag1".

NOTE: This makes use of simsets. You must make a NEW simset for each capture area and put a neutral flag "sphere.dts" inside the same simset for it to work. There's no limit known to me for how many capture areas you can have.

Now when you enter the trigger the counter will count up and when it reaches 100 the model will switch to your teams flag. If the model is the other teams flag it will count down and then switch to your teams flag. If both teams are in the trigger it blocks the capture. I haven't tested multiplayer. Any problems let me know. Link to code is below:

www.justsnowboarding.com/hs/users/1/area_trigger.rar

PS: I forgot I had extra code in their I didn't clean up. You'll notice some variables that were added: $TeamTwo.capturedPoints, $TeamOne.capturedPoints, %obj.client.team.score (score might already be there). It should still work without those but I thought I'd mention it anyways.