Jump to content

Best way to disable Ref in different worldspace


Andyno

Recommended Posts

As the title says, I'm trying to disable a reference that is located in a different worldspace.

 

This is the situation:

The player activates a vertibird (located in Commonwealth) that will transport (teleport) him to my custom worldspace, however this is a one way ticket - as soon as player arrives, he will not be able to go back until he finishes the mod. Then he may come to the vertibird again, but actually the vertibird shouldn't be there because it was left in the arrival worldspace.

 

So, what is the best option to achieve this? Should I put it in the initial vertibird script, or should I put a trigger at the arrival spot?

 

BTW, this is the vertibird script I currently have:

Scriptname TZStartVertibirdScript extends ObjectReference

Message Property TZStartVertibirdMessage Auto
ObjectReference Property TZStartVertibirdMarkerRef Auto
Actor Property PlayerRef auto
Sound Property MySound Auto

Event OnActivate(ObjectReference refAction)
        ObjectReference refPlayer = Game.GetPlayer()

 Int Button = TZStartVertibirdMessage.Show()
   If Button == 0
    MySound.Play(PlayerRef)
       PlayerRef.MoveTo(TZStartVertibirdMarkerRef)

Endif
EndEvent

 

Link to comment
Share on other sites

Yes, but I want it to disable after the teleportation process, so the vertibird didn't dissapear before player's eyes.

 

So you're saying that just below the line "PlayerRef.MoveTo(TZStartVertibirdMarkerRef)" I should place only "Disable()"?

Link to comment
Share on other sites

I can't remember if the teleportation screen appears instantly but if it does you should be fine with just putting the disable function after the moveto. If the teleport load screen fades in, you could try putting in a Utility.Wait or using a timer to make the script wait for a couple seconds after the teleport before disabling.

 

But yeah, if the teleport load screen is instant, you should be fine with putting the Disable() below the PlayerRef.MoveTo(...)

Link to comment
Share on other sites

Having a non Const flagged script attached *should* make the reference persistent.

 

You need to debug log the state of your object at the time of disable toi see what is happening;

Debug.Trace("TZStartVertibirdScript.Disable before" + Self + " Is3dLoaded " + Self.Is3dLoaded() + " Enabled " + Self.IsEnabled() ) 
Self.Disable()
Debug.Trace("TZStartVertibirdScript.Disable after " + Self + " Is3dLoaded " + Self.Is3dLoaded() + " Enabled " + Self.IsEnabled() ) 
Link to comment
Share on other sites

Zorkaz:

I just tried self.disable() with and without MustPersist - none of it is working.

 

SKK50:

How should I use this debug stuff? Should I put it into my script, or copy/paste it into command line? Sorry, but I'm seeing such thing for the first time. :ohmy:

Link to comment
Share on other sites

  • Recently Browsing   0 members

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