Jump to content

Stopping a SoundImstance in a different event...


antstubell

Recommended Posts

... explained more here by looking at the script.

Objective - STOP THE DAMN SOUND. Angry because it is probably very obvious but can't see it. When player unequips the weapon stop the looping sound.

 

 

import sound

Actor Property PlayerREF Auto
GlobalVariable Property FirstEquip Auto
Message Property WeapInfo Auto
Spell Property MySpell Auto
Sound Property My_Heartbeat_ Auto
int instanceID ;used to store sound ref

Event OnEquipped(Actor akActor)
if (akActor == PlayerRef)
PlayerREF.AddSpell(MySpell)
If FirstEquip.GetValue() == 0
WeapInfo.show()
instanceID = My_Heartbeat_.Play(PlayerRef)
FirstEquip.SetValue(1)

Endif
EndIf
EndEvent
;-------------------------------------------------------------------
Event OnUnequipped(Actor akActor)
if (akActor == PlayerRef)
PlayerREF.RemoveSpell(MySpell)
instanceID = My_Heartbeat_.Stop(PlayerRef)

EndIf
EndEvent

 

 

(26,27): Stop is not a function or does not exist
(26,0): type mismatch while assigning to a int (cast missing or types unrelated)

Link to comment
Share on other sites

I don't mean to criticize in any way !, but... please... pay a little more attention to what's written in "creationkit.com".

 

 

Event OnUnequipped(Actor akActor)
    if (akActor == PlayerRef)
        PlayerREF.RemoveSpell(MySpell)
        StopInstance(instanceID)
 EndIf
EndEvent
 
...............................................................................................................
 
If "import sound" is not used then :
 
Event OnUnequipped(Actor akActor)
    if (akActor == PlayerRef)
        PlayerREF.RemoveSpell(MySpell)
        Sound.StopInstance(instanceID)
 EndIf
EndEvent

 

 

 

 

* This stuff is for beginners... and not for the level that you are right now...

 

Edit : Typo... Stupid keyboard is full with bread and cookie crumbs !

Edited by maxarturo
Link to comment
Share on other sites

You can stop / interrupt an animation that's been send or an idle (that's on LOOP) by forcing the player to do something else, like equiping a weapon.

I haven't try this (the bellow) because i mainly use "Debug.SendAnimationEvent" or Furnitures Markers for idle (enter furniture > exit furniture).

 

idle property IdleStop_Loose auto

PlayerRef.PlayIdle(IdleStop_Loose)
* (IdleStop_Loose is located in the animations window under ActionIdleStop --> IdleStopRoot)
Edited by maxarturo
Link to comment
Share on other sites

Yep.

IdleStop_Loose

Does stop the idle.

Equipping the weapon starts the idle, which in IdleInjured, but if player shifts to 1st person they can in fact move. Third person disables controls. Also swinging the weapon in either 1st or 3rd person stops the idle as you mentioned. This is not an issue as the Spell still effects the player regardless.

Thanks.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...