Scripting music in Halo: CE maps.
Warning: Scripting syncing requires use of bipeds and vehicles (or other crushing objects.) in order to work over the netcode. These methods will work for single player maps, or multiplayer maps built for just one person. Syncing over Halo’s netcode will most likely not happen unless you work with the bipeds and vehicles. Remember - death’s sync, most else does not.
Warning 2: This method will use AI, and will check for the status of AI. AI ***DOES NOT SYNC*** over the netcode. Don’t try, you will fail.
Tutorial:
This tutorial will assume that you have basic scripting knowledge, basic AI knowledge, can type with a keyboard, and can read. If you do not qualify for any of these needed qualities, please, do not hesitate to smash your face into your keyboard until you can no longer see.
What you’ll need:
1. A compiled .scenario tag that you can edit in Sapien. 2. A .sound tag that you have compiled with tool. This should be the music you want to play in-game. 3. AI actors and actor varients. If you don’t have these, check over at the files.halomods.com forums. Search around there for “Aztec’s Actors” or something like that, and download his actor and actor varient tags.
open the desired .scenario file in Sapien. Place your AI encounters and squads, and give them appropriate names. For this tutorial, I’ll call my encounter “tutleets1², and the squad name will be “uber.” No reason for the names. :P
Anyways, place the AI, and under the encounters block and the information for it, check the box that says “Not created automatically”, or something to that effect. You can skip the checking of the box, but for this script, we will use commands that place this encounter on the map at a certain time, instead of right away as soon as the game loads. This can come in handy once you work with trigger volumes/loading zones/multiple BSPs, and that sort of thing. Make sure you give your AI spawn points, check the required boxes, and make sure they have respawn enabled, and have their max/min actors set to something other than zero.
Now, load up *gasp* Notepad, and type the following (Note: DO NOT ADD *’s.) :
(script startup musicnai
(ai_place tutleets1) * (sleep_until (= (ai_strength tutleets1/uber) 0)) ** (sound_impulse_predict sound\music\madrigal true) *** (sound_impulse_start sound\music\madrigal none 1)) **** * This will place the AI that we decided to not create automatically. ** This will pause execution of the rest of the script until the give condition is true, or in other words, until your AI are all dead. *** This script will bring your sound or music file into the sound cache for your map. This has to be done before actually playing the sound, as far as I know. I’m assuming your file is found at sound\music\madrigal.sound for this. If you were to name your .sound file anything else, change “madrigal” accordingly in the script. **** This will start playing your music.
I believe that after the last command in the script, you can do a (sound_impulse_predict [sound location] false) command, to remove the song from the cache. But, I’m not sure if you’d have to run a sleep command first, or if you could just run it right after running the sound to begin with. That could stop the sound abruptly, but I’m not sure. Go ahead and experiment with this on your own.
After typing that, save the file as scripts.hsc in your levels\[your level]\scripts directory, or something like that. Go into Sapien, and go to File > Compile scripts. If it gives you any errors… well, try and fix them. I’m not a damn troubleshooting guide. :P
Of course, to play music, you don’t need AI or anything. You can use trigger volumes and things like that, but that gets just a tad more complicated. This is just basic scripting using an AI command or two.
Final note: This is a very basic way to play music in Halo: CE. I’m sure there are better, more elaborate ways, but this will get the job done.
Pkmnrulz240/Dark Cloud
Bookmarks