Jump to content

why does my script only work once?


puddlepond

Recommended Posts

i'm trying to recreate the coffin from dark souls 2 where you climb in it and your character's gender changes. here's the script i'm working with (it's attached to an activator with another script that just starts the quest then ends):

scn aaGenderCoffinQUESTSCRIPT

float Timer

BEGIN GameMode

	set Timer to ( Timer + GetSecondsPassed )

		if ( Timer < 4 )

			DisablePlayerControls 1 1 1 1 1 1 1
			ApplyImageSpaceModifier FadeToBlackPermanent
			SexChange
			Con_Save GENDERSWAPSAVE

		elseif ( Timer >= 4 )

			Con_LoadGame GENDERSWAPSAVE
			RemoveImageSpaceModifier FadeToBlackPermanent
			ApplyImageSpaceModifier FadeInFromBlack4sISFX
			ShowMessage aaGenderCoffinMSSG
			EnablePlayerControls 1 1 1 1 1 1 1
			Set Timer to 0

			StopQuest aaGenderCoffinQUEST

		endif

END

so the way i want it to work is that the screen fades to black, your gender is swapped, then the game saves and 4 seconds later it reloads that save and fades back in. which is what it does, initially. the script works perfectly fine the first time i activate it, but any time after it's like it's only running the elseif block and totally skipping over the first bit. this is my first time working with timers so i'm guessing i'm doing something wrong there that's causing the issue. also, is there not a function to delete a save? i can't find one anywhere on the wiki but like... it really seems like there should be? idk. i just want the genderswapsave to delete itself after loading as like an immersion thing so it doesn't really matter that much.

 

also, just as like... a polish thing: does anyone know how to force a black loading screen? like, the one you get when you're entering an interior and it's just a black screen with the roulette wheel on top. i tried con_togglemenus immediately after the other two con_ functions but that made the loading screen blinding white, which was sort of worse.

 

Link to comment
Share on other sites

Im not really sure what's wrong at a glance, but the whole 'If Timer Less Than 4' section of the script shouldn't be part of this script. This is a game mode script, so its passing multiple times as the timer is accumulating to 4.

 

Try moving all that business to your Activator and see if that helps. (and if not, show us your activator script too.)

 

You may also want to play around with the script processing delay for your quest. The default is 6 seconds, which is more than enough to make timers behave funkily.

Link to comment
Share on other sites

i made a few changes. here's what my quest script looks like:

scn aaGenderCoffinQUESTSCRIPT

float Timer

BEGIN GameMode

	set Timer to ( Timer + GetSecondsPassed )

END

and here's my activator script

scn aaGenderCoffinSCRIPT

BEGIN OnActivate

	StartQuest aaGenderCoffinQUEST

		if ( aaGenderCoffinQUEST.Timer < 4 )

			DisablePlayerControls 1 1 1 1 1 1 1
			ApplyImageSpaceModifier FadeToBlackPermanent
			SexChange
			Con_Save GENDERSWAPSAVE
	
		elseif ( aaGenderCoffinQUEST.Timer >= 4 )

			Con_LoadGame GENDERSWAPSAVE
			RemoveImageSpaceModifier FadeToBlackPermanent
			ApplyImageSpaceModifier FadeInFromBlack4sISFX
			ShowMessage aaGenderCoffinMSSG
			EnablePlayerControls 1 1 1 1 1 1 1
			Set aaGenderCoffinQUEST.Timer to 0

			StopQuest aaGenderCoffinQUEST

		endif

END

this doesn't really work. when i activate the coffin the game disables my controls, fades to black, makes the save, then fades back in without ever reloading the save or re-enabling my controls. i tried setting the script delay to a few different values but it didn't really seem to make much of a difference other than the script starting quicker after i activated the coffin.

Link to comment
Share on other sites

Oh no, I meant just the Less Than 4 bit, the Greater Than statement should still be in your quest.

 

The activator would be like this:

 

Begin Onactivate

 

StartQuest aaGenderCoffinQUEST

DisablePlayerControls 1 1 1 1 1 1 1
ApplyImageSpaceModifier FadeToBlackPermanent
SexChange
Con_Save GENDERSWAPSAVE

 

End

 

 

The quest would be like this"

 

BEGIN GameMode

set Timer to ( Timer + GetSecondsPassed )

if ( Timer >= 4 )

Con_LoadGame GENDERSWAPSAVE
RemoveImageSpaceModifier FadeToBlackPermanent
ApplyImageSpaceModifier FadeInFromBlack4sISFX
ShowMessage aaGenderCoffinMSSG
EnablePlayerControls 1 1 1 1 1 1 1
Set Timer to 0

StopQuest aaGenderCoffinQUEST

endif


END

Edited by Radioactivelad
Link to comment
Share on other sites

  • 2 weeks later...

Begin Onactivate

DisablePlayerControls 1 1 1 1 1 1 1
ApplyImageSpaceModifier FadeToBlackPermanent
SexChange
Con_Save GENDERSWAPSAVE

Scriptwait 240 ; JIP functiom

Con_LoadGame GENDERSWAPSAVE

RemoveImageSpaceModifier FadeToBlackPermanent
ApplyImageSpaceModifier FadeInFromBlack4sISFX
ShowMessage aaGenderCoffinMSSG
EnablePlayerControls 1 1 1 1 1 1 1

END

Link to comment
Share on other sites

  • Recently Browsing   0 members

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