BSL:Tutorial/Scratch2

From OniGalore
Jump to: navigation, search
Unfinished building-60px.jpg

This page is unfinished. Can you fill in any missing information?
If it is not clear which part of the page is unfinished, ask on the talk page.

Merge sign-60px.jpg

This page's content overlaps with information found on the BSL:Tutorial/Scratch page.
Merging the articles will prevent confusion and help streamline the wiki.

By request, here is a simple script for level1 a.k.a. EnvWarehouse. It puts you, and any number of AI, on this rooftop section:

wh_roof.jpg

This rooftop section was apparently used for testing purposes, which is why it has FLAGs (35, 40, 41 and 42) and BNVs (212-217).

BNVs are invisible "rooms" with various markers that enable Oni's AI to navigate through the environment (around obstacles, up and down stairs, etc).
FLAGs are most typically used as spawn locations or waypoints for patrol paths. They store not only a position, but also a facing direction.

We shall use ai2_spawnall(void) to spawn everyone listed here and chr_teleport(string char_name, int32 flag) as many of them as we can to the rooftop.

The actual number that we will be able to teleport will depend on your computer. Typically if you have more than 32 "active" AI, they'll become stupid, if more than 64, Oni will crash).
func void main(void) {
ai2_spawnall
chr_teleport char_0 40
#chr_teleport Train_TD_1 42
#chr_teleport Train_TD_1 42
#chr_teleport Train_TD_1 42
chr_teleport Top_Striker_1 42
chr_teleport Top_Comguy_1 42
chr_teleport Mid2_Striker_1 42
chr_teleport Mid2_Striker_2 42 
chr_teleport Bay4_Comguy_1 42
chr_teleport AlarmBay4_Striker_1 42
chr_teleport AlarmBay4_Striker_2 42
chr_teleport Bay6_Neutral_1 42
chr_teleport Bay6_Striker_1 42
chr_teleport Ambush_Striker_1 42
chr_teleport Bay6_Striker_1b 42
chr_teleport WH_Striker_C 42
chr_teleport WH_Striker_D 42
chr_teleport guard1 42
chr_teleport secret2 42
chr_teleport ambush_striker 42
}
Paste the above code into a new text file named, for example, woofwoof.bsl. To rename a file, click on it and hit F2 (if it doesn't let you change the extension from .txt to .bsl, you must tweak Windows Explorer a bit; Google it up).
Put woofwoof.bsl into Oni\GameDataFolderIGMD\EnvWarehouse and make sure that no other .bsl files are in that exact folder (for example, you can move them to a new folder called Oni\GameDataFolderIGMD\EnvWarehouse\backup)
Run Oni and load any savepoint of Chapter 1 (the warehouse) or Chapter 0 (the training). You will be on the roof with a bunch of Strikers. You'll see that some Strikers will attack you, whereas other will just follow you around and others will just stand and not even stare. If reducing the number of AI doesn't fix them, then it means that we screwed them up by teleporting them away from their jobs. This can be fixed, and we'll see how in the next installment of this silly script.