PkSanTi Posted November 11, 2017 Share Posted November 11, 2017 (edited) 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 SLPDeadRunnerEncounterShort ControlVarAShort ControlVarBShort ControlVarCFloat GetTimeBegin GameModeIf ( ControlVarB == 0 ) If ( GetStage SLPLavacabicefala < 10 ) SLPRunnerDeadRef.Disable Set ControlVarB to 1 EndIfEndIfIf ( ControlVarC == 0 ) If ( GetStage SLPLavacabicefala < 15 ) SLPMiembroLVBARef.Disable SLPMiembroLVBBRef.Disable Set ControlVarC to 1 EndIfEndIfEndBegin GameModeSet GetTime to GetCurrentTimeIf ( ControlVarA == 0 ) If ( GetStage SLPLavacabicefala == 10 ) If ( GetTime <= 3.5 || >= 23.5 ) SLPRunnerDeadRef.Enable SLPRunnerDeadRef.KillActor Set ControlVarA to 1 EndIf EndIfEndIfEnd 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 November 11, 2017 by PkSanTi Link to comment Share on other sites More sharing options...
QQuix Posted November 11, 2017 Share Posted November 11, 2017 You must complete the second condition: If ( GetTime <= 3.5 || GetTime >= 23.5 ) or If ( GameHour<= 3.5 || GameHour >= 23.5 ) Link to comment Share on other sites More sharing options...
PkSanTi Posted November 11, 2017 Author Share Posted November 11, 2017 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 More sharing options...
QQuix Posted November 11, 2017 Share Posted November 11, 2017 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 More sharing options...
PkSanTi Posted November 11, 2017 Author Share Posted November 11, 2017 (edited) 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 SLPDeadRunnerEncounterShort ControlVarAShort ControlVarCShort ControlVarBFloat GetTimeFloat TimerBegin GameModeIf ( ControlVarC == 0 ) If ( GetStage SLPLavacabicefala < 15 ) SLPMiembroLVBARef.Disable SLPMiembroLVBBRef.Disable Set ControlVarC to 1 EndIfEndIfEndBegin GameModeSet GetTime to GetCurrentTimeIf ( 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 EndIfEndIfIf ( ControlVarB == 1 ) If ( Timer < 1 ) Set Timer to Timer + GetSecondsPassed Else SLPRunnerDeadRef.Kill Set ControlVarB to 0 EndIfEndIfEnd Edited November 11, 2017 by PkSanTi Link to comment Share on other sites More sharing options...
QQuix Posted November 12, 2017 Share Posted November 12, 2017 Good to know.I added a note to the WIKI page. Link to comment Share on other sites More sharing options...
Recommended Posts