Jump to content

GetCurrentTime function problems


PkSanTi

Recommended Posts

Hi there.

 

I'm trying to get something to happen with a few if statements. One of them contains a GetCurrentTime function. The thing is, when I remove the If statement that contains the GetCurrentTime function, the script works fine. As soon is I use that function, the whole script won't run. I'll place the script here; hope someone can help me. Thank you!

 

 

 

 

Scn SLPDeadRunnerEncounter

Short ControlVarA
Short ControlVarB
Short ControlVarC
Float GetTime

Begin GameMode

If ( ControlVarB == 0 )
If ( GetStage SLPLavacabicefala < 10 )
SLPRunnerDeadRef.Disable
Set ControlVarB to 1
EndIf
EndIf

If ( ControlVarC == 0 )
If ( GetStage SLPLavacabicefala < 15 )
SLPMiembroLVBARef.Disable
SLPMiembroLVBBRef.Disable
Set ControlVarC to 1
EndIf
EndIf

End

Begin GameMode

Set GetTime to GetCurrentTime

If ( ControlVarA == 0 )
If ( GetStage SLPLavacabicefala == 10 )
If ( GetTime <= 3.5 || >= 23.5 )
SLPRunnerDeadRef.Enable
SLPRunnerDeadRef.KillActor
Set ControlVarA to 1
EndIf
EndIf
EndIf

End

 

 

As you can see in the script, I'm trying the last block to run only when the Stage of the Quest "La vaca bicéfala" is 10, and the GameHour is between 23:30 and 3:30. As I said, when I remove the GetTime variable, and the GetCurrentTime function, and leave only the other If statements, the script works. As soon as I add this, it doesn't run.

Edited by PkSanTi
Link to comment
Share on other sites

It worked, but now when the NPC enables, between 23:30 and 3:30, it just stands there and floats in the aire, moving backwards with no animation (just a floating rigid body). He does die, since the looting option appears in the floor where he was supposed to be lying, but his body is not there, but floating the way I descripted. Do you know what this is about? I think is related to the Disable/Enable functions.

 

Thank you for your help, by the way.

Link to comment
Share on other sites

Unfortunately, no. I have never played with the kill function much.

 

If memory serves, I think I`ve read that sometimes it is necessary to use some additional functions to properly kill an actor, but I do not remember details.

 

The KILL funccion page mentions that kill does not change the health value. You may try to set it to zero.

Link to comment
Share on other sites

I discovered the problem. Apparently, the glitch is produced when the Enable and the Kill functions work at the same time; they crash or something. I seted a Timer that created a one second space between the Enable and the Kill functions; it was solved. So great, thank you for everything.

 

EDIT: I'll post how the script looks like now, in case anybody comes across the same problem and wants to see how I managed to get it working (the first Begin block is irrelevant for the problem).

 

 

 

 

Scn SLPDeadRunnerEncounter

Short ControlVarA
Short ControlVarC
Short ControlVarB
Float GetTime
Float Timer

Begin GameMode

If ( ControlVarC == 0 )
If ( GetStage SLPLavacabicefala < 15 )
SLPMiembroLVBARef.Disable
SLPMiembroLVBBRef.Disable
Set ControlVarC to 1
EndIf
EndIf


End

Begin GameMode

Set GetTime to GetCurrentTime

If ( ControlVarA == 0 )
If ( GetStage SLPLavacabicefala == 10 )
If ( GetTime < 3.5 || GetTime > 23.5 )
SLPRunnerDeadRef.Enable
Set ControlVarB to 1
Set ControlVarA to 1
Else
SLPRunnerDeadRef.Disable
Return
EndIf
EndIf
EndIf

If ( ControlVarB == 1 )
If ( Timer < 1 )
Set Timer to Timer + GetSecondsPassed
Else
SLPRunnerDeadRef.Kill
Set ControlVarB to 0
EndIf
EndIf

End

 

 

 

Edited by PkSanTi
Link to comment
Share on other sites

  • Recently Browsing   0 members

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