Jump to content

Activator / Container Animation


Xena95

Recommended Posts

Greetings FO3 community

 

I am having some trouble getting an activator animation to work, The activator opens a first aid container with the same model as the activator; that being the default first aid model.

 

The problem is the animation dosen't play on the activator as is would on the container.

 

I would like to get the activator to play the same animation as the container when opening and closing.

 

Upon Activate: Open animation

Upon Deactivate: Close animation

ScriptName MHSCPTFirstAidKitActivator00

Begin OnActivate

	MHREFRFirstAidKitContainer00.Activate Player 0

End

There is also a script attached to the container

ScriptName MHSCPTFirstAidKitContainer00

int FirstAidKit

Begin OnOpen

	MHREFRFirstAidKit01.RemoveAllItems MHREFRFirstAidKitContainer00
	MHREFRFirstAidKit02.RemoveAllItems MHREFRFirstAidKitContainer00
	MHREFRFirstAidKit03.RemoveAllItems MHREFRFirstAidKitContainer00

End

Begin OnClose

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount Radaway
	MHREFRFirstAidKitContainer00.RemoveItem Radaway FirstAidKit 1
	MHREFRFirstAidKit01.AddItem Radaway FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount RadX
	MHREFRFirstAidKitContainer00.RemoveItem RadX FirstAidKit 1
	MHREFRFirstAidKit01.AddItem RadX FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount Stimpak
	MHREFRFirstAidKitContainer00.RemoveItem Stimpak FirstAidKit 1
	MHREFRFirstAidKit01.AddItem Stimpak FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount Morphine
	MHREFRFirstAidKitContainer00.RemoveItem Morphine FirstAidKit 1
	MHREFRFirstAidKit02.AddItem Morphine FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount Buffout
	MHREFRFirstAidKitContainer00.RemoveItem Buffout FirstAidKit 1
	MHREFRFirstAidKit02.AddItem Buffout FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount Jet
	MHREFRFirstAidKitContainer00.RemoveItem Jet FirstAidKit 1
	MHREFRFirstAidKit02.AddItem Jet FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount Mentats
	MHREFRFirstAidKitContainer00.RemoveItem Mentats FirstAidKit 1
	MHREFRFirstAidKit02.AddItem Mentats FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount MS09UltraJet
	MHREFRFirstAidKitContainer00.RemoveItem MS09UltraJet FirstAidKit 1
	MHREFRFirstAidKit02.AddItem MS09UltraJet FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount MS15Mentat01
	MHREFRFirstAidKitContainer00.RemoveItem MS15Mentat01 FirstAidKit 1
	MHREFRFirstAidKit02.AddItem MS15Mentat01 FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount MS15Mentat02
	MHREFRFirstAidKitContainer00.RemoveItem MS15Mentat02 FirstAidKit 1
	MHREFRFirstAidKit02.AddItem MS15Mentat02 FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount MS15Mentat03
	MHREFRFirstAidKitContainer00.RemoveItem MS15Mentat03 FirstAidKit 1
	MHREFRFirstAidKit02.AddItem MS15Mentat03 FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount Psycho
	MHREFRFirstAidKitContainer00.RemoveItem Psycho FirstAidKit 1
	MHREFRFirstAidKit02.AddItem Psycho FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount Bloodpack
	MHREFRFirstAidKitContainer00.RemoveItem Bloodpack FirstAidKit 1
	MHREFRFirstAidKit03.AddItem Bloodpack FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount CaveFungus
	MHREFRFirstAidKitContainer00.RemoveItem CaveFungus FirstAidKit 1
	MHREFRFirstAidKit03.AddItem CaveFungus FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount MS04FireAntNectar
	MHREFRFirstAidKitContainer00.RemoveItem MS04FireAntNectar FirstAidKit 1
	MHREFRFirstAidKit03.AddItem MS04FireAntNectar FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount AntNectar
	MHREFRFirstAidKitContainer00.RemoveItem AntNectar FirstAidKit 1
	MHREFRFirstAidKit03.AddItem AntNectar FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount AntQueenPheromones
	MHREFRFirstAidKitContainer00.RemoveItem AntQueenPheromones FirstAidKit 1
	MHREFRFirstAidKit03.AddItem AntQueenPheromones FirstAidKit 1

End

Any help would be much appreciated

Link to comment
Share on other sites

I would try playgroup.

 

Short myVar

 

Begin OnActivate

 

Playgroup open 1

Set myVar to 1

;do other stuff

 

End

 

Begin GameMode

 

If myVar == 1 && isanimplaying open == 0

Playgroup close 1

Set myVar to 0

Endif

 

End

 

 

There's also a chance that you'll need to identify the ref in the isanimplaying part:

 

If myVar == 1 && BoxRef.isanimplaying open == 0

 

You could either name it by double clicking the placed ref in GECK and entering the name in the one field at the top, or declare it in the script:

 

Short DoOnce

Ref BoxRef

 

Begin GameMode

 

If DoOnce == 0

Set BoxRef to Getself

Set DoOnce to 1

Endif

 

;..... and whatever else goes in the GameMode block.....

 

End

Edited by uhmattbravo
Link to comment
Share on other sites

Hi uhmattbravo,

 

Thank's for your reply, I tried using 'playgroup' but function 'open' and 'close' does not appear to be a valid AnimGroup as GECK rejects the script.

 

I found a work around by activating the activator upon activation of the activator and then activating the activator again upon opening the container to complete the animation cycle. I also had utilize a timer to prevent the container opening before the 'open' animation had completed.

 

The only problem was the activation sound was duplicated due to there being two references with the same model activating at the same time, so the moved the second reference (the primary container) to a cell not accessible to the player.

 

It's a long work around to get an activator to function the same a container but it replicates it behavior perfectly.

 

This is a dynamic container that calls the contents of multiple containers upon opening and then restores the previous state of the containers upon closing, I will include the script for anyone that may be interested.

ScriptName MHSCPTFirstAidKitActivator00

int FirstAidKit
int MHREFRFirstAidKitActivator00Activated
float MHREFRFirstAidKitActivator00Timer

Begin OnActivate

	MHREFRFirstAidKitActivator00.Activate
	set MHREFRFirstAidKitActivator00Activated to 1

End


Begin GameMode

	if MHREFRFirstAidKitActivator00Activated == 1
		if MHREFRFirstAidKitActivator00Timer > 0.37
			set MHREFRFirstAidKitActivator00Timer to 0
			set MHREFRFirstAidKitActivator00Activated to 0
			MHREFRFirstAidKit01.RemoveAllItems MHREFRFirstAidKitContainer00
			MHREFRFirstAidKit02.RemoveAllItems MHREFRFirstAidKitContainer00
			MHREFRFirstAidKit03.RemoveAllItems MHREFRFirstAidKitContainer00
			MHREFRFirstAidKitContainer00.Activate Player
		else
			set MHREFRFirstAidKitActivator00Timer to MHREFRFirstAidKitActivator00Timer + GetSecondsPassed
		endif
	endif

End


Begin OnOpen

	MHREFRFirstAidKitActivator00.Activate

End


Begin OnClose

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount Radaway
	MHREFRFirstAidKitContainer00.RemoveItem Radaway FirstAidKit 1
	MHREFRFirstAidKit01.AddItem Radaway FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount RadX
	MHREFRFirstAidKitContainer00.RemoveItem RadX FirstAidKit 1
	MHREFRFirstAidKit01.AddItem RadX FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount Stimpak
	MHREFRFirstAidKitContainer00.RemoveItem Stimpak FirstAidKit 1
	MHREFRFirstAidKit01.AddItem Stimpak FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount Morphine
	MHREFRFirstAidKitContainer00.RemoveItem Morphine FirstAidKit 1
	MHREFRFirstAidKit02.AddItem Morphine FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount Buffout
	MHREFRFirstAidKitContainer00.RemoveItem Buffout FirstAidKit 1
	MHREFRFirstAidKit02.AddItem Buffout FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount Jet
	MHREFRFirstAidKitContainer00.RemoveItem Jet FirstAidKit 1
	MHREFRFirstAidKit02.AddItem Jet FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount Mentats
	MHREFRFirstAidKitContainer00.RemoveItem Mentats FirstAidKit 1
	MHREFRFirstAidKit02.AddItem Mentats FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount MS09UltraJet
	MHREFRFirstAidKitContainer00.RemoveItem MS09UltraJet FirstAidKit 1
	MHREFRFirstAidKit02.AddItem MS09UltraJet FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount MS15Mentat01
	MHREFRFirstAidKitContainer00.RemoveItem MS15Mentat01 FirstAidKit 1
	MHREFRFirstAidKit02.AddItem MS15Mentat01 FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount MS15Mentat02
	MHREFRFirstAidKitContainer00.RemoveItem MS15Mentat02 FirstAidKit 1
	MHREFRFirstAidKit02.AddItem MS15Mentat02 FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount MS15Mentat03
	MHREFRFirstAidKitContainer00.RemoveItem MS15Mentat03 FirstAidKit 1
	MHREFRFirstAidKit02.AddItem MS15Mentat03 FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount Psycho
	MHREFRFirstAidKitContainer00.RemoveItem Psycho FirstAidKit 1
	MHREFRFirstAidKit02.AddItem Psycho FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount Bloodpack
	MHREFRFirstAidKitContainer00.RemoveItem Bloodpack FirstAidKit 1
	MHREFRFirstAidKit03.AddItem Bloodpack FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount CaveFungus
	MHREFRFirstAidKitContainer00.RemoveItem CaveFungus FirstAidKit 1
	MHREFRFirstAidKit03.AddItem CaveFungus FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount MS04FireAntNectar
	MHREFRFirstAidKitContainer00.RemoveItem MS04FireAntNectar FirstAidKit 1
	MHREFRFirstAidKit03.AddItem MS04FireAntNectar FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount AntNectar
	MHREFRFirstAidKitContainer00.RemoveItem AntNectar FirstAidKit 1
	MHREFRFirstAidKit03.AddItem AntNectar FirstAidKit 1

	set FirstAidKit to MHREFRFirstAidKitContainer00.GetItemCount AntQueenPheromones
	MHREFRFirstAidKitContainer00.RemoveItem AntQueenPheromones FirstAidKit 1
	MHREFRFirstAidKit03.AddItem AntQueenPheromones FirstAidKit 1

End 
Link to comment
Share on other sites

  • Recently Browsing   0 members

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