Jump to content

Script not working as intended


Andyno

Recommended Posts

I'm doing this purely as a thought experiment, so I haven't tested it and I could be wrong ..

 

As I understand, as soon as you leave the cell, the script for the teleporter is terminated so there's no way for the original teleporter to know when you're in the new cell.

It occurred to me shortly after posting last time that you can probably break the script in half and drop the player on a new trigger.

Use the first half on the first trigger .. the fade out, sound out and moving the player to the new cell.

Put a trigger in the same place you're dropping the player in the new cell and attach the second half of the script to it .. the fade in, sound in and enable player controls.

 

When the cell is finished loading the new trigger event should fire because the player has been dropped on it.

 

The quest method would work similarly except you'd be using quest variables to track things rather than a new trigger. It may even be a little more complicated because of timing requirements.

Link to comment
Share on other sites

I'm doing this purely as a thought experiment, so I haven't tested it and I could be wrong ..

 

As I understand, as soon as you leave the cell, the script for the teleporter is terminated so there's no way for the original teleporter to know when you're in the new cell.

 

It occurred to me shortly after posting last time that you can probably break the script in half and drop the player on a new trigger.

 

Use the first half on the first trigger .. the fade out, sound out and moving the player to the new cell.

 

Put a trigger in the same place you're dropping the player in the new cell and attach the second half of the script to it .. the fade in, sound in and enable player controls.

 

When the cell is finished loading the new trigger event should fire because the player has been dropped on it.

 

The quest method would work similarly except you'd be using quest variables to track things rather than a new trigger. It may even be a little more complicated because of timing requirements.

 

Ya that was my thoughts ... use an arrival trigger/script . ( just for the cell change teleports )

 

And since your script worked out the best ... any thoughts on those 2 scripts ?

Link to comment
Share on other sites

I guess I'll take a stab at it ...

 

~~~~

SCN BMTeleport01Script

 

Int TeleSwitch

Float Timer

 

Begin OnTriggerEnter Player

 

DisablePlayerControls ; take this line out if arrival trigger

Set TeleSwitch to 1

PlaySound MySound

IMOD ThisISFX

 

End

 

Begin GameMode

 

If TeleSwitch == 1

Set Timer to Timer + GetSecondsPassed

If Timer >= 3

Player.MoveTo MyXMarker ; Or : EnablePlayerControls ; if arrival trig

Set Timer to 0

Set TeleSwitch to 0

 

endif

endif

End

Edited by Mktavish
Link to comment
Share on other sites

Pretty much yeah ...

;First trigger, teleport out

Begin OnTriggerEnter Player

If TeleportSwitch == 0

	DisablePlayerControls
	PlaySound DRSDLC05TeleporterClose
	IMOD DLC05TeleportOutISFX
	Set TeleportSwitch to 1

ENDif

End

Begin GameMode

If TeleportSwitch > 0

	If Timer >= 3

		set Teleportswitch to 0 ;always best to zero just to be safe
		set Timer to 0	
		Player.MoveTo NEWCELLTeleportMarker01REF
	
	ELSE	

		set Timer to Timer + getSecondsPassed

	ENDif
ENDif

End

;Arrival Trigger
;Second script, close to the first. Same duration, not quite done in reverse.

Begin OnTriggerEnter Player

If TeleportSwitch == 0

		PlaySound DRSDLC05TeleporterOpen                         
		IMOD DLC05TeleportInISFX
		set TeleportSwitch to 1
		
ENDif

END
	
Begin GameMode

IF TeleportSwitch == 1 ;<--- Arrival trigger RE-Fire prevention

	IF Timer >= 3
		EnablePlayerControls
		set Teleportswitch to 2 ;<--- Arrival trigger RE-Fire prevention
		set Timer to 0 
	ELSE
		set Timer to Timer + getSecondsPassed
	ENDif
ENDif

END

.. untested of course.

 

Come to think of it, there may be another check required on arrival, being you may end up standing on the arrival Trigger for an extended period of time which could cause it to fire again. ... edited the thought into the script.

Edited by skittered
Link to comment
Share on other sites

I'd say you're pretty good at guessing, because it works! :dance: Thanks a lot! :thumbsup: Enabling player controls should be 0.5-1 second earlier, but maybe it's just caused by visuals, since player is moved to a different cell. Yes, it's just my thought, since the script cannot lie... right? :yes:

Edited by Andyno
Link to comment
Share on other sites

Glad it works.

 

You can change the Timer check to partial seconds if needed ... IF Timer >= 1.5 ... >= 2.5 ... >= 3.5 ... etc.

 

.. or you could just consider the extra bit of delay 'stunned' time from having just been transported who knows how far.

Edited by skittered
Link to comment
Share on other sites

  • Recently Browsing   0 members

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