Adding custom music to be triggered by a event?

Discuss all aspects related to modding Zandronum here.
Post Reply
User avatar
Mr.Fegelein
 
Posts: 24
Joined: Fri Apr 08, 2016 7:08 pm
Location: The Good ol Days
Clan Tag: [VGP]

Adding custom music to be triggered by a event?

#1

Post by Mr.Fegelein » Fri Feb 02, 2018 3:54 am

I'm new to level editing but have picked up the basic ropes fairly quickly,
and I've read the beginners posts about using XME to replace music files.
I'm just assuming here that there would be some level of scripting involved in getting music to trigger at a pickup or opening of a door preferably. Can anyone help me out?
Image

User avatar
arkore
Forum Regular
Posts: 183
Joined: Mon Dec 17, 2012 8:01 pm

Re: Adding custom music to be triggered by a event?

#2

Post by arkore » Fri Feb 02, 2018 7:56 pm

The easiest way to make a script is using GZDoomBuilder, and pressing F10. Make sure you're editing a Zandronum or zdoom map with ACS support in your options.

In the script tab, start typing in your code.

Your first line should always be:

Code: Select all

#include "zcommon.acs"
In the future, you may add a line before that, like:

Code: Select all

#library "MYSCRIPT"
to name your script, to avoid issues.

Then write a script like:

Code: Select all

script 123 (void)
{
  SetMusic("D_ULTIMA");
}
Then click "Compile Script" button in tool bar. The button's icon is a document with yellow lightning bolt.

Then in your map, edit the thing (e.g. blue armor) properties and go to "Actions" tab. For the action, click the "Browse Action" button and go to Script -> Script Execute. Then set the Script number to 123, and close properties.

Now press "Test Map" button in GZDB toolbar.

Tip: Make sure your map has a Player 1 start thing.

Post Reply