Sign in to follow this  
Followers 0
Zack

A taste of mapping with gsc

20 posts in this topic

     What's up guys. Today, I got bored, so I thought of something I could do to help out the community with all the new deathrun mappers trying out stuff. So, I decided to make a Tutorial on the basics of CoD4 GSC Scripting for Deathrun Maps. Now, I know what some of you people who KNOW how to script are thinking, something around the lines of, "lol, what does zack know? He made a shitty map called inferno!" Well, that may be true to some of you, but I do know a good amount of scripting of GSC, especially for deathrun. I recommend reading my first tutorial posted HERE first before going onto this one. Make sure your ModTools are installed 

correctly, and have a map setup that you want to test out scripting on. Anyways, enough chatting, time for the tutorial!

 

Items Needed:

 

1.) Working ModTools

2.) Notepad ++ [DOWNLOAD HERE]

3.) A Deathrun Map

4.) A brain ( Most will fail here )

 

If you don't have your modtools installed and want to learn how, refer to my other tutorial here: http://raid-gaming.net/forums/index.php/topic/22-how-to-start-mapping-modtools-setup/

 

 

 

Step 1: The In-Radiant part of your Trap(s):

 

What your going to want to do, is have a trap ready on your map, with a good idea on what you want it to do. For my first Trap Example, I will

be going a simple rotating floor. What you are going to want to do, is make a place where the floor will rotate obviously. Make sure it is not TO big, but also not to small either (That's What She Said). huehueheueh. Anyways, you will need to select the brush you will want to rotate, Right Click on the 2D-Grid, Mouse over the "Script" catagory, and a list should popup of different options. For this example, we will be using a brushmodel, so be sure to click brushmodel option. Now that that is done, you can Press "N" to pullup a window known as "The Entity Window." This, is where you can put in the targetname of the brushmodel, but we will get to what that means, and why it matters, in one second. For now, in the [Key] box, you will put the word, "targetname". Only targetname, not the quote "" marks, just targetname. Now, in the [Value] box, you will put the name, "rotate". Once again, no quote "" marks, just rotate. Once that's done, you can press enter, and it 

should appear in the box above. Once that happens, you know you did it right. Now, for the activator trigger. You will obviously need a spot for the activator to activate the trap on the jumpers, so if you don't have that go make it now silly! Are you done? Okay, good. Now, you can continue along with the tutorial. You will need to make a trap spot in the activator's path such as, a simple rectangle. You may texture that as you wish, and now comes the trigger part. After you have your Box made, select it, and Press Space-Bar on it. It should make a duplicate of the box, and you should have two seperate ones. Great. Now, What you want to do is form the second duplicated rectangle, to be around the first box, on all sides, I recommend making the duplicated box a little bigger, just for the sake of the trigger. Now, what you need to do, is texture the second box the "trigger" texture. To find this texture, you will need to go up to the "Textures" toolbar, go down

to the word, "Usage" then, go down to, "Tools", and finally, scroll down the texture list until you find a grayish-black texture that is identified with the word "trig" in white. Make sure you have the right one named only, "trigger" with the trig logo on it. Okay. Were almost done with the radiant part. Now that you have the trigger texture down, you will need to do something similar to the brushmodel part. This time, you will have your trigger selected, right click on the 2D Grid, go to "Trigger" then choose the "Use_Touch" option. Here's a quick guide to what they all mean:

 

Trigger_Damage = A damage trigger. This trigger waits for damage to be detected, then activated as it is being knifed at/shot at.

 

Trigger_Multiple = An auto-trigger which is triggered when a player walks into it, on it, or touches it.

 

Trigger_Hurt = A hurt trigger, when if touched, a certain amount of damage is given to you per second depending on what you define it as. Used for killing.

 

Trigger_Look-At = A Trigger which is activated when a player looks at it.

 

Trigger_Use and Use_Touch = A trigger which is activated when a player presses there [use] button on, or against the trigger.

 

 

     A majority of the time, for deathrun, you will be using a trigger_use_touch, but it all depends on the map you're making. The that you have chosen the right trigger type, Press the "N" key to open the Entity Window again. This time, for the Key, it will be again, "targetname". And for the Value, it will be similar  to our brushmodel, but this time, we will add trigger to the name. It will be, "trigger_rotate" for the trigger's value. And there! Were done with the radiant part! If you did choose to still stick around, that's great! Were almost finished! Now, for a bit more difficult stuff, the scripting.

 

 

Step 2: The Scripting Side:

 

     For the scripting side of this map, I have thrown together a very bare-bones, basic script for a new map-maker to test there GSC with there map. I will go though the main parts of the GSC, and explain there function and usage, and what they do. Basically, 90% of ALL Deathrun Map Scripts start with the map load script. This Script is:

 




main()
{
maps\mp\_load::main();


 

 

     You ALWAYS want this at the top of your GSC or 1 of 2 things will happen, 1. You won't be able to load your gsc. or, 2. You will get a script error. I have never tried leaving it out, so I don't know. Just make sure that that goes at the very top! Now, how I do my scripting, is A LOT more organized then some others. It's not necessarily bad, just it helps in the long run when you are looking for a certain thread of the script. What I do, is for deathrun scripts, I separate my scripts into categories. Traps, OtherThings, and Rooms. So, what I do is I do this, I make separate threads for them, like this:

 

 



thread Traps();
thread OtherThings();
thread Rooms();
}


 

 

Like I said before, I do it this way, because it's a lot easier to keep track of your scripts. Now, with the word thread, It's simple really, thread means your sort of, "defining" it early in the script, so it knows there is a actual function of scripts for this. It's basically saying that you are making that thread do something. IF, you happen to thread it, this will lead to that script not working, because it obviously wasn't threaded. On the other hand, say you have threaded something, without stating a script for it down below, it will lead to multiple occurences of errors such as, "Unknown Function: thread SpinnerThingy();"      Or something along those lines. This just means, it can't find the script you are trying

to thread. Anyways, onto the different basic functions of gsc scripting:

 

     In GSC, there are many different things you can do with it. You can make plugins, maps, etc. In this case, it will be for a map, so, a basic spinning trap can rotate on 3 different axis's, Yaw, Roll, and Pitch. Basically, you learn the difference of these when you experiment around with them. The easiest way to explain this, is to explain each line of code individually, so, here's the full code of the trap:

 

 

NOTE: Whenever the // symbol shows up, this is not a part of the code, just me explaining what it does.

 

 



SpinnerThingy()
{
trig = getEnt("trigger_rotate","targetname");             //This right here is the trigger you defined earlier in radiant.
  brush = getEnt("rotate","targetname");                    //This line here is the actually rotator you made in radiant earlier.


trig waittill("trigger", player);                         //This line of code is pretty self-explanatory. It waits until the trigger is in this case, pressed used on by the activator.


trig delete();                                            //This line of code, deletes the trigger so it can only be used once.


while(1)                                                  //This is the, if not almost TOP important thing in the script here. This while(1) line makes a script infinite. This basically means, the rotateing will go on and on and on, until the round is restarted.
{
wait 0.01;                                            //The time it waits after each rotate.
brush rotatePitch (-360, 3);                          //This right here, is the line that makes the rotator itself, rotate. It rotates itself 360 degrees (A full circle), and due to the while statement, this function is going to keep preforming until the round ends.
}
}


 

 

 

     And, there you have it people. Your first trap in gsc scripting. If I missed any important details, just be sure to comment, and I will edit this post to your liking. If you have any requests for certain traps/gsc things, be sure to comment on this post! Most things are possible if you put your mind to it ;) I hope this tutorial helped you guys, and I will see you later. 

 

 

 

inb4 TL;DR

0

Share this post


Link to post
Share on other sites

my spidey senses tell me that this is a copy and paste.

looks like it has something in common with you :dave:

0

Share this post


Link to post
Share on other sites

i see what you did there lossy :troll: but most of my work isnt copy and paste moit, i should stream when i gsc script to proove it..

0

Share this post


Link to post
Share on other sites

Gabe, this isn't copy and paste. I've worked on and off on this tutorial for like a week or so.

0

Share this post


Link to post
Share on other sites

Gabe is turning into the Skatez of aL. xD All of them downvotes hahhahaa

0

Share this post


Link to post
Share on other sites

Shut up Fearz faggot ^^ my script m8 fight me about it

0

Share this post


Link to post
Share on other sites

Sigh.. You understand this is an easy script, not that hard to retype. I made the script myself, no point in copying it seeing how the script I made was in 2 minutes.

0

Share this post


Link to post
Share on other sites

Sigh.. You understand this is an easy script, not that hard to retype. I made the script myself, no point in copying it seeing how the script I made was in 2 minutes.

STOP LYING THIEF. THIIIEEFFF

0

Share this post


Link to post
Share on other sites

Darmuh...how did you....OH MY GOD ITS BRAXI.ORG :o Well, in archive form, but holy balls I didn't know there were websites besides google that cached old sites.

0

Share this post


Link to post
Share on other sites

Darmuh...how did you....OH MY GOD ITS BRAXI.ORG :o Well, in archive form, but holy balls I didn't know there were websites besides google that cached old sites.

I went back to the braxi.org when it was in 2012 lol

0

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  
Followers 0