Game Development Community

A Basic Capture the Flag Setup

by Anthony Rosenbaum · in Torque Game Engine · 06/05/2002 (12:25 pm) · 5 replies

OK, this one goes out to the Pros like Phil and LabRat. Let me expain where I started and where I am at. I began by adding flag elements from Labrat's resource. In that post, Phil posted where to find his implimentation of Labrat's flags in RWTA5.0 which I d/l and begane to study.
First question to Phil, you said it will add 50pnts for a capture. But I can only find 1 flag (no second to cap at) and about 6 towers which active team dependant smoke, but no captures. Maybe it got remove from the build but I just can't get it to score.
Anyway I used Phil's teamObjectives.cs for the team flag and teamflag trigger elements. They appear in the editor, but when I put a teamflag trigger around a flag I can't get it to mount . . . . the problem is I don't understand the heirarchy
here
new SimGroup(Capture4) {
   
   new Trigger(teamcapture1) {
      position = "108.133 281.178 214.552";
      rotation = "1 0 0 0";
      scale = "3.64337 3.22469 2";
      dataBlock = "TeamTrigger";
      polyhedron = "0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
   };
   };

   new SimGroup(Capture5) {
   
   new Trigger(towercapture2) {
      position = "603.038 277.871 214.265";
      rotation = "1 0 0 0";
      scale = "3.64337 3.22469 2";
      dataBlock = "TeamTrigger";
      polyhedron = "0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
   };
  };
  
   new SimGroup(flagcaptures) {
   
   new Trigger(towercapture2) {
      position = "603.038 277.871 214.265";
      rotation = "1 0 0 0";
      scale = "3.64337 3.22469 2";
      dataBlock = "TeamFlagTrigger";
      team = 2;
      invcheckitem = "Flag2";
      respawnat = "Smeeky";
      polyhedron = "0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
   };
   
   new Trigger(teamcapture1) {
      position = "108.133 281.178 214.552";
      rotation = "1 0 0 0";
      scale = "3.64337 3.22469 2";
      dataBlock = "FlagTrigger";
      team = 1;
      polyhedron = "0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
   };
   
      new Item(CaptureThisFlag) {
         //position = "380.299 272.458 236.689";
         position = "474.388 294.477 211.481";
         rotation = "1 0 0 0";
         scale = "1 1 1";
         dataBlock = "Flag2";
         collideable = "0";
         static = "1";
         rotate = "1";
      };
   
   
   };
is the code can someone explain how these element work in the mission editior? And maybe how to do it by scratch .

#1
08/12/2002 (8:00 pm)
i was thinking something very similar...

I have been fooling with the same CTF code and can't seem to satisfy myself with what was given.

Especially when I go look at the base scripts that come with T2 and I find things like:

// in CTFGame.cs
%flag.isHome
%flag.carrier
%flag.grabber

and I wonder, where did %flag get all these member variables? This sort of thing is what I am looking for to make my CTF code better.

Yes, I am a noob to the Torque Game Engine. I am just hoping that someone could elaborate on this tutorial a little more than what is out there.
#2
08/13/2002 (1:12 am)
Guys, there is working CTF code in the next Realmwars release.

Ant: I missed adding another flag/capture point. So in effect only 1 team could capture.

Wend: The flag.blah variables are probably just named somewhere else. Think of script code like basic, you dont have to declare a varaible to use it, so flag.blah = true would create flag.blah and set it to true, anytime in the future you looked at flag.blah its value would be true.



Phil.
#3
08/13/2002 (9:40 am)
awesome, this is what I was thinking to be honest...

I should've just hacked at it. Thanks for putting that in perspective.

Rock on GG!
#4
08/13/2002 (3:46 pm)
has the new build of RW been released?
#5
08/13/2002 (4:20 pm)
Not yet. Still some work to do. The CVS should be available publically soon-ish.

Phil.