No announcement yet.

Casting .ent spells for radiant

  • Filter
  • Time
  • Show
Clear All
new posts

  • Casting .ent spells for radiant

    Earlier today I received a PM asking me if I could explain how to create .ent definitions. I believe the below image will answer most questions.

  • #2
    You didn't really think I was going to leave you hanging like that right? Right.

    Ok, so here we go.

    WTF does all that mean?

    There are many functions within my QC but, func_weather is the one that actually creates the model, so this is the one we need to tell radiant about. We start off by creating a group in our .ent file that is named identical to the function (func_weather).

    Most things in radiant .ent files have a targetname. This allows you to directly call that specific instance of the object and do things with it. My weather is no different, so we copy/paste the default targetname tag, that can be found all over the place in the radiant .ent for quake. Actually any time I say ".ent", from here on out, I mean the entities.ent that is found in Moving on...

    The next thing I define in the .ent are the spawn flags. By using the <flag> tag we will get a lil checkbox at the top of the input area of the entity inspector. Checking it will set that flag for that entity. You may notice that the bit="0" but it's corresponding flag=1. This is correct. Below is a short "flow" of bit vs actual value(av).

    bit 0 av 1
    bit 1 av 2
    bit 2 av 4
    bit 3 av 8
    bit 4 av 16
    bit 5 av 32

    Keep this in mind when assigning flags in your .ent

    Next is a bit weird. The entire top of the func_weather function in my QC was actually written by Lord_Havoc. I do not understand why he is flip-flopping vectors like pancakes at the top, but I bet there is some pro reason that I am not aware of, so I just left it alone. However, the bottom line is that, velocity is what we need to set and let .dest do whatever from there on it's own. Since this is a vector we use the <real3> tag, which expects a vector.

    the last two are essentially the exact same thing, just handling different vars. What it says in the QC is:

    if (!) not self.cnt - in other words: if self.cnt does not exist then set self.cnt to 12. If QC is asking itself if a var is set, in a function like this one, that is generally something that you can set in your map. Since these vars expect a number we use the <integer> tag.

    All of these tags, which we wrote, add fields to the entity inspector for that entity. That's all you are doing. You are creating a form within radiant so, your map can talk to QC using values that you input.


    Why does velocity need to be set? How do you just come to that conclusion?

    Well, this is more of an experience thing. You can't really just come to the conclusion. I noticed that one vector(dest) was being assigned the value of another vector(velocity) and then velocity was being set to 0. This means that velocity was just a container being passed from one place to another - and that is the final clue, we know where "another" is, but where is "one place"? Where did it begin? It didn't. That means we can set it.

    Also, if you look right below that, the QC is asking "does self.dest exist?" Even after setting itself it is still making sure that it was set to something. This means that velocity has the potential to = nothing, which also means that it probably needs to be set manually. The earlier "rule" still applies. If a var is being checked for existence, in a function like this (ie being tied into radiant), then you can probably set it.

    For whatever reason, it needs to be set externally through velocity so, velocity is the field we make.


    Keep in mind that the code literally says "If variable (does not exist/is not set) then (create and) set it to value". So, in the case of this particular function (and many others), failing to set these values in your map will not break your game. It's gonna be set to something whether you like it or not.
    Last edited by MadGypsy; 04-18-2013, 04:45 PM.


    • #3
      ok this helps! i got my monster in there now and under the the right catagorey. what i would like to do is set up my qc and my ent file to have the check boxes for each monster so i can chose a difent skin at will in radent with out setting up 3 monsters each with 1 skin each. (this is kind of a long turm goal.) but for now i can at least start pulling in some guns and monsters. i want to give a big thanks to both madgypsy and golden boy for taking the time to wright up some good blogs for me in the last 2 day.


      • #4
        Actually, thank you for giving me some mad science to perform. I am especially proud of my extremely clear and professional diagram. If you ever needs some lines or arrows drawn, I have some serious MSPaint skills. You have to, with an undo level of 3. Luckily that's exactly how many lines that are in most arrows.

        ...and you're welcome


        • #5
          that pic is my new background on my computer


          • #6
            Oh snot! I totally forgot to explain the tag attributes. This is simple.

            1) key: This has to be the exact same name as the var in qc that you are referring to
            2) name: This can be whatever you want. It is just the "title" that will appear next to the form field in radiant
            3) all of the text between the tags will become the explanation that you see above the input area of the entity inspector

            There are a few more tags than the ones explained here. A glance through the existing ent is all that is necessary to find them and figure them out.

            that's it.
            Last edited by MadGypsy; 04-18-2013, 05:15 PM.


            • #7
              Originally posted by JDSTONER View Post
              that pic is my new background on my computer
              Me t00


              • #8
       guys. That has to be very hard on your eyes. I absolutely appreciate your support and even if you are lying, I can feel the love, but if you are not lying you have my full support in not using that as your desktop and I will still think you are awesome. Although, it may make a nice custom mouse pad ($4).