If the player dies, we just want the obituary to say "%o died" (%o is your name). To move from one parameter to another, put a comma after the end of the parameter How much damage? Let's do weak damage (with a power of 2). Since we want to damage the player, we put the players identification number (make sure it is 1 set it before doing the key) The first parameter is who we want to damage. What thing do we want to damage? How much damage? If the thing dies, what message appears? Now, for the Thing_Damage statement, we need some parameters. Type the following code (Be aware this code won't compile because of a missing parameter (intentional)) Now, give the key a special action of 80 - H Execute Script with a script number of 1. Well, with ACS Scripting, you can make any object do any DOOM relating thing you want! You can have a red key kill the player, give him the BFG9000, do absolutely nothing, or raise dead monsters! If you have two red keys, you can make each one do something completely different!Ĭreate a sector, and put a player start, and a red key. In vanilla Doom, picking it up gives you a red key, enabling you to open red doors or activate swithces that require the red key. Here, you will learn about scripts that do actions besides print, and parameters. Surely you want to do other stuff besides printing text, right? Well, you have come to the right place. This concludes the basic introductory lesson to variables. a % b = 9 (After dividing 9 and 17, what is left over? ) a / b = 0 (Not 0.5294, integers will always round down to the nearest whole number) (in these examples, a is still 9 and b is still 17) Other useful functions with integers: -, *, / (BE CAREFUL WITH THIS ONE), %, ++,. If you want to print "9 + 17", then do so like this: If you activated the script while playing, you would see the number 26. Since a is 9 and b is 17, it will print out the value of 9 + 17, which is 26. This code declares an integer a and sets it's value to 9, declares another integer b and sets it's value to 17, and prints out the value of a + b. With integers, you can do basic math (and a little advanced math if programmed correctly). You can declare other variables, such as bool (boolean, which returns either true or false), string (which can hold pretty much anything, but cannot be used in operations besides strings, incorrect usage can and probably will cause errors). In this case, the output would be "a is 9". Then, it prints the string "a is " followed by the value of a. First, it declares a to be an integer and setting it's value to 9. This lesson will teach you about variables and basic usage. This will cause the message "Hi." to appear on one line, and "lol" to appear on another.įor more information, goto Print Variables This makes the message "Hi." appear, and then the message "lol" appear. The ? resembles the letter s (for string), d (for decimal), and some extras (these two are the most basic, but this lesson will only teach about the string). The print statement's structure is like this: This is a very basic statement that enables you to communicate text information to the player. In the script you saw above that prints "Hello World!", a Print statement was used. These lines are used for scripting.Īfter declaring the type, you must have a at the end It is very common among mappers to place linedefs that you cannot detect and will not block your path. To activate a (void) script, you must either have a thing (I hope you know what this is) with it's thing special set to 80 (monster dies, health/weapon/powerup/key picked up), a line who's special is set to 80 (line crossed, player presses use, shot hits or goes past), or activated by another script (you will learn about that later). You might use scripts with arguments, but those will be discussed later. All numbered scripts must be between 1 - 32767.Īfter the script number comes the "type" of script. The structure of a script #include "zcommon.acs"Įach script has a number. Now, you will learn about the structure of a script. Then, click on the "Test Map" button and see what happens! Now go ahead and copy the code you see above. For GZDoom Builder you should search for "Script Editor", found on the main toolbar or by pressing F10. You should see a button that says "Make New Script". Now go to the "Scripts" Menu and choose "Edit BEHAVIOR Lump". Create 1 sector and put whatever textures you want and a Player 1 Start. Open up Doom Builder and create a new map (call it MAP01) in ZDoom (Doom in Hexen) format. Now for the interactive part of this lesson: This script will print the string (a data type that can hold pretty much anything, but cannot be used in any operation except strings without conversion) "Hello World!" upon entering the level. This lesson will guide you into making your very first script. 7.2 Conditional repeating loops (while).6 Using functions to make simple changes to a map.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |