Jump to content

Need Scripting Help


Recommended Posts

Alright, I have a script written up, and pretty much this is what is supposed to happen;

 

Player activates activator upon entering cell, and sits down. When the player enters, an imagespace modifier is applied that keeps the screen black(this is done in order to allow some game time updates happen that are going on in another script.) When player also enters activator, a quest stage updates. Upon update of quest stage, a timer starts, and at the end of the timer, another quest stage updates that removes the perma-black screen and applies and fade in, while at the same time, a conversation is supposed to start. Problem is, the quest stage never updates, so the other stuff never starts. So instead, your character sits down and your screen stays black. If I could get some help on this, it would be appreciated;

 

Trigger/Object script

 

scn jmodRDTruckStartTriggerScript

short bdoonce

Begin OnTriggerEnter Player

if bdoonce == 0
	applyimagespacemodifier jmodrdblackisfx
	disableplayercontrols
	jmodTruckStartBench02.activate Player 1
	setstage jmodRDTruckIntro 5
	set bdoonce to 1
endif

if getstage jmodRDTruckIntro 10
	removeimagespacemodifier jmodrdblackisfx
	ApplyImageSpaceModifier FadeInFromBlack10sISFX 
endif

END

 

Quest Script

 

scn jmodRDTruckStartQuestScript

short bDoOnce
float ftimer

BEGIN GameMode

if getstage jmodRDTruckIntro 5
	set ftimer to 5
endif

if ( ftimer > 0 )                                                
        set ftimer to ftimer - getSecondsPassed        
    else                                                                
   		setstage jmodRDTruckintro 10
endif

if getstage jmodRDTruckIntro 10
	jmodRDNPCRavenRef.sayto player jmodRDTruckIntroConvo
endif

END

Link to comment
Share on other sites

The onTriggerEnter is only running once,

It blacks the screen and imediately checks for stage 10. Which is false first time.

To get it to run again the player would have to leave and re-enter the trigger.

Delete that bit - move it to the quest.

 

It looks like you want the getstage code-chunks in your quest script to only run once.

 

Move that code to stage result scripts.

For 5

set jmodRDTruckintro.ftimer to 5

 

For 10

removeimagespacemodifier jmodrdblackisfx 
ApplyImageSpaceModifier FadeInFromBlack10sISFX  
jmodRDNPCRavenRef.sayto player jmodRDTruckIntroConvo 
;If this is the last action of the quest then stop it here.
;Stopquest jmodRDTruckintro

 

 

er... and you only want the time to be active in stage 5 too.

Without that check your quest will move to stage 10 immediately.

scn jmodRDTruckStartQuestScript 

float ftimer 

BEGIN GameMode 
 if getstage jmodRDTruckIntro 5 
   if ( ftimer > 0 )                                                 
     set ftimer to ftimer - getSecondsPassed         
   else                                                                 
     setstage jmodRDTruckintro 10 
   endif 
END

 

Untested, but something like that :)

Link to comment
Share on other sites

So, remove the last part from the triggerscript, and have something on the lines of this for the quest script?

 

scn jmodRDTruckStartQuestScript

short bDoOnce
float ftimer

BEGIN GameMode

if getstage jmodRDTruckIntro 5 
	set jmodRDTruckIntro.ftimer to 5
endif

if getstage jmodRDTruckIntro 5
   		if ( ftimer > 0 )                                                 
     		set ftimer to ftimer - getSecondsPassed         
   		else                                                                 
     		setstage jmodRDTruckintro 10 
   		endif
endif

if getstage jmodRDTruckIntro 10
	removeimagespacemodifier jmodrdblackisfx
	ApplyImageSpaceModifier FadeInFromBlack10sISFX 
	jmodRDNPCRavenRef.sayto player jmodRDTruckIntroConvo
               Stopquest jmodRDTruckintro
       endif

END

Edited by jhardingame
Link to comment
Share on other sites

There's a box in the quest stage dialog to put scripted code that you only want to run once when the stae is entered.

 

Click the 'Quest Stages' tab, select the relevant stage.

Create a new 'quest item' on the rhs but leave the conditions empty. (right-click -> new)

Then place the code in the 'Result Script' section.

 

That's why I separated those 2 chunks into separate codeblocks. ie. remove them from the main quest script.

Link to comment
Share on other sites

Aye, well, I couldn't necessarily get it to work, but ended up doing something different without the timers, so the conversation just goes ahead and start. Wasn't able to achieve the effect I wanted, but I'll deal with it :3. Thanks for the help though!
Link to comment
Share on other sites

  • Recently Browsing   0 members

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