-
Content count
448 -
Joined
-
Last visited
-
Days Won
385
Everything posted by atrX
-
What is a while loop? A while loop will execute code as long as a condition is met. How to use a while loop? while (var == true) // Do something Why use a while loop? I got for loops already! There's a simple reason: your source code looks cleaner. Let's take a look: for (; var == true ;) // Do something while (var == true) // Do something Honestly, which one looks more appealing to the eye? The while loop, right. Now, obviously for loops have their usage too, but if you simply need to do a conditional loop, go with a while loop. What is a for loop? A for loop will execute code as long as a condition is met. Unlike while loops, however, for loops can also declare and initialize a variable and/or execute a line of code (loop expression) inside the actual logic statement. Let's take a look: for (var = 0; var < 100; var++) // Do something How to use a for loop? As I said before, a for loop consists of 3 parts: declaration/initialization, condition and a loop expression. These 3 parts are all optional, you will often see things like: for (; ; wait(1)) for (var = false; !var;) These are just some examples, there's way more uses for a for loop than shown here. In general for loops are used like in the first example, meaning initialization is used to initialize a variable to check for in the condition and incremented/decremented/... in the loop expression. But there's quite a few exceptions as seen in the above examples. Why use a for loop? For loops are love, for loops are life. They honestly help make your code much more organized, let's compare a regular for loop to what it would look like when done with a while loop: for (i = 0; i < var; i++) { // Do something } i = 0; while (i < var) { // Do something i++; } The for loop is a lot more organised, as you can see. How to make an infinite loop? Both for and while loops can be easily made infinite: // Infinite for loop for (;;) { // Do something } // Infinite while loop while (1) { // Alternatively, while (true) can be used // Do something } Error: Potential infinite loop, what now? Obviously you can't physically have code running infinitely without waiting between every loop execution, if the engine would allow you to do this the game would most likely crash. Heck, it even freezes for a couple seconds now when you try to run an infinite loop without waiting between every loop execution. So, how can you solve this? The answer lies in the wait() function: for (;;) { // Do something wait .05; // The minimum wait is 0.05 seconds! } Alternatively, because this is a for loop, you could do something like this: for (; ; wait(.05)) { // Do something }
-
What is an array? Arrays are used to store multiple values in a single variable, every value is accessible by its index. Arrays in CoDScript are 0 indexed, meaning the array indexes start from 0. Declaring an array An array in CoDScript is declared as follows: array = []; // Declaration of an empty array Storing data in an array You can manually store data in an array: array = []; array[0] = var1; array[1] = var2; anotherArray = []; for (i = 0; i < 100; i++) { anotherArray[i] = i * 10; } CoDScript also has many different functions that will return an array, here's a few examples: triggers = getEntArray("triggers", "targetname"); zombies = getAIArray("axis", "all"); primaryWeapons = player getWeaponsListPrimaries(); Retrieving data from an array Retrieving data from an array is simple and works with array's indexes: array = []; array[0] = 5; array[1] = 10; var = array[0]; // var will be set to 5 // Example of how to run a check on every player in the game (generalised for all games, WaW has a utility function named get_players() for this) area = getEnt("area", "targetname"); players = getEntArray("player", "classname"); for (i = 0; i < players.size; i++) { if (players[i] isTouching(area)) { // Do something } } Multidimensional arrays Multidimensional arrays are basically embedded arrays. What this means is that you are able to store arrays within other arrays. Here's a short example of an embedded array: array = []; // Declare an empty array for (a = 0; a < 100; a++) { // Runs 100 times array[a] = a; // Adds the current int to the array for (b = 0; b < 100; b++) { // Runs 100 times array[a][b] = b; // Adds the current in to the embedded array } }
-
What are Arithmetic Operators? Arithmetic operators are used to do mathematical calculations. These are the arithmetic operators available in CoDScript: // Operator: + // Meaning: Addition var = var1 + var2; // Operator: - // Meaning: Subtraction var = var1 - var2; // Operator: * // Meaning: Multiplication var = var1 * var2; // Operator: / // Meaning: Division var = var1 / var2; // Operator: % // Meaning: Remainder var = var1 % var2; // Operator: ++ // Meaning: Increment by 1 var++; // Operator: -- // Meaning: Decrease by 1 var--; // Operator: += // Meaning: Increment by X var += 5; // Operator: -= // Meaning: Decrease by X var -= 5; // Operator: *= // Meaning: Multiply by X var *= 5; // Operator: /= // Meaning: Divide by X var /= 5;
-
What are Relational Operators? Relational operators compare one value to another. The comparison operators available in CoDScript are: == (Tests if the two operands are equal.) != (Tests if the two operands are not equal.) < (Tests if operand 1 is smaller than operand 2.) > (Tests if operand 1 is larger than operand 2.) <= (Tests if operand 1 is smaller than or equal to operand 2.) >= (Tests if operand 1 is larger than or equal to operand 2.) All relational operators result in a boolean value (true or false). Examples of how to use Relational Operators if (var1 == var2) // Do something if (var1 >= var2) // Do something if (var1 <= var2) // Do something while (var1 > var2) // Do something What are Logical Operators? Logical operators are used to check for multiple conditions (or sometimes if a condition is not true). A logic statement only returns true or false, so to have multiple conditions we use logical operators. Here's a list of the logical operators for CoDScript, what they mean and an example of how to use them: // The first logical operator: && // Meaning: AND if (bool1 == true && bool2 == true) { // If both bool1 and bool2 are true, execute code here } // The second logical operator: || // Meaning: OR if (bool1 == true || bool2 == true) { // If either bool1 or bool2 is true, execute code here } // The third logical operator: ! // Meaning: NOT if (!bool == true) { // If bool is NOT true, execute code here }
-
What is threading? When calling a function regularly, your code will wait until the called function has finished or returned a value. If you want to run asynchronous functions you'll need to use threading which does not require your code to wait for the threaded function to finish or return a value. When to use threading? This all depends on the purpose of your script. In general, you want to avoid threading as much as possible as it requires extra resources to thread a function as opposed to regularly calling it. The only time you should ever thread a function is if you want to run this function asynchronously from your current code. A great example of this is calling functions on entities in an array. You'll usually want to thread these (there are exceptions, of course) as otherwise your're going to be waiting for one function to finish before going onto the next one. How to use threading? Threading is as simple as putting "thread" in front of your function call: function(); // Regular function call thread function(); // Threaded function call
-
What is a "Syntax"? Syntax is the name for the basic structure of a scripting language. If, when testing your scripts, you get an error saying "Syntax Error: ..." Then you've made a mistake in the syntax of your script. More on debugging these errors later on. What does this "Syntax" look like then? CoDScript (which I will often refer to as GSC) is based on the programming language C and therefore follows the same syntax structure. Here's a list of the syntax used for includes, functions, logic statements, variable declaration and comments. Includes An include basically allows you to call functions in your script without having to add their path like is done in this example: trigger commonscripts\ulitity::trigger_off(); If you see yourself using the same function from the same file a lot it's probably a good idea to include the functions from said file in your script: #include commonscripts\utility; function() { trigger trigger_off(); } As you can see, you don't have to add the path to the file that contains the function every time. Functions A function is started by the function name (helloWorld in the example below), followed by parenthesis. Around the function "helloWorld()" curly brackets are placed. helloWorld() { iPrintlnBold("Hello world!"); } Function Calls You can call a function by typing out the function name, followed by parenthesis and a semicolon. helloWorld(); Logic Statements A logic statement can be many different things: if(), else if(), else, while(), for(), ... Luckily, all of them follow the same basic structure: if (condition) { // Code } else if (otherCondition) { // Code } else { // Code } while (condition) { // Code } for (variable declaration; condition; loop expression) { // Code } More on the many different logical statements in further tutorials. Variable Declaration You can declare variables like this: variableName = valueToGiveToVariable; Comments You've seen me use these things a few times now: // Some text These are comments, they're basically small notes you leave to yourself or others in your script. These do not get parsed ingame and do not have any impact on your code. Their sole purpose is clarifying what a piece of code does. There's two types of comments: // Single line comment /* Block comment */ Syntax Errors If, by accident, you made a mistake in your syntax (forgetting to write a semicolon for example), the game will throw a syntax error. You can track where the problem is by typing "developer 1" in the console and relaunching your map/mod. The game will tell you the line number of the error when you open up the full console (shift + console key).
-
It was kinda meh, dunno if I still have it somewhere. I'll check. https://docs.raid-gaming.net/cod4u/Player/setGravity Edit: I found the old database with all the tutorials, let's see if they're worth reposting.
-
Yay, a map no one can finish!
-
Map is now available on our Deathrun server: raid-gaming.net:28960
- 1 reply
-
1
-
Yes, it's happening, after all this time I'm making a third rendition of this crap series of maps... I've been streaming the mapping process and will continue to do so. All the livestreams are available at:
- 1 reply
-
1
-
Both issues should be fixed next time the map comes on. Thank you for taking the time to report this, it helps get things like this fixed quicker.
- 1 reply
-
1
-
That one also works fine from my testing?
-
Alright, I've gone through all of the maps listed and fixed the triggers for the upcoming update. However, wipeout seemed to already give XP for all the traps?
-
You are literally insane.
-
May 15, 2018: Updated with new forum VIP group info.
-
As a thank you for donating you'll receive VIP features on our servers. Below is a list of features per server aswell as a list of the amount of months you'll get per donation: Deathrun: Trails Characters: Sonic Hands: VIP Hands Sprays: Pedobear, Raging Pepe Weapons: MSR, VIP Deagle 2x XP More to come Surf: Trails 2x XP Status icon VIP character VIP hands More to come Combined Operations: Currently no VIP features available... Team Deathmatch: Currently no VIP features available... Forums: Permanent Donator rank Private Donator-only section VIP durations*: 5 USD: 1 month 25 USD: 5 months + 1 free month 50 USD: 10 months + 2 free months * Donations do not stack, meaning if you donate 3.50 USD, for example, you can't donate 1.50 USD afterwards to receive VIP. Only full amounts will be accepted. To receive VIP, please contact a Manager or Owner after donating and include your B3 CID (the number behind the @ when you type !regtest) in your message. A list of our management division can be found at https://raid-gaming.net/staff/
-
Thank god someone's compiling a list of these, I forget to add them to my todo list every time. I'll be fixing the maps on the list for the next update.
-
Henlo Fedzor.
-
Your application is now available to be voted on, good luck!
-
That was quick. Looking forward to playing it, will be adding it to the server momentarily!
-
Has played a lot on the old servers, therefore giving him a pass on the 50 hours requirement. Your application is now available to be voted on.
-
Those are first person animations and weapons for that matter, that's pretty easy to do. Manipulating third person character animations is a totally different beast.
-
So I've done a tad bit of research (as I'm not too familiar with animations), and it would seem forcing a custom animation on a player model is fairly impossible as all the animation related functions are singleplayer only. Though, I like impossible, so I actually found a way of doing it for stock animations by modifying our custom server patch that should, in theory, work. I haven't tested the method yet so I'm not 100% certain it will work but I have high hopes. I'll look further into it when I'm done with the most important bits of our current (pretty large) to-do list. Also, yes, I'll need someone to port/make me a bunch of animations if this were to become a thing. I cannot into Maya.