bencebence Posted July 25, 2011 Share Posted July 25, 2011 (edited) Hey everybody!I'd need some help to answer some of my questions.1. How can I add a time variable? Like time spent since entered cell?2. Can I link two scripts? One is a quest script another is an activator/object script. I want to link one of their variables. Is it doable?I had some more in mind, but forgot them, I'll edit this post if I remember.Thanks in advance,bencebence PS.: Also I'd need some help with this question: http://www.thenexusforums.com/index.php?/topic/411959-strang-issue/ EDIT1: 3: Is there an 'if' block, like gamedaypassed? Or something like the object'll reset after one day.Something like:if XY == 0 set XY to 0 if gamedayspassed == 1 set XY to 1EDIT2:4: How can I make new guards in own city take you to their prison? Edited July 25, 2011 by bencebence Link to comment Share on other sites More sharing options...
WarRatsG Posted July 25, 2011 Share Posted July 25, 2011 (edited) 1. My first thought would to add a scripted static object to the cell. This script will create a simple timer, which will kick in whenever you enter the cell. This is a simple timer: Float Timer Begin GameMode Set Timer to ( Timer + GetSecondsPassed ) End 2. Yes, quest scripts are often linked. In fact, quests are often used as databases for this purpose. Imagine the quest is called "MyQuest" and uses a variable called "MyVar" To use a quest variable in another script, it is used like this: Set MyQuest.Myvar to 1 Simple stuff. 3.Yes there is. There is a global - GameDaysPassed - which funnily enough tells you how many days have passed. It is used like this:Short StartDay Set StartDay to GameDaysPassed ;;;insert code here If GameDaysPassed > StartDay ;;;more code Endif 4. A "Jail" is defined by 2 markers - one in the cell and one outside the prison. When you are arrested you are taken to the closest cell marker. Set the markers in the right places and it should work out. Edited July 26, 2011 by WarRatsG Link to comment Share on other sites More sharing options...
lgpmichael Posted July 26, 2011 Share Posted July 26, 2011 Hey everybody!I'd need some help to answer some of my questions.1. How can I add a time variable? Like time spent since entered cell?2. Can I link two scripts? One is a quest script another is an activator/object script. I want to link one of their variables. Is it doable?I had some more in mind, but forgot them, I'll edit this post if I remember.Thanks in advance,bencebence PS.: Also I'd need some help with this question: http://www.thenexusforums.com/index.php?/topic/411959-strang-issue/ EDIT1: 3: Is there an 'if' block, like gamedaypassed? Or something like the object'll reset after one day.Something like:if XY == 0 set XY to 0 if gamedayspassed == 1 set XY to 1EDIT2:4: How can I make new guards in own city take you to their prison? I see that this has already been answered, but I will also add a few extra points 1)If you want to know GAME time since entering a cell, have a script tied to an activator in the cell. The activator will only run its GameMode when in the cell, so you could do something like: short daystart float timestart begin GameMode if ( daystart==0 && timestart==0) set daystart to GameDay set timestart to GetCurrentTime endif end Then simply use those variables on the activator to calculate the amount of game time in the cell whenever you want. It can also be done with a quest script, testing if you are in a cell using GetInCell, but unless you speed up a quest script you can miss the first few seconds (if that is important) 3) An update to the other example above: Short StartDay begin GameMode If GameDaysPassed > StartDay Set StartDay to GameDaysPassed ;;;reset code Endif End The original code in GameMode would never fire as it always reset the StartDay, but in general, yeah.*Note that this will also not fire the reset code if you enter the area on day 0, and so if that is a concern, you will need to add a doonce variable there too, but that is trivial. Link to comment Share on other sites More sharing options...
bencebence Posted July 26, 2011 Author Share Posted July 26, 2011 (edited) Thank you very much both of you. But I have a problem. For the first one, I don't want to calculate the time at the moment, I just want a script run after each gamehour spent in the cell.1 If I enter the cell, it starts counting the time, and after each hour it changes a variable. For example illness. Every hour the illness chnages into a worse one and after X hours, if I didn't get medicine, it'll kill me. 2 This is the one I wanted to know. Thank you very much. 3. This is also something like the first one. I don't want to calculate the current day, but make an already made script reset after 24 gamehours. So for example: I have an activator which gives me X gold. You can use it only once per a day, then wait 24 hours to reset. 4. Also same goes here as the second one. Thank you :P Anyways thank you very much again, I'm sure that I'll need these scripts too in the future. Edited July 26, 2011 by bencebence Link to comment Share on other sites More sharing options...
bencebence Posted July 26, 2011 Author Share Posted July 26, 2011 (edited) Alright, for the first one I made this script:scn RVDirty1 float timestart short dirty Begin GameMode if ( timestart == 0) set timestart to GetCurrentTime endif if (GetCurrentTime == timestart+1 && dirty == 0) set dirty to 1 endif if (GetCurrentTime == timestart+2 && dirty == 1) set dirty to 2 endif if (GetCurrentTime == timestart+3 && dirty == 2) set dirty to 3 player.addspell DisDirt1 messageBox "You're getting dirtier. You should leave the mine." endif if (GetCurrentTime == timestart+4 && dirty == 3) set dirty to 4 endif if (GetCurrentTime == timestart+5 && dirty == 4) set dirty to 5 endif if (GetCurrentTime == timestart+1 && dirty == 5) set dirty to 6 player.removespell DisDirt1 player.addspell DisDirt2 messageBox "You're really dirty now, people don't like you that much. You should go out and clean yourself" endif if (GetCurrentTime == timestart+2 && dirty == 6) set dirty to 7 endif if (GetCurrentTime == timestart+3 && dirty == 7) set dirty to 8 endif if (GetCurrentTime == timestart+4 && dirty == 8) set dirty to 9 endif if dirty == 9 player.removespell DisDirt2 player.addspell DisDirty messageBox "You spent too much time in the dirty mine. Now you got a sickness which can be only cured by a medicine, bought at the general store." endif EndI know that it's repeating itself, but this is good for me :P Apart from that, is it good? Edited July 26, 2011 by bencebence Link to comment Share on other sites More sharing options...
bencebence Posted July 26, 2011 Author Share Posted July 26, 2011 Also one more question: How can I make longer dialogues in quests? I can't even write a well-edited full sentence there... Link to comment Share on other sites More sharing options...
fg109 Posted July 26, 2011 Share Posted July 26, 2011 You forgot to account for changing days. As in, if the player enters at 10pm, then your script would not work correctly at counting time. I prefer using quest scripts instead of activators, so this is what I would use: scn questscript float HourOld short initialize short counter short DayOld Begin GameMode if (Player.GetInCell YourCell) if (initialize == 0) set initialize to 1 set HourOld to GameHour set DayOld to GameDaysPassed endif elseif (initialize == 1) set initialize to 0 set counter to 0 endif if (initialize) if (HourOld + 1 <= GameHour) set counter to counter + 1 set HourOld to GameHour elseif (DayOld < GameDaysPassed) if (HourOld - 23 <= GameHour) set counter to counter + 1 set HourOld to GameHour endif endif if (counter == 3) Player.AddSpell DisDirt1 MessageBox "You're getting dirtier. You should leave the mine." elseif (counter == 6) Player.RemoveSpell DisDirt1 Player.AddSpell DisDirt2 MessageBox "You're really dirty now, people don't like you that much. You should go out and clean yourself" elseif (counter == 9) Player.RemoveSpell DisDirt2 Player.AddSpell DisDirty MessageBox "You spent too much time in the dirty mine. Now you got a sickness which can be only cured by a medicine, bought at the general store." endif endif End For an activator that only lets you activate it once every 24 hours, I would use this: scn activatorscript float HourOld short DayOld short initialize Begin OnActivate set HourOld to GameHour set DayOld to GameDaysPassed set initialize to 1 Activate End Begin GameMode if (initialize == 1) SetDestroyed 1 set initialize to 2 elseif (initialize == 2) if (DayOld + 1 <= GameDaysPassed) if (HourOld <= GameHour) set initialize to 0 SetDestroyed 0 endif endif endif End To have longer dialogue topics, you need to edit the iExtendedTopicLength and bAllowExtendedText values in the ConstructionSet.ini (same location as Oblivion.ini). Link to comment Share on other sites More sharing options...
PrettyMurky Posted July 26, 2011 Share Posted July 26, 2011 Using GetCurrentTime can be unreliable, if you pass into a new game day whilst the script is in effect. Personally I'd do the whole thing this way:if TimeStart || GetCellChanged else Return endif if ( ( player.GetInCell YourMinesDUmmyCell ) == 0 ) set TimeStart to 0 Return elseif TimeStart == 0 set TimeStart to ( ( GameDaysPassed * 24 ) + GameHour + 1 ) Return else if ( ( GameDaysPassed * 24 ) + GameHour ) > TimeStart ) let Dirty += 1 if Dirty == 3 player.addspell DisDirt1 messageBox "You're getting dirtier. You should leave the mine." elseif Dirty == 6 player.removespell DisDirt1 player.addspell DisDirt2 messageBox "You're really dirty now, people don't like you that much. You should go out and clean yourself" elseif Dirty == 9 player.removespell DisDirt2 player.addspell DisDirty messageBox "You spent too much time in the dirty mine. Now you got a sickness which can be only cured by a medicine, bought at the general store." endif endif endif The 'Return' lines are put in for effieciency, but might need to be taken out if you were using the same script to moniter other things as well. Link to comment Share on other sites More sharing options...
PrettyMurky Posted July 26, 2011 Share Posted July 26, 2011 lol fg! You beat me to it by mere minutes (but still potentially enough to neccessitate checking gamedayspassed as well)! Link to comment Share on other sites More sharing options...
fg109 Posted July 26, 2011 Share Posted July 26, 2011 :ninja: :laugh: Link to comment Share on other sites More sharing options...
Recommended Posts