Help with timer quest and scripting

Post » Mon Aug 01, 2011 4:25 am

I'm trying to set up a quest where the player buys some furniture and a couple of days later the furniture is delivered to their home. The mechanics of it are like this:

Player clicks on a Holotape activator and gets a message with the option of buying the furniture if they have the cash. That activator and message box will trigger the timer quest and script for the waiting period for the delivery. After the delivery time has passed the player will get a pop up telling them that their furniture has been delivered.

I believe I have the activator working properly as I set it to add a Holotape “voucher” to the players inventory just to sort of simulate a receipt. (I also may use it for a dialog condition and quest stage later)

So, it displays the message box properly based on its condition requirements and adds the voucher just as it should, so as much as I can tell that part is fine. (I'll still post it so you can see if you see anything I might have missed.)

But after that I can wait the designated time and nothing happens. No delivery message and no furniture enabled, so I guess I've not gotten the quest script functioning properly. If you would please take a look and hopefully someone can help me with what I screwed up. (BTW, it's saving in GECK, so at least I got that much correct.)

Oh yeah, one other thing I'd ultinately like to do would be not allow the furniture to be enabled if the player were in the cell where it goes. Preferably, I'd like them somewhere away from Goodsprings if possible, although I don't know if that can be done.

Thanks, and here's what I have right now.

QUEST – BalokDeliverFurnitureQuest
Priority – 55
Start Game Enabled – Un-checked
Script Processing delay – checked

Quest Script

scn BalokFurnitureTimerScriptshort nDeliveryDay         short bGiveFurniture   short DoOnceBEGIN GameMode                if (DoOnce == 0)                                                set bGiveFurniture to 0                                   set nDeliveryDay to GameDaysPassed        endif                if ( GameDaysPassed >= nDeliveryDay + 1 )                     set bGiveFurniture to 1                        endif        if ( bGiveFurniture == 1)                                                        BalokEnableFurniture.enable                ShowMessage BalokFurnitueDeliveryMessage 			   Set DoOnce to 1                        endif        endifEND



Activator Script

scn BalokFurnitureActivatorScriptshort DoOnceshort Button begin GameMode        if DoOnce == 1                ShowMessage BalokPurchaseFurnitureMessage                set DoOnce to 2                elseif DoOnce == 2                set Button to GetButtonPressed                if Button >= 0                        set DoOnce to 3                        if ( Button == 0 )                                     								 					StartQuest BalokDeliverFurnitureQuest                                         Player.additem BalokHolotapeFurniture 1												 elseif ( Button == 1 )                                set DoOnce to 0                        endif                endif        endifendbegin OnActivate        if IsActionRef Player && DoOnce == 0                Activate                        Set DoOnce to 1        endifend

User avatar
JeSsy ArEllano
 
Posts: 3369
Joined: Fri Oct 20, 2006 10:51 am

Post » Mon Aug 01, 2011 6:18 am

BEGIN GameMode                if (DoOnce == 0)                                                set bGiveFurniture to 0                                   set nDeliveryDay to GameDaysPassed        endif 



Well after a quick glance I see the above area as a problem already. Since you never change DoOnce, it is always setting nDeliveryDay to GameDaysPassed, so the next line that checks if it has been 1 days, will never ever fire, as it will never be more than like .001 days (or five real seconds). Set DoOnce to 1 right there in that block, then either set it to 2 later and move all of your instances of DoOnce up by 1, or have a DoOnce and a DoOnce2.
User avatar
Tina Tupou
 
Posts: 3487
Joined: Fri Mar 09, 2007 4:37 pm

Post » Mon Aug 01, 2011 12:13 am

Well after a quick glance I see the above area as a problem already. Since you never change DoOnce, it is always setting nDeliveryDay to GameDaysPassed, so the next line that checks if it has been 1 days, will never ever fire, as it will never be more than like .001 days (or five real seconds). Set DoOnce to 1 right there in that block, then either set it to 2 later and move all of your instances of DoOnce up by 1, or have a DoOnce and a DoOnce2.


OK thanks. I did that and it fires now at the end of the waiting period, but the delivery message pops up over and over and over. I tried adding CompleteQuest BalokDeliverFurnitureQuest before the set DoOnce to 2 but it didn't fire then, lol.

Spoiler
scn BalokFurnitureTimerScriptshort nDeliveryDay         short bGiveFurniture   Short DoOnceBEGIN GameMode                if (DoOnce == 0)   		        Set DoOnce to 1                set bGiveFurniture to 0                                   set nDeliveryDay to GameDaysPassed        endif                if ( GameDaysPassed >= nDeliveryDay + 1 )                     set bGiveFurniture to 1                        endif        if ( bGiveFurniture == 1)                                                        BalokEnableFurniture.enable                ShowMessage BalokFurnitueDeliveryMessage                 CompleteQuest BalokDeliverFurnitureQuest 	                       Set DoOnce to 2				                        endif        endifEND

User avatar
Ross Thomas
 
Posts: 3371
Joined: Sat Jul 21, 2007 12:06 am

Post » Mon Aug 01, 2011 1:28 am

Well I have one thing about your logic in the part where it says


set nDeliveryDay to GameDaysPassed

then it says

if ( GameDaysPassed >= nDeliveryDay + 1 )
set bGiveFurniture to 1
endif

you might as well say

set nDeliveryDay to GameDaysPassed + 1

then if gamedayspassed >= nDeliveryDay
set bGiveFurniture to 1
endif

well now looking at it there might not be a difference

sorry it's not a fix of your entire script but it's just something I noticed when I looked at it
User avatar
Marie Maillos
 
Posts: 3403
Joined: Wed Mar 21, 2007 4:39 pm

Post » Mon Aug 01, 2011 8:47 am

OK thanks. I did that and it fires now at the end of the waiting period, but the delivery message pops up over and over and over. I tried adding CompleteQuest BalokDeliverFurnitureQuest before the set DoOnce to 2 but it didn't fire then, lol.

Spoiler
scn BalokFurnitureTimerScriptshort nDeliveryDay         short bGiveFurniture   Short DoOnceBEGIN GameMode                if (DoOnce == 0)   		        Set DoOnce to 1                set bGiveFurniture to 0                                   set nDeliveryDay to GameDaysPassed        endif                if ( GameDaysPassed >= nDeliveryDay + 1 )                     set bGiveFurniture to 1                        endif        if ( bGiveFurniture == 1)                                                        BalokEnableFurniture.enable                ShowMessage BalokFurnitueDeliveryMessage                 CompleteQuest BalokDeliverFurnitureQuest 	                       Set DoOnce to 2				                        endif        endifEND


Same as before. It shows the message if bGiveFurniture is 1. You show the message, but never change that variable. So either make it something like && If DoOnce < 2, change bGiveFurniture to something else after showing the message, or add another variable to control that. It simply is always true, so the message shows up over and over and over.

Well I have one thing about your logic in the part where it says


set nDeliveryDay to GameDaysPassed

then it says

if ( GameDaysPassed >= nDeliveryDay + 1 )
set bGiveFurniture to 1
endif

you might as well say

set nDeliveryDay to GameDaysPassed + 1

then if gamedayspassed >= nDeliveryDay
set bGiveFurniture to 1
endif

well now looking at it there might not be a difference

sorry it's not a fix of your entire script but it's just something I noticed when I looked at it


Thats pretty much the same thing, you just moved a line. Neither is really better or worse.
User avatar
Katharine Newton
 
Posts: 3318
Joined: Tue Jun 13, 2006 12:33 pm

Post » Mon Aug 01, 2011 12:50 am

Same as before. It shows the message if bGiveFurniture is 1. You show the message, but never change that variable..... It simply is always true, so the message shows up over and over and over.


Gah! This is me, >>> :banghead: :facepalm: <<<<

Thank you, I hope I got it now. I reworked it and it appears to be working correctly with one initial test. Will check it further but I think it's right this time. Sometimes when I've looked at something for too long (especially scripting) I start not being able to see the obvious! I'm trying really hard to learn this stuff, and I'm making a little progress (baby steps, lol) but this process is very painful for me as I only understand enough of this stuff to be dangerous, lol.

Thanks AV, ( :ninja: aka GM) and Dandys, I really appreciate your help! :foodndrink:

See if this looks better to ya

Spoiler
scn BalokFurnitureTimerScriptshort nDeliveryDay         short bGiveFurniture   short DoOnceBEGIN GameMode                if DoOnce == 0                 set DoOnce to 1                set bGiveFurniture to 1                                   set nDeliveryDay to GameDaysPassed        endif                if GameDaysPassed >= nDeliveryDay + 1 && bGiveFurniture == 1                set bGiveFurniture to 2                set DoOnce to 2				        endif        if bGiveFurniture == 2 && DoOnce == 2                              BalokEnableFurniture.enable                ShowMessage BalokFurnitueDeliveryMessage                set bGiveFurniture to 3	        set DoOnce to 3        endif        endifEND

User avatar
Adrian Powers
 
Posts: 3368
Joined: Fri Oct 26, 2007 4:44 pm

Post » Mon Aug 01, 2011 2:50 am

Gah! This is me, >>> :banghead: :facepalm: <<<<

Thank you, I hope I got it now. I reworked it and it appears to be working correctly with one initial test. Will check it further but I think it's right this time. Sometimes when I've looked at something for too long (especially scripting) I start not being able to see the obvious! I'm trying really hard to learn this stuff, and I'm making a little progress (baby steps, lol) but this process is very painful for me as I only understand enough of this stuff to be dangerous, lol.

Thanks AV, ( :ninja: aka GM) and Dandys, I really appreciate your help! :foodndrink:

See if this looks better to ya

Spoiler
scn BalokFurnitureTimerScriptshort nDeliveryDay         short bGiveFurniture   short DoOnceBEGIN GameMode                if DoOnce == 0                 set DoOnce to 1                set bGiveFurniture to 1                                   set nDeliveryDay to GameDaysPassed        endif                if GameDaysPassed >= nDeliveryDay + 1 && bGiveFurniture == 1                set bGiveFurniture to 2                set DoOnce to 2				        endif        if bGiveFurniture == 2 && DoOnce == 2                              BalokEnableFurniture.enable                ShowMessage BalokFurnitueDeliveryMessage                set bGiveFurniture to 3	        set DoOnce to 3        endif        endifEND



Haha, dont worry about it! I am more than known for making a topic, then posting back 5 minutes later saying I fixed it and I was being stupid.

You can shorten that new script quite a bit. I have created an alternate version. Have a look:

Spoiler
scn BalokFurnitureTimerScriptshort DoOnceFloat nDeliveryDayBegin GameMode	If DoOnce == 0		Set DoOnce to 1		Set nDeliveryDay to GameDaysPassed	EndIf	If GameDaysPassed >= (nDeliveryDay + 1) && DoOnce == 1		Set DoOnce to 2		BalokEnableFurniture.enable		ShowMessage BalokFurnitueDeliveryMessage	EndIfEnd


I took out bGiveFurniture, because as far as I could tell, it would serving the exact same purpose as DoOnce. I also made nDeviveryDay a Float instead of a Short, which should make it more precise. In addition, I combined your second and third If statements, because the second one would fire, then IMMEDIATELY the third one would fire. There is no point in even having them separate, except to make the script more complicated.

Also, if I'm not imposing too much, I looked back down on your first script for the activator. I believe that can be cleaned up quite a bit as well:

Spoiler
scn BalokFurnitureActivatorScriptshort DoOnceshort ButtonBegin OnActivate	If IsActionRef Player == 1 && DoOnce == 0		Activate		Set DoOnce to 1		ShowMessage BalokPurchaseFurnitureMessage	EndIfEndBegin GameMode	If DoOnce == 1		Set Button to GetButtonPressed		If Button == 0			StartQuest BalokDeliverFurnitureQuest			Player.AddItem BalokHolotapeFurniture 1			Set DoOnce to 2		ElseIf Button == 1			Set DoOnce to 0		EndIf	EndIfEnd


First I placed the activator block above the gamemode block, because at least for me it's easier because it's more chronological (i.e. the activator block is what triggers the rest). I placed the ShowMessage in the activate block, because again you had one area that set the other one off instantly, might as well combine them. Also, I wasnt sure what you wanted with the DoOnce. In your script, you set it to 3 if Button is >= 0, which it will ALWAYS be, but then you set DoOnce to 1 if Button == 1, even though you just said to set it to 3 if Button was 1... As best as I could tell, you meant: If they select button 0, they are saying "Ok, lets do the quest!" and you dont want them to ever be able to get into this menu system again. In which case, I set DoOnce to 2, making the whole script stop from then on. Then if they say Button 1, they are saying "No thanks, I'll do this quest later." At which point, you want to reset the whole thing by setting DoOnce to 0.

Let me know if you have any other questions!

Alexander J. Velicky
User avatar
Laura Simmonds
 
Posts: 3435
Joined: Wed Aug 16, 2006 10:27 pm

Post » Mon Aug 01, 2011 5:28 am

Haha, dont worry about it! I am more than known for making a topic, then posting back 5 minutes later saying I fixed it and I was being stupid.

You can shorten that new script quite a bit. I have created an alternate version. Have a look...


WOW! Thanks AV! I truly appreciate the help. I've already got most of them set up, lol. But I think I'll use your templates and go back and redo them with the much cleaner versions. Actually, you don't know how much seeing what I was trying to hack together re-written in a cleaner and more precise manner teaches me. My novice skills force me to sort of break this stuff down into smaller and easier to understand blocks, so that's probably why I had stuff doing the same thing or went the long way around to get there, lol.

I'm also usually looking at another script that seems to be doing something similar to what I'm trying to accomplish, and using bits of it to hack together my own attempt at a script, lol. I'm hoping that some day I wont feel that I'm totally hacking these mods together with bubblegum, duct tape and chicken wire, lol.
User avatar
Lizzie
 
Posts: 3476
Joined: Sun Nov 19, 2006 5:51 am

Post » Sun Jul 31, 2011 7:57 pm

WOW! Thanks AV! I truly appreciate the help. I've already got most of them set up, lol. But I think I'll use your templates and go back and redo them with the much cleaner versions. Actually, you don't know how much seeing what I was trying to hack together re-written in a cleaner and more precise manner teaches me. My novice skills force me to sort of break this stuff down into smaller and easier to understand blocks, so that's probably why I had stuff doing the same thing or went the long way around to get there, lol.

I'm also usually looking at another script that seems to be doing something similar to what I'm trying to accomplish, and using bits of it to hack together my own attempt at a script, lol. I'm hoping that some day I wont feel that I'm totally hacking these mods together with bubblegum, duct tape and chicken wire, lol.

Oh dont worry. Your exactly where I was like 8 months ago. I was always asking about my scripts, I never did them efficiently. You'll get better, you just have to practice. And if you think doing those 20 line scripts well was bad, try scripting a 2 minute long cutscene thats over 300 lines! (That was a fun 12 hour grind. :D) Just keep up the practice and you'll get better and better. Hell, I hardly ever make mistakes in scripts anymore, but a year ago I was a complete mess. :P
User avatar
Rodney C
 
Posts: 3520
Joined: Sat Aug 18, 2007 12:54 am


Return to Fallout: New Vegas