BSL:Tutorial/Console: Difference between revisions
m (→A_t48: typo and complement) |
m (+cat) |
||
Line 74: | Line 74: | ||
More, later. | More, later. | ||
[[Category:Modding tutorials]] |
Revision as of 21:16, 16 May 2011
Scripting from the Developer Mode console
In this tutorial, you are supposed to enter single BSL commands in real time, from the console, and watch their effect.
Once you understand what the basic commands do, you will be ready to assemble them into functions and level logic files.
The "console" is a feature of the Developer Mode.
- You enter the Dev Mode with the cheat thedayismine, or x.
- You turn on the console by pressing the console key (between Esc and Tab).
The console appears as a "CMD: " prompt in the bottom left corner.
- Input appears in the line to the right of that prompt.
- Output is printed in the lines above that prompt.
If for some reason you can not do one of the following -
- enter the Dev Mode, or
- turn on the console, or
- see the output, or
- see the input
- just say so on the talk page and we will help you.
A_t48
"A_t48" is the name of the very first enemy that you encounter in Oni (training droids do not count).
- It's a "thug" patrolling the first room in the Syndicate Warehouse.
We are going to stay in this room and study him. We do not want to fight him.
- The very first thing is to become invisible, with the moonshadow cheat.
- Now he can't see us. If we don't want him to hear us, either, we can creep.
- (Or we can move far away from his patrol, and use the camera from there.)
Now, let's do a very simple thing at the console, such as setting a variable.
- Type the word "ai2_deaf" at the console and press Enter. The output will be "bool: 0"
- This means that ai2_deaf is the name of a "boolean" variable (true/false),
- and that the value of that variable named ai2_deaf is currently set to "false" (0).
- It is actually a switch. Normally the AI aren't deaf, but if ai2_deaf is "true", then they are.
- We will now change that value to "true" (1), by entering either ai2_deaf=1 or ai2_deaf=true
- After we've entered that, we'll get the output "int32: 1" or "bool: 1", meaning that the value was set to "true" (1).
- We can check the success by entering ai2_deaf again, getting the output "bool: 1" instead of "bool: 0".
- Now all of Oni's AI will be completely deaf. That includes the A_t48 thug, so we don't have to creep any more.
Now, we are going to set the variable named "ai2_shownames" (default value 0) to 1.
- Enter ai2_shownames=1 or ai2_shownames=true the console.
- You will see name tags appear both above "A_t48" and Konoko ("char_0").
- There are many other variables in Oni. You can find a full list HERE.
Now, we are going to give him a weapon, for example the Van de Graaff pistol (stun gun).
- At the console, type chr_giveweapon A_t48 w6_vdg or chr_giveweapon(A_t48,w6_vdg) and press Enter.
- What we did here is, we called the function chr_giveweapon with two parameters A_t48 and w6_vdg.
- The first parameter ("A_t48") is the name of the character that we want to give a weapon to.
- The second parameter ("w6_vdg") is the name of the weapon that we want to give to him.
- The parameters can be space-separated, or they can be comma-separated in parentheses.
Now, we are going to take that weapon away, by resetting that character's inventory.
- At the console, type chr_inv_reset A_t48 or chr_inv_reset(A_t48) and press Enter.
- This is the same as above, except we are calling the function chr_inv_reset,
- and that this function takes only one parameter - the name of a character.
We can also change A_t48 into a Comguy, if we like.
- At the console, type chr_set_class 1 comguy_3 or chr_set_class(1,comguy_3) and press Enter.
- Now the first parameter is the "index" of the character to be "shapeshifted". In this case, it is 1.
- Konoko has index 0 because she appears first, and the thug has index 1 because he appears next.
- The second parameter of chr_set_class is the name of the character class to change to.
More, later.