![]() In this example we used an engine function to get the host of the game. Let’s explain what happened differently here than in the previous example. This example is the heart of ‘object oriented’ programming. /=: divides the value of the variable before the plus sign by the value that follows the equal signĮach of these operators save the value of the operation to the variable before the operator.įunction example_function ().*=: multiplies the value that follows the equal sign by the value of the variable before the plus sign.-=: subtracts the value that follows the equal sign from the value of the variable before the minus sign.+=: adds the value that follows the equal sign to the value of the variable before the plus sign.But you can also use one of the shortcuts for modifying a numerical variable: The basic way to modify a numerical variable (int or float) is simply to take that variable and perform a mathematical operation on it +, -, *, /. You should always treat a trigger as an ent regardless of the game you are working with. Triggers will be covered in a new wiki section on level manipulation. NOTE: In WaW triggers also act as entities, but this is no longer the case for Bo3. ALWAYS delete an ent after you are done using it with the syntax: ent delete() where ent is the entity variable. Any type of animated model or manipulated model in script is an ent. An ent is a spawned script_model or a script_model placed in radiant. You need to understand the idea of an entity early or you will run into a “g_spawn” error. IMPORTANT: some variables may be considered an "ent" or "entity". ” this is a tell tale sign of a missing ‘ ’. If you ever get an error like “unexpected paranthesis” or “unexpected. This is the most common mistake of new programmers. A ‘ ’ tells the compiler to stop reading and start reading again. Also note that variable declarations end with a ‘ ’. Defining a variable on the “level” allows for it to be referenced anywhere in script. Notice the local variable does not have a ‘level.’ in front of it. Note the difference between a local and a global variable. Example: teddys_to_shoot = 3 Ī variable that can be called anywhere in a script or in other scripts. I will break down varibles into 2 types:Ī variable that can only be referenced in the function it is created in (more about functions in a second). Using Data Types to Make Variables (Declaring a Variable)ĭefining variables correctly is very simple, but in order to define variables correctly you must understand how code executes. Use these to make notes to yourself in script. ![]() Comments are lines in code starting with // that are not read by the compiler. They are essential!Ī comment definitely isn’t a data type but it belongs in this section anyway. Arrays are a bit confusing to understand and will have a dedicated section. An array is a collection of any data type. Examples: true, 1, false, 0Īn array isn’t really a data type but it is a data structure. Examples: “this is a string”, “321 String”, “strings are cool :)”Ī boolean can have two values, true (same as 1) or false (same as 0). Examples: 5.17549435, 6.57549836Ī string is a character or set of characters that make up a word or phrase. ![]() Examples: 1, 52, 97, 4Ī float is another number, but unlike an int it has decimals. Below is a list of the most common data types you will use in COD script aka GSC code:Īn int is exactly what it is in math, a whole number. (I also made a custom perk that no one uses and am porting Afterlife)ĬOD script is a derivative of ‘C code’, with a lot of changes that make scripting easier. ![]() I don’t have any major projects but most of my work has been on scripts to help others. Need to get ahold of me? Follow me on twitter: pretty new in the BO3 and zombie modding community but I would say scripting is my strongest aspect in it. I am not a “know it all” when it comes to scripting, so feel free to notify me of your suggestions and corrections: Now lets get started! I am a self taught scripter in the GSC language, but I have had the opportunity to learn from many great scripters in the modding community (special thanks to harryb021 for his countless hours explaining syntax). I served on the Alpha Mod Tools test team for Call of Duty Black Ops III prior to its open Beta in 2016. My name is Nate Smith aka natesmithzombies. ![]() Guide to Scripting: Learning the Very Basics of GSC Syntax About the Author(s): ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |