Jump to content

Why Wont This Script Work?


Mlucci4036

Recommended Posts

I had this idea in mind that when the player enters this trigger, they will undergo a capture like the one experienced with the Enclave in Fo3.

 

With the script I made, I'm able to disable the player controls and cause the player to fall to the ground, but the timers will not work. Is there any reason why the screen won't fade to black and why the player will not be moved to the next marker?

 

 

scn BigAppleMetroEndScript
float timer
BEGIN OnTriggerEnter player
set timer to timer+getsecondspassed
disableplayercontrols 1 1 1 1 1 1 1
player.AddScriptPackage NVDLC01PlayerKnockedOut
if(timer>=2)&&(Timer<3)
imod fadetoblackpermanent
endif
if(timer>=6)&&(Timer<7)
player.removescriptpackage
player.moveto WakeupREF
endif
endif
END
Link to comment
Share on other sites

​Yes, the reason is that you need a GameMode block, otherwise that script runs only for one frame.

​Try something like this:

scn BigAppleMetroEndScript

float timer

Begin OnTriggerEnter player

	DisablePlayerControls 1 1 1 1 1 1 1
	player.AddScriptPackage NVDLC01PlayerKnockedOut
	set timer to -1

End

Begin GameMode

	if timer == 0
		Return	;trim CPU usage
	elseif timer == -1
		set timer to 7
		GetSecondsPassed ;ensure GetSecondsPassed returns a desirable value in the next frame
		Return ;skip the rest of the frame
	endif

	set timer to timer - GetSecondsPassed

	if timer >= 4 && timer <= 5
		imod fadetoblackpermanent
	elseif timer > 0 && timer <= 1
		player.RemoveScriptPackage
		player.MoveTo WakeupREF
		set timer to 0
	endif

End

Edited by claustromaniac
Link to comment
Share on other sites

​Yes, the reason is that you need a GameMode block, otherwise that script runs only for one frame.

​Try something like this:

scn BigAppleMetroEndScript

float timer

Begin OnTriggerEnter player

	DisablePlayerControls 1 1 1 1 1 1 1
	player.AddScriptPackage NVDLC01PlayerKnockedOut
	set timer to -1

End

Begin GameMode

	if timer == 0
		Return	;trim CPU usage
	elseif timer == -1
		set timer to 7
		GetSecondsPassed ;ensure GetSecondsPassed returns a desirable value in the next frame
		Return ;skip the rest of the frame
	endif

	set timer to timer - GetSecondsPassed

	if timer >= 4 && timer <= 5
		imod fadetoblackpermanent
	elseif timer > 0 && timer <= 1
		player.RemoveScriptPackage
		player.MoveTo WakeupREF
		set timer to 0
	endif

End

That worked perfectly, thanks!

Link to comment
Share on other sites

You're welcome.

​Actually, now that I take a second look at it, I realize this should work better and it is even shorter:

scn BigAppleMetroEndScript

float timer
int stage

Begin OnTriggerEnter player

	DisablePlayerControls 1 1 1 1 1 1 1
	player.AddScriptPackage NVDLC01PlayerKnockedOut
	GetSecondsPassed ;ensure GetSecondsPassed returns a desirable value in the next frame
	set timer to 6
	set stage to 1

End

Begin GameMode

	if stage == 0
		Return	;trim CPU usage
	elseif stage == 1 && timer <= 4
		imod fadetoblackpermanent
		set stage to -1
	elseif timer > 0
		set timer to timer - GetSecondsPassed
	else
		player.RemoveScriptPackage
		player.MoveTo WakeupREF
		set stage to 0
	endif

End
Link to comment
Share on other sites

  • Recently Browsing   0 members

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