Duke4.net Forums: Music Control Like in More Modern Games - Duke4.net Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Music Control Like in More Modern Games  "Music controlled by touch plates and switches"

User is offline   HELLMOUSE 

#1

Originally I did my maps modeled off of Doom Music. But now with more modern sound capabilities and larger maps, thanks to the Developers, one track may not be appropriate. Controlling the music in the game via Touch Plates and switches would be an upgrade.

I was thinking of maybe making a new actor type that plays music tracks, NOT music in the form of a sound file. I'm also not sure how to code what connects the actor to the Touch Plate's or switch's tag value.

Basically, there is always a default track, but when the player walks into a certain area, a creepy F.E.A.R. track plays. Another use would be with a well hidden switch or Access Panel: maybe another Doom track, a F.E.A.R. fight theme, or a Dark Forces action theme starts.
0

User is online   Trooper Dan 

  • Duke Plus Developer

#2

View PostHELLMOUSE, on 09 June 2020 - 05:24 PM, said:

I'm also not sure how to code what connects the actor to the Touch Plate's or switch's tag value.


There's no need to have two separate sprites involved in the effect. Here's a touchplate style actor that I coded recently:

        gamevar LOTAG 0 2
        gamevar HITAG 0 2
        gamevar temp 0 0
        gamevar tempb 0 0

        eventloadactor MUSICPLATE
        geta[].lotag LOTAG
        geta[].hitag HITAG
        seta[].lotag 0
        seta[].hitag 0
        cstat 32768
        enda

        actor MUSICPLATE
        ife player[].cursectnum sprite[].sectnum
	{
		getuserdef[].music_episode temp
		getuserdef[].music_level tempb
		ife temp HITAG ife tempb LOTAG nullop else
		starttrackslot HITAG LOTAG
        }
        enda


Obviously you should use your own gamevars if you already have suitable ones in your project.
2

User is offline   oasiz 

  • Dr. Effector

#3

We also use this in Fury to trigger stuff like the pre-boss theme and other changes. Ours allows an input from pretty much anything possible, even enemy kills could cause it to trigger.
While despite not being Duke, it's still all in CON and similar things are possible in Duke.
2

User is offline   HELLMOUSE 

#4

This is great! Thanks. :D

How does the MUSICPLATE work?
1) How is a track list defined?
2) How does a track stop and another one start?
3) Is there a default track?
4) How does a switch control this?

I looked around https://wiki.eduke32.../wiki/Scripting and got a good idea about some of the code, but I'm still unsure of how it works.

It doesn't look like there is a tutorial on this. Maybe in the future some one could add it.

This post has been edited by HELLMOUSE: 10 June 2020 - 03:19 PM

0

User is offline   HELLMOUSE 

#5

What does the MUSICPLATE do?

The MUSICPLATE changes the track only once. You can't have more than one of these. So, you only have 2 tracks per map - not exactly what I was expecting, but this is still very useful.

Can not use with switches.

It is not necessary to have a music list that is assigned to an episode. You can just have this group of tracks out there using the word "music" and a number: ex, music 5.

LOTAG = level track starting at 0
HITAG = episode / music group starting at 0

This is a great thing to have, and I'm sure there are ways to give it more abilities.
0

User is online   Trooper Dan 

  • Duke Plus Developer

#6

View PostHELLMOUSE, on 12 June 2020 - 06:21 PM, said:

What does the MUSICPLATE do?
The MUSICPLATE changes the track only once. You can't have more than one of these. So, you only have 2 tracks per map - not exactly what I was expecting, but this is still very useful.



That is false. The actor will change the music to the designated track whenever you step into its sector and the music is not on that track already. You can put as many as you want in a map and they will work every time you step in them.

I gave you that simply because it was a simple thing to show you, but of course I have had code to trigger music and anything else with tags since 2007. Look at the wiki and look up commands such as checkactivatormotion. You can also make your own activations with vars that don't use that command.
1

User is offline   HELLMOUSE 

#7

I was hoping you would say that. Maybe I implemented it wrong.

I have the test here. It is a simple map with 2 of them in it. There is a quote that says "MUSIC CHANGE DETECTED" and it does display it both times in the game, but for some odd reason it only changes once. That's why I have posted this up here. Maybe there is something different from some of your cons versus mine. As I said, I may have missed something. I tested this with Duke 3D v1.5 using Mapster32 and EDuke32. This is the only thing that is different from the original game, but it still only changes tracks once.

I don't doubt Trooper Dan, but most likely something is different on my end.

For anyone who is interested in this to see what I'm doing wrong, the EDuke32 version I used is 9053, so all you need is that, the attachment, and the DUKE3D.grp. You might want to have a folder called musicplate test to put this all in.

Attached File  MUSICPLATE_TEST.zip (603.93K)
Number of downloads: 10

Remember, this is a little beyond me so it's easy for someone who normally codes to look at this and figure it out.

This post has been edited by HELLMOUSE: 13 June 2020 - 02:03 PM

0

User is online   Trooper Dan 

  • Duke Plus Developer

#8

I figured it out. You need to change the names of LOTAG and HITAG to something else. You could make them lower case and that should fix it.

Here's what's happening:

Those gamevars have to be per-actor, which allows the different MUSICPLATE to store different values. But there are deprecated global gamevars in Eduke32 with those same names. Because they are global, once the map starts all the MUSICPLATE have the same music setting, so it only works once.

I didn't have this problem in my own mod, because I had used different variable names. I didn't even know that those names were reserved. One thing still seems strange though: I don't understand why it doesn't just overwrite the hardcoded ones with the ones declared in the code that are per-actor. Oh well at least you can make it work now.
1

User is offline   HELLMOUSE 

#9

Thanks :D

I knew you would be able to figure it out. That's why I posted those files so you or anyone else could see exactly what's going on. It is odd, like you said, because "gamevar LOTAG 0 2" as in the "2" makes it a peractor variable, which is one of the items I checked online. This is why I'd rather have someone who has higher programming talents than me to look into that.

I've checked on the wiki about "checkactivatormotion" and didn't find a lot on it. I'm not having much luck with that wiki, trying to figure out how to make a switch trigger the MUSICPLATE. As I said before, programming is a little beyond me. It would be like someone describing how to use a graphics program to someone else who does not have a skill set in art. That's why I'm dependent on someone like you when it comes to programming.

I appreciate this.
0

User is offline   HELLMOUSE 

#10

I've been looking into trying to control the MUSICPLATE with a switch but on the wiki I still can't seem to find anything, or find something that I understand.

All it says about "checkactivatormotion" is "Checks to see if the activator with the lotag specified is in motion or not - if it is, than RETURN is set to 1." I can't find an example of how to implement it using an external switch (access card, switch, dip switch, TP).

This post has been edited by HELLMOUSE: 17 June 2020 - 07:17 PM

0

User is online   Trooper Dan 

  • Duke Plus Developer

#11

Why don't you do something else first that just uses the classic CON commands, like code an enemy.
2

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options