tacomarine Posted November 12, 2016 Posted November 12, 2016 So I've been chugging away at a mod I've been meaning to release for almost two years now, and I've been becoming familiar with more advanced scripting in GECK. The thing I haven't been able to do, however, is create a working timer. I've tried the methods that were recommended by the GECK page, but none have worked for me for some reason. This is the one I tried to use: begin gamemode if timer < 5 set timer to timer + GetSecondsPassed else ;5 seconds have passed, do something special set timer to 0 endifend This doesn't work for me (unless I have to actually call my float timer, which would be monumentally lame) and even if it did it would react really clunky for some of the stuff I want to do over weeks. My question is this: Does anyone know of a reliable way to time something to happen and use that as a timer for a script effect? Like, for instance, an NPC randomly speaking lines? Thank you in advance EDIT: This isn't regarding companion dialogues, the example I gave was for timing unrelated dialogue blurbs. Another example would be telling someone to build something and having a timer for them to build it
DoctaSax Posted November 12, 2016 Posted November 12, 2016 Well, that should work, so let's have a look at your actual script maybe?
tacomarine Posted November 15, 2016 Author Posted November 15, 2016 Well, that should work, so let's have a look at your actual script maybe? Sorry about the delay! Must've missed the notification. heres the actual code that I was testing. begin GameMode if MirandaDeltWith != 1 if MirandaTalk < 30 set MirandaTalk to MirandaTalk + getSecondsPassed elseif MirandaTalk >= 30 MirandaREF.SayTo MirandaREF, 0n0MirandaStoreConvo set MirandaTalk to 0 endif endif end This is a companion before she joins; she is supposed to be talking to herself with those lines, and there are multiple lines used at random continuing until the player recruits her. Like I said, I also want something that will work for multiple days as well. IIRC getdayspassed references the total time that's elapsed and runs into problems somewhere- I've redone the code a couple times, too. If i can find any of my old ones I'll edit them in. Thank you in advance for looking at this for me. Normally I'd look at other peoples work, but my GECK crashes when I load up most anyone elses mods EDIT: I do dumb stuff sometimes... when I put it to the backburner I set the code up to never fire and didn't fix it before posting it in a troubleshooting forum... That's the actual code now. The problem I had with this was that it fired all the lines instantly and wouldn't stop; and I figured it was a bad timer because I could fix it by setting mirandatalk to getseconds passed, so it never fired.
DoctaSax Posted November 15, 2016 Posted November 15, 2016 Still not seeing the problem. Can you confirm that MirandaTalk is a float?
tacomarine Posted November 16, 2016 Author Posted November 16, 2016 Still not seeing the problem. Can you confirm that MirandaTalk is a float? I have it as an int variable. Please don't tell me that was my problem...
Guest Posted November 16, 2016 Posted November 16, 2016 set MirandaTalk to MirandaTalk + getSecondsPassed That's better be a float, yes. GetSecondsPassed is supposed to get a value more or less similar to the time passed since the previous execution of the script, which in most cases for object scripts is 1/fps, about 0.02-0.03. When a Int == float, it'll be rounded to the lower value, so probably MirandaTalk will always remain to its original value, without increasing, due to the small value of GetSecondsPassed.
tacomarine Posted November 16, 2016 Author Posted November 16, 2016 set MirandaTalk to MirandaTalk + getSecondsPassed That's better be a float, yes. GetSecondsPassed is supposed to get a value more or less similar to the time passed since the previous execution of the script, which in most cases for object scripts is 1/fps, about 0.02-0.03. When a Int == float, it'll be rounded to the lower value, so probably MirandaTalk will always remain to its original value, without increasing, due to the small value of GetSecondsPassed. I figured it'd be something simple. Thanks, I'll test that out when I get back home
tacomarine Posted November 17, 2016 Author Posted November 17, 2016 *deep sigh* well, I read the part that said they were both stored as floats. Holy shit I can't believe I missed that.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.