Jump to content

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


Recommended Posts

@Dylbill - PROGRESS, thank you for the heads up on the Should Appear on Menu check box for AudioCategoryMUS sure enough I had it unchecked as well. Put the check back and viola, the music slider is back in the Audio Menu in game. And also noted when I checked the Audio Menu while in the trigger box in combat the music slider was set to ZERO Yay, progress.

 

Now I just need to figure out why I'm not hearing MyCustomCombatMusic? Going to try making the descriptors for each wave file now.

 

EDIT: Ok, this last run through was pretty much the same as before making a separate Descriptor for each wav file. But no combat music ever fires off at all.

Wonder if its because the script portion to DectectCombat isn't working as intended? Rechecking setup for that yet again.

Link to comment
Share on other sites

  • Replies 59
  • Created
  • Last Reply

Top Posters In This Topic

Cool glad you got the music slider back, but that means you altered the AudioCategoryMUS record. I would get rid of that cause it can potentially conflict with other mods. To get rid of the edit, in the ck click on file / data, click on your mod then click on the Details button. This will show all of the new / edited records in your mod. Click on the AudioCategoryMUS so it's highlighted, then press the Delete key. You'll get a warning about ignore, click yes then click ok to load your mod again. Then choose file / save.

 

As for combat music, are you getting the "Playing custom combat music" notification when you enter combat? If not, the spell isn't working correctly.

 

Try putting debug.notification("Enter combat") in the OnEffectStart event on the magic effect script.

Also maybe debug.notification("Leave combat") in the OnEffectEnd event to make sure the spell is working.

Link to comment
Share on other sites

Thanks for the heads up on the AudioCategoryMUS record thing.

 

As for the combat music never being heard I think I may have stumbled on to it maybe not. I notice in the Magic Effect script the following:

 

Take a close look at the following lines:

  • TriggerScript.PlayCustomCombatMusic()
  • TriggerScript.PlayCustomMusic()

Shouldn't they read as?:

  • TriggerScript.PlayMyCustomCombatMusic()
  • TriggerScript.PlayMyCustomMusic()
Scriptname DetectCombatAbilityScript extends ActiveMagicEffect 
;courtesy of Dylbill on the Nexus Forums


;magic effect has the condition IsInCombat == 1 run on the player


MyCombatMus01 Property TriggerScript Auto ;script attached to trigger box. 
;when filling in the CK, choose the cell the trigger box is in and the trigger box reference.


Event OnEffectStart(Actor akTarget, Actor akCaster) ;effect starts when player enters combat
    TriggerScript.PlayCustomCombatMusic()
EndEvent 


Event OnEffectFinish(Actor akTarget, Actor akCaster) ;effect ends when player leaves combat
    TriggerScript.PlayCustomMusic()
EndEvent

Nope I was wrong. Tested it and the script wont complie.

Link to comment
Share on other sites

Nope, it's written correctly. What that does is call, (trigger) this function:




Function PlayCustomCombatMusic() ;play a custom combat music track

UnregisterForUpdate()

Int M = MyCustomCombatMusic.Length - 1 ;get max entry that can be referenced in the MyCustomCombatMusic array.
Int R = Utility.RandomInt(0, M) ;get random index

Sound CombatMusic = MyCustomCombatMusic[R] ;get random combat music track from list.

Sound.StopInstance(MyMusicID) ;stop current custom music playing
MyMusicId = CombatMusic.Play(PlayerRef) ;play combat music
RegisterForSingleUpdate(MyCustomCombatMusicLengths[R]) ;register for when the music track will end

Debug.Notification("Playing custom combat music")
EndFunction


in the MyCombatMus01 script.


Is the property filled correctly in the magic effect script? Again add the debug notifications to the magic effect script to see if it's firing correctly when you enter and leave combat.
Link to comment
Share on other sites

Ok adding those lDebug notifications to the DetectCombatAbility script, meanwhile do these setting look right to you?
EDIT: Nope the Magic Effect is NOT firing off.
Magic Effect - DetectCombatAbility
ID: DetectCombatAbility
Name: Detect Combat Ability
Effect Archtype: Script
Casting TYpe: Constant Effect
Delivery: Self
Magic Skill: NONE
Min Skill Lvl: 0
Assoc. Item: NONE
Target Conditions:
Condition Function: IsInCombat
Parameters (Use Aliases): 1
Comparison: ==
Value: 1.0000
Run On: Player
Condition Function: GetInSameCell
Parameters (Use Aliases): Reference 'defaultActivateSelfTRIG'
Comparison: ==
Value: 1.0000
Run On: Player
Papyrus Script As it Is:

 

 

Scriptname DetectCombatAbilityScript extends ActiveMagicEffect 
;courtesy of Dylbill on the Nexus Forums


;magic effect has the condition IsInCombat == 1 run on the player


MyCombatMus01 Property TriggerScript Auto ;script attached to trigger box. 
;when filling in the CK, choose the cell the trigger box is in and the trigger box reference.


Event OnEffectStart(Actor akTarget, Actor akCaster) ;effect starts when player enters combat
    debug.notification("Enter combat")
    TriggerScript.PlayCustomCombatMusic()
EndEvent 


Event OnEffectFinish(Actor akTarget, Actor akCaster) ;effect ends when player leaves combat
    debug.notification("Leave combat")
    TriggerScript.PlayCustomMusic()
EndEvent 

 

 

Spell - Detect Combat Ability Spell
ID: DetectCombatAbilitySpell
Name: Detect Combat Ability Spell
Type: Ability
Casting: Constant Effect (grayed out)
Delivery: Self (grayed out)
Menu Display Object: NONE
Equip Type: NONE
Casting Perk: NONE
Range: blank
Effect: Detect Combat Ability
Link to comment
Share on other sites

Done, but dang it no effect. I don't understand why the DetectCombat script isn't firing off? I'll pick this up again tomorrow, my head hurts, lol.

Thank you for your efforts Dylbill, much appreciated

Link to comment
Share on other sites

Dylbill, are there any other places in the scripts involved that you can think of that I can add more debug notifications to help figure this out further?

 

We know the combat detection isn't working as intended but does that issue point to a setting for the magic effect or the spell?

 

As for the scripts, other then sometimes renaming them I haven't changed anything.

I keep going back over the previous posts in this forum to see if I can find something perhaps that I've missed but notta.

Link to comment
Share on other sites

Try removing the GetInSameCell condition.

 

If that still doesn't work, try adding the spell to your character in game by using Player.AddSpell <spell id> and see if you get the notifications when combat starts and ends. If you do, it means the spell wasn't added via script when you enter the trigger box

Link to comment
Share on other sites

Many thanks Dybill for your time and continued efforts. It is extremely appreciated man.

 

Ok, I removed 'GetInSameCell' condition then went into combat and got normal vanilla combat music. Killed critters and vanilla combat music ended and went to vanilla non-combat music like in the normal game. NOTE: This result is not consistant. Loaded a new game and I got no combat music vanilla or otherwise.

 

Tried to add spell and got:

 

Prisoner is not in combat

Spell 'Detect Combat Ability Spell' not added to prisoner

 

So, I went into combat and then tried to add it and viola, it worked, I got MyCustomCombatMusic to play finally. Oh but it never stopped playing either after combat it never faded out and just kept playing until the music was done. So any ideas on how to fix this?

 

Went back into CK and put back in the GetInSameCell condition as it was before testing this out.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...