Jump to content

Script not working as intended


Andyno

Recommended Posts

SCN BMTeleport01Script


Int TeleportSwitch
Float Timer


Begin OnTriggerEnter Player


     If TeleportSwitch == 0
       DisablePlayerControls
       PlaySound DRSDLC05TeleporterClose
       IMOD DLC05TeleportOutISFX
       Set TeleportSwitch to 1


endif
End


Begin GameMode


    If TeleportSwitch == 1
       Set Timer to Timer + GetSecondsPassed
       If Timer >= 3
         Player.MoveTo BMTeleportMarker01REF
         PlaySound DRSDLC05TeleporterOpen                         
         IMOD DLC05TeleportInISFX
         EnablePlayerControls 
         Set TeleportSwitch to 0
         Set Timer to 0


endif
endif
End

As you can see, the purpose of the script is to teleport player to a new location. Everything works as intended, except one thing: the line EnablePlayerControls is not working as it should, because right after the teleportation process player can freely move, even if he should be stuck at same place for 3 seconds.

 

Any suggestions highly welcomed...

Link to comment
Share on other sites

When an if statement is doing a lot at once, sometimes things don't happen, or seem to happen out of order. What I do in these cases is separate the actions into multiple if statements:

 

 

If TeleportSwitch == 1

Set Timer to Timer + GetSecondsPassed

If Timer >= 3

Player.MoveTo BMTeleportMarker01REF

PlaySound DRSDLC05TeleporterOpen

Set Timer to 0

Set TeleportSwitch to 2

 

endif

 

Else if TeleportSwitch == 2

 

IMOD DLC05TeleportInISFX

EnablePlayerControls

Set TeleportSwitch to 0

 

 

endif

Link to comment
Share on other sites

That's a good Idea on setting the teleport switch to a second stage.

But still ... the "EnablePlayerControls" is going to happen at the 3 second mark at the same time right after teleporting and playing the second IMOD.

 

So what if putting another Timer check like this ...

 

~~~~~~~~~

 

If TeleportSwitch == 1
Set Timer to Timer + GetSecondsPassed
If Timer >= 3
Player.MoveTo BMTeleportMarker01REF
PlaySound DRSDLC05TeleporterOpen
Set Timer to 0
Set TeleportSwitch to 2

endif

Else if TeleportSwitch == 2
IMOD DLC05TeleportInISFX

 

If Timer >= 6
EnablePlayerControls
Set TeleportSwitch to 0

Set Timer to 0

 

endif

endif

endif

End

~~~~~~~~~~~~

 

The problem that has been happening ever since introducing the delayed "EnablePlayerControls"

Is it is getting a 2 second black screen when teleporting , inbetween the IMOD calls.

Hence an 8 second teleport instead of 6 seconds.

 

3 second fade out >>> 2 sec Black screen >>> 3 sec fade in>>> Enable Player Crtl

Link to comment
Share on other sites

I tried to test both your script suggestions, but they suddenly somehow broke my cell. I got this error from this thread...

https://forums.nexusmods.com/index.php?/topic/1041005-fallout-3-black-screen/

... except that every other cell I tried to load, loaded perfectly without any issues. When I put back my old script, there were no issues.

GECK has still that power to suprise me after all that years of modding... :wallbash:

Link to comment
Share on other sites

Just off the top of my head ...

Begin OnTriggerEnter Player

If TeleportSwitch == 0

	DisablePlayerControls
	PlaySound DRSDLC05TeleporterClose
	IMOD DLC05TeleportOutISFX
	Set TeleportSwitch to 1

ENDif

End


Begin GameMode

If TeleportSwitch > 0

    	IF Timer >= 6
			
		EnablePlayerControls 
		Set TeleportSwitch to 0
		Set Timer to 0

	ELSEif Timer >= 3 && TeleportSwitch == 1

		Player.MoveTo BMTeleportMarker01REF
		PlaySound DRSDLC05TeleporterOpen                         
		IMOD DLC05TeleportInISFX
		set TeleportSwitch to 2

	ELSE	
		set Timer to Timer + getSecondsPassed
	ENDif

ENDif

End

.. untested .. just a thought.

 

Also, are you testing from a save in the cell with your original script in it? .. I seem to recall reading somewhere that changing script then trying to run the new stuff over top of a save with the original script in it can cause some issues.

Edited by skittered
Link to comment
Share on other sites

Just off the top of my head ...

Begin OnTriggerEnter Player

If TeleportSwitch == 0

	DisablePlayerControls
	PlaySound DRSDLC05TeleporterClose
	IMOD DLC05TeleportOutISFX
	Set TeleportSwitch to 1

ENDif

End


Begin GameMode

If TeleportSwitch > 0

    	IF Timer >= 6
			
		EnablePlayerControls 
		Set TeleportSwitch to 0
		Set Timer to 0

	ELSEif Timer >= 3 && TeleportSwitch == 1

		Player.MoveTo BMTeleportMarker01REF
		PlaySound DRSDLC05TeleporterOpen                         
		IMOD DLC05TeleportInISFX
		set TeleportSwitch to 2

	ELSE	
		set Timer to Timer + getSecondsPassed
	ENDif

ENDif

End

.. untested .. just a thought.

 

Also, are you testing from a save in the cell with your original script in it? .. I seem to recall reading somewhere that changing script then trying to run the new stuff over top of a save with the original script in it can cause some issues.

 

 

Wow nice looking script . It just feels right :D

Link to comment
Share on other sites

skittered:

Oh my, you did it! :dance: No issues at all, and the teleport feature works as I always wanted! Thanks a lot! :thumbsup:

 

Regarding that black screen...

You're right, I was loading my save in that specific cell, but I also loaded a very old save, and used COC to get here. It made no difference, so I leaved the idea of broken save behind. Really weird that uhmattbravo's and Mktavish's scripts caused this...

Link to comment
Share on other sites

skittered:

Oh my, you did it! :dance: No issues at all, and the teleport feature works as I always wanted! Thanks a lot! :thumbsup:

 

So you see the IMOD's playing as they should ? And actually I guess it wasn't that it was playing a 3rd IMOD.

 

It's that the first IMOD is playing backwards and there is a half second of no imod at the first teleport just before moving the player to second spot. (but the second spot is working perfectly)

 

When stepping into teleport , it instantly goes to white screen , then fades in to a clear screen ... then the player gets moved.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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