Jump to content

Script to "temporarily" change combat music, does one exist?


Recommended Posts

  • Replies 59
  • Created
  • Last Reply

Top Posters In This Topic

Will do, it'll be on tomorrow's agenda for me as I'm pretty much tapped out for the day. Don't want it to go with out being said, as always thank you Dylbill.

 

OBTW, found this default script in the CK a while back, pretty sure you've seen it before.

 

 

  Reveal hidden contents

 

 

I've tested it and found that it's pretty reliable for putting a Music Type in place where the cell is set to default. Problem is you can't use it twice in the same cell to override itself with another choice. Heck if you could I wouldn't be having a hard time of it.

Edited by Laerithryn
Link to comment
Share on other sites

@Dylbill on the subject . . .

 

  On 6/27/2021 at 5:49 PM, dylbill said:

Hmmm, because that's a pretty bad bug, I would maybe try maxaturo's idea of using Add() and Remove(). You have to detect when the player enters combat, and to do this I would make a new spell ability that has the condition IsInCombat == 1 and add it to the player when they enter the cell. This is because the event OnCombatStateChanged doesn't work for the player.

 

triggerbox script:

 

 

  Reveal hidden contents

 

 

The script that goes on the DetectCombatAbility's magic effect. Have it extend ActiveMagicEffect:

 

magic effect has condition IsInCombat == 1
run on the player.
  Reveal hidden contents
MusicType Property MyCombatMusic Auto 

Event OnEffectStart(Actor akTarget, Actor akCaster) ;effect start when player enters combat
    MyCombatMusic.Add()
EndEvent 

Event OnEffectFinish(Actor akTarget, Actor akCaster)
    MyCombatMusic.Remove()
EndEvent

 

 

 

Note that the wiki: https://www.creationkit.com/index.php?title=Add_-_MusicType says that using Add can make the musictype baked into the save. To prevent this, add the conditions:

 

IsInCombat == 1 AND

GetInSameCell <object reference in your cell> == 1

 

to each of your music tracks in your custom musictype. Have them run on the Player.

 

Also, make sure your custom musictype has a higher priority than the vanilla combat musictype.

 

Ok, have done all this too step by step and it worked once, but now wont work again, even on a new game. I don't get it. Seems like I have only that earlier one that works pretty reliable but would have to set the cell Music Type to Default, not ideal as I can't get that Music trigger script to turn off on Leaving the trigger. Besides it behaves as if you have set the cell to your choice there after anyways, which in turn makes the Combat music trigger to not work at all. What a viscous cycle.

 

I think for now I'm going to leave custom music out of the mod release as is with vanilla music. Later, I can make a mod to provide the custom combat music as an optional download. For folks that want that intended full effect. Actually now that I think about that's probably the better way to go giving that all efforts are not working as desired. Bethesda must of hard coded the cells Music Type so that it's not script friendly at all.

 

Again, thank you Dylbill. And you guys who showed an interest in this issue.

Edited by Laerithryn
Link to comment
Share on other sites

No problem. That is strange that it only worked once. There is another thing to try. I've never had problems using Sound.Play() in my scripts before. So, you could mute the vanilla music when you enter your cell, then handle the music directly in the script. This is a little more setup, but not too complicated.

 

First, make a new Sound Category. You can duplicate the vanilla AudioCategoryMUS category to make yours.

 

Then make new sound descriptors (instead of music tracks) that point to your audio. Make sure the sound descriptor's category is set to the custom Sound Category you made.

 

Then make a sound marker for each descriptor that use the descriptors. These are what will be used in the script.

 

Here's what the triggerbox script looks like:

 

 

  Reveal hidden contents

 

Here's what the magic effect script looks like:

 

 

  Reveal hidden contents

 

Again, for the magic effect make sure it's a constant effect, and the spell is ability type. I tested it out and it seems to work pretty well.

Link to comment
Share on other sites

Also, one more thing, if you set the music type for your cell to a blank type, so no music plays, it may not be necessary to mute the vanilla music at all in the script, but it might still because i think combat music would still play.

Link to comment
Share on other sites

@Dylbill, Ok trying to figure this one out. Self explanatory for the most part I can see but I admit I'm a bit confused by the property names when it comes to filling in those properties. Are the custom ones first then vanilla? It looks like they're mixed.

 

SOUND MARKERS and LENGTHS are listed twice. I assume for MyCombatMus as well as the VanillaCombatMus? Problem is I can't tell which goes where?

 

For clarity can we rename the properties to differentiate stating what they are for like MyCombatMus for custom things and for Vanilla things maybe something like VanCombatMus?

 

MyCombatMusMarkers, VanCombatMusMarkers.

 

MyCombatMusLength, VanCombatMusLength?

Link to comment
Share on other sites

For these properties:

sound[] property MyCustomMusic Auto ;array of sound markers containing sound descriptors (music tracks). Set in the ck.
Float[] property MyCustomMusicLengths Auto ;lengths in seconds of the above music tracks. Set in the ck.


sound[] property MyCustomCombatMusic Auto ;array of sound markers containing sound descriptors (music tracks). Set in the ck.
Float[] property MyCustomCombatMusicLengths Auto ;lengths in seconds of the above music tracks. Set in the ck.
Those are all custom properties. None are vanilla. The MyCustomMusic are your normal music tracks you want to play (out of combat) while in your cell. This is used instead of setting the music normally, because while in the cell all vanilla music will be muted.
The MyCustomCombatMusic is the custom combat music (sound markers) that you want to use. The float[] properties after each, you set the lengths for each track for above.
Example: let's say in MyCustomMusic you have
0: TrackA
1: TrackB
2: TrackC
in MyCustomMusicLengths you would put
0: 60.0000000000000 (tells the script TrackA is 1 minute long)
1: 180.00000000000 (tells the script TrackB is 3 minutes long)
2: 120.00000000000 (tell the script trackC is 2 minutes long)
the only vanilla property in the script is:
SoundCategory Property AudioCategoryMUS Auto ;vanilla music sound category
which is used to mute and unmute vanilla music in the script.
Link to comment
Share on other sites

Thank you for clearing that up for me Dylbill. I guess these old eyes just didn't see the obvious, my apologies.

At a quick glance I didn't notice the difference between MyCustomMusic and MyCustomCombatMusic.

 

Umm... do I actually place the sound markers in the cell like normal, and if so do they have to be inside a trigger box or just anywhere?

 

And for (Property AudioCategoryMUS Auto ;vanilla music sound category) is this the Music Type selection we would normally choose for our cell?

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...