Jump to content

Question About Activate Parent Relationships


rosestorm

Recommended Posts

I know that it is possible to create a door with two or more parent relationships, so my question is when a door has two or more active parent relationships is it possible to make it to where one of the switches hooked up to a door will only open it, and the other one will only close it, and not both?
Link to comment
Share on other sites

Here, try this (It compiles but I haven't yet tested it)

 

scriptName CustomActivateToggleLinkedRef extends ObjectReference
{
- Opens/Closes the linked ref when this object is activated.  Make sure the linked ref is something that CAN be opened
}

ObjectReference myLinkedRef

bool Property OpenClose = TRUE Auto
{TRUE = Open - False = Close}

Event OnActivate(ObjectReference triggerRef)
if (triggerRef == (Game.GetPlayer() as ObjectReference))
	myLinkedRef = GetLinkedRef() as ObjectReference
	If (OpenClose == TRUE)
		If (myLinkedRef.GetOpenState() == 3)	;Is the door closed?
			myLinkedRef.Activate(triggerRef)	;Activate the linked foor
			Self.Activate(triggerRef)			;Activate self to force normal animation e.g. chain pulled
		EndIf
	Else
		If (myLinkedRef.GetOpenState() == 1)	;Is the door open?
			myLinkedRef.Activate(triggerRef)	;Activate the linked foor
			Self.Activate(triggerRef)			;Activate self to force normal animation e.g. chain pulled
		EndIf
	Endif
Endif
EndEvent

Link to comment
Share on other sites

  • Recently Browsing   0 members

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