wektis Posted December 1, 2011 Share Posted December 1, 2011 Hi all, Quick question for the more experienced than I. I have a quest, within that quest one of the dialogue options activates a switch (code below), what I want to happen is 2 days after this conversation a message will come up advising the player to go back to the npc. Instead no message. Nadda. The script saves, which obviously means the basic syntax is correct, but when doing research into the problem and looking at other scripts that measure time, they all appear to start with the Begin GameMode function. So two questions. Do scripts that measure time need to begin with the GameMode? If so, that would mean the script would trigger after 2 days of playing and not necessarily 2 days after talking to my NPC... wouldn't it? Wek. Begin OnActivate set selectfactionstart to gamedayspassed if gamedayspassed - selectfactionstart >= 2 ShowMessage NIPCheckInMesg01 AddTopic NIPSamCF01 AddTopic NIPSpudCF01 endif Link to comment Share on other sites More sharing options...
Jeux Posted December 1, 2011 Share Posted December 1, 2011 It's pretty late on my end, and I'm tired, but I'll try to give you a quick answer. Gamemode will have the script running every frame, so the game will be checking the conditions constantly. OnActivate, in contrast, will only run the script when you click the switch. Not what you want. So create to blocktypes to get the best of both worlds. Also create a variable named something like control or DoOnce to keep the Gamemode block running ONLY AFTER the OnActivate stuff has been initiated. Set it == 0 at the top of your script. Have the OnActivate block set the DoOnce variable to 1 Have the Gamemode block contain everything else, with a condition at the start like "if DoOnce == 1"Once the conditions within the Gamemode have been satisfied and there is no more use for the script, set DoOnce == 2 Now, I'm going to go take a nap. Hope this helps a tiny bit. Link to comment Share on other sites More sharing options...
davidlallen Posted December 1, 2011 Share Posted December 1, 2011 A gamemode block on the object may not be the best way to do this. You want the message to come up regardless of where the player is. In case of a gamemode block on an object, if the object is not in memory (because the player is in another worldspace or interior), the script will not run. Another way to do this is with a quest script. You can "startquest" the quest when the switch triggers, and "stopquest" when the message is displayed. You can also set the quest script delay to several minutes or even hours, so that it does not need to run every frame (30 times per second). Link to comment Share on other sites More sharing options...
seularts Posted December 1, 2011 Share Posted December 1, 2011 I have a similar problem, only that I use a variable to count the time that passes. The problem is that it doesn't compute after the 5 seconds that have been set. Here is what I mean: scn CTActivateAllHangarLightsScript01 float timer ref light ref seclight BEGIN OnTrigger Player if light == 0 set light to CTHangarLightsRef endif if light.GetDisabled light.Enable PlaySound QSTEndPowerUpTurbine endif if timer < 5 set timer to timer + GetSecondsPassed else if seclight == 0 set seclight to CTHangarLightsRefA endif if seclight.GetDisabled seclight.Enable PlaySound OBJSwitchLights2D set timer to 0 endif endif MarkForDelete; End The first part where light is define, all the lights start up, but on the second part, the time variable doesn't count the 5 seconds in order to activate seclight. What have I done wrong, there are no errors on the script, and the script is attached to a block trigger. Link to comment Share on other sites More sharing options...
viennacalling Posted December 1, 2011 Share Posted December 1, 2011 The first part where light is define, all the lights start up, but on the second part, the time variable doesn't count the 5 seconds in order to activate seclight. What have I done wrong, there are no errors on the script, and the script is attached to a block trigger. Since that code is in a trigger, the player would have to trigger it again for it to check if 5 seconds has passed. As it is written it looks like the player would have to actually trigger it a minimum of two more times, once to set timer to greater than 5 and once more for the block to see that it is greater than 5. Link to comment Share on other sites More sharing options...
seularts Posted December 1, 2011 Share Posted December 1, 2011 How can I write it to go all the way in a single pass!? Link to comment Share on other sites More sharing options...
Jeux Posted December 1, 2011 Share Posted December 1, 2011 OnTriggerEnter would be a better alternative IMO. Also, try to clean up the structuring of your conditional statements after that timer countdown. By first glance the nested ifs seem a bit unorganized....though i don't know what your script is mean to perform. Link to comment Share on other sites More sharing options...
Crimsonfoxy Posted December 1, 2011 Share Posted December 1, 2011 How can I write it to go all the way in a single pass!?Just check jeux and david's posts above. You need the time checking in a GameMode block otherwise it isn't constantly updating, it'll only check when the player enters not the whole time after they trigger it. Link to comment Share on other sites More sharing options...
seularts Posted December 1, 2011 Share Posted December 1, 2011 How can I write it to go all the way in a single pass!?Just check jeux and david's posts above. You need the time checking in a GameMode block otherwise it isn't constantly updating, it'll only check when the player enters not the whole time after they trigger it. Ok I understand that GameMode is the way to go through the loop, but I need to activate a series of lights with a switch or a trigger. The set of lights must turn on on after the other with a delay of 5 seconds. here is what I got so far with the recommended post above: scn CTActivateAllHangarLightsScript01 ref light ref seclight float timer short doOnce BEGIN OnTriggerEnter Player set light to CTHangarLightsRef set seclight to CTHangarLightsRefA if ( doOnce == 0 ) if light.GetDisabled light.Enable PlaySound QSTEndPowerUpTurbine endif set timer to 5 set doOnce to 1 endif if ( timer >0 ) set timer to timer - getSecondsPassed else if seclight.GetDisabled seclight.Enable PlaySound OBJSwitchLights2D endif endif End The if 'seclight.GetDisabled' is to check that the reference is initially disabled. Link to comment Share on other sites More sharing options...
wektis Posted December 1, 2011 Author Share Posted December 1, 2011 I must be genius -.- I have managed to write and rewrite this script every way possible where geck will save it but I still get no results. I'm not even getting anything from this SCN HAWTimerTestScript Float Timer Begin GameMode Set Timer to GameDaysPassed If GameDaysPassed - Timer >= 1 ShowMessage HAWTimeTestMesgEndIf End Am I doing something fundamentally wrong here? Link to comment Share on other sites More sharing options...
Recommended Posts