Asking for help svcks...

Post » Sat May 28, 2011 5:38 pm

I have a pet project... which is getting closer, now, to being possible... but there is at least one fairly sizable chunk of the puzzle missing.



In the mod I am currently working on, I have what will soon be (hopefully) a functional distilling vat. I just borrowed the mesh from the one already in the game... it will serve my purposes just fine. Here's the issue. I want to make it actually -distill-... and that means that I want it to take a believable amount of time to process the alcohol one would be creating inside. Not necessarily the years it takes to adequately age bourbon or anything here... just something to make it a little more involved than the standard crafting menu.

This means I need a script... and not only just to handle the detection of passed time... but to detect the items within the vat, and process them as they would be processed if this were a recipe bench.


Any help on this would be appreciated... as I have absolutely no idea where to start. Time and time again I have tried to learn to properly script... but the best I can do is cannibalize the work already done, and borrow those tidbits of coding provided generously by other... more talented souls.


So thank you, in advance... this is really driving me crazy...
User avatar
Penny Wills
 
Posts: 3474
Joined: Wed Sep 27, 2006 6:16 pm

Post » Sat May 28, 2011 3:00 pm

Well I looked and looked and looked but could not find the script used when Cass makes whiskey, That seemed like a good place to start since what you are trying to achieve is so similar. Try looking at the HD00 Lab script. Part of it makes a random drug type that takes a set amount of time. Theres also a similar script for making whiskey in the FO3 DLC Point Lookout but I don't have the FO3 GECK loaded.
User avatar
dean Cutler
 
Posts: 3411
Joined: Wed Jul 18, 2007 7:29 am

Post » Sat May 28, 2011 10:23 am

Thank you for that suggestion about the HD00 lab script! That seems like a perfectly reasonable place to start... at least without my being able to find Cass' whiskey script...



The only problem I have now is that I need to figure out how to amend the script to allow for the creation of different chemicals. As it stands, the original "My First Laboratory" script produces a 'chem' at random... and does not allow for any variance in the time it takes for that chem to be created.

What I want is a user-selectable creation process which will allow the player to create Whiskey, Beer, or Vodka...

... then I need to know how to make it look for certain items in the player's inventory... Maize, Agave, Potatoes... I don't quite know what the 'recipe' will be yet... for activation of the distilling/brewing process.


What are the functions I will need to make this possible... and how the hell do I implement them correctly?

Scripting is like trying to write in a foreign language for me... only... I failed Spanish class because foreign languages are way hard for me to grasp... so any help with this would be appreciated. If need be, once I get these messages finished and the 'buttons' ready... I can post the temporary version of the script I'm working on.
User avatar
Ebou Suso
 
Posts: 3604
Joined: Thu May 03, 2007 5:28 am

Post » Sat May 28, 2011 1:40 pm

I did not trace all the way through Cass' whiskey routine, but I think it is done purely in dialog with no delay. It shows up in her dialog tree. Search for "moonshine" using the Edit -> Find Text menu in geck. You can see the way to check for ingredients in the dialog conditions. If you had a separate list of ingredients for each liquor, you could have multiple dialog choices. You probably won't have dialog with the distillery (until you have had *way* too much to drink), so this may not work directly for you. But some of the pieces will help.
User avatar
Mari martnez Martinez
 
Posts: 3500
Joined: Sat Aug 11, 2007 9:39 am

Post » Sat May 28, 2011 9:46 am

Well, the Lab script has a timer that is roughly one day.

See if you could insert that timer portion into the script for crafting and change the names to match the recipes you want to implement.

I posted a simple script http://www.gamesas.com/index.php?/topic/1145909-bobble-head-stand/ that checks for items a player has and then removes them from inventory.

From that you should be able to cobble something together. That script I posted is patched together from 2 other scripts with a tiny bit of tweaking by me.
User avatar
Unstoppable Judge
 
Posts: 3337
Joined: Sat Jul 29, 2006 11:22 pm

Post » Sat May 28, 2011 8:35 am

Ah! Thanks, both of you... I'm going to see if I can't piece something together here and test it out.


I'll pop back in with my script, too, just in case either of you find yourselves willing to see where I screwed up (which I will, inevitably, do) and point it out to me.

-Cheers!
User avatar
Vicki Blondie
 
Posts: 3408
Joined: Fri Jun 16, 2006 5:33 am

Post » Sat May 28, 2011 11:39 am

----sorry, wrong thread----
User avatar
Josh Sabatini
 
Posts: 3445
Joined: Wed Nov 14, 2007 9:47 pm

Post » Sat May 28, 2011 12:12 pm

Here's what I've got to start with... it's essentially an exact copy of the script used by the lab, only with the variable changed to reflect my still (PHECstill) as I want to remove any possibility of this interfering with the functionality of the original script.


Now, I see the built in timer... it is the portion of the script down at the bottom. Ideally, I would like to have multiple 'timers' to reflect the process of creating the different alcohols. How would I do this? Does this mean I need to create several different 'variables' at the beginning of the script? Or is it possible to use the timer already in place to achieve the same results?

The scripts you both pointed me to gave me the functions I will require to make the still 'remove' the recipe components... but, of course, this means I will have to add some 'recipe' notes throughout the wasteland in order to give the player some idea of WHAT they can make whiskey, vodka, beer, or 'Moonshine' with... and that isn't something I need scripting for, so woo-freaking-hoo on that part.


The only other real scripting issue I have now besides the timer... is determining if there is any way for the script to accommodate recipes that can have 'x ingredient' or 'y ingredient...

Can this be done?




Spoiler
scn 03xPHECxDistillingshort Doneshort Buttonshort PHECstill0															1= The laboratory is now "brewing" a drugfloat PHECstillTime0														x.x= Float for how much time has passedshort ProcessButton;Globals used herebegin OnActivate	if IsActionRef player == 1			if ( PHECstill0 == 0 )				set ProcessButton to 1			ShowMessage HD00LabMessage		elseif ( PHECstill0 == 1 )			ShowMessage HD00LabMessage01		elseif ( PHECstill0 == 2 )			Set PHECstill0 to 0			ShowMessage HD00LabMessage02			Player.AddItem LootChemsAll100 1		endif	endifendbegin gamemode;This section of the gamemode block handles all of the button presses on the Laboratory kit	set Button to GetButtonPressed	if Button > -1		if ProcessButton == 1			if ( Button == 0 )				Set PHECstill0 to 1				Set PHECstillTime0 to GameDaysPassed			elseif ( Button == 1 )				Player.RemoveSpell WithdrawalQuantumNukacola				Player.RemoveSpell WithdrawalAlcohol				Player.RemoveSpell WithdrawalBuffout				Player.RemoveSpell WithdrawalJet				Player.RemoveSpell WithdrawalMentats				Player.RemoveSpell WithdrawalMorphine				Player.RemoveSpell WithdrawalPsycho				ShowMessage HDLabDetoxify			elseif ( Button == 2 )			endif		endif		; clear button variable		set ProcessButton to 0	endif		if ( PHECstill0 == 1 )		if ( GameDaysPassed - PHECstillTime0 >= 1 )			Set PHECstill0 to 2		endif	endifend



Actually, now that I've looked at it... I'm not entirely sure what this 'ProcessButton' variable is, either...

... logic would lead me to believe that this has something to do with the 'message box' menu being opened... but I'm not at all sure how or why or whether this would need any kind of adjusting from its current state. I -do- know that I am going to need to add new code for the button options allowing the player to select the liquor they would like to make...

Oi... >.< ... I wish I wasn't such crap at this.
User avatar
Danny Warner
 
Posts: 3400
Joined: Fri Jun 01, 2007 3:26 am

Post » Sat May 28, 2011 11:49 am

Deciphering the original script. Give me a few.


EDIT. Thats why I was thinking you should start with the crafting script and try and work the timer into it. If you examine those "Lab" Messages you wil start to get the idea how they work. You will find them in the object window under Miscelaneous.
User avatar
City Swagga
 
Posts: 3498
Joined: Sat May 12, 2007 1:04 am

Post » Sat May 28, 2011 3:43 am

Deciphering the original script. Give me a few.


EDIT. Thats why I was thinking you should start with the crafting script and try and work the timer into it. If you examine those "Lab" Messages you wil start to get the idea how they work. You will find them in the object window under Miscelaneous.




I've been looking at the scripts used for the standard crafting menu... but for the life of me, I can't figure out where I would start.


The crafting scripts all call up the menu... which would be fairly easy for me to use, straight out, as I have done with the other portion of this mod which focuses on chems and aid items and the identification of unidentified chemical compounds scavenged from around the wastes.

How, then, would I introduce the timer into that script... because as far as I can discern... attaching a timer to the script in place there would only cause the MENU to open after a delay, wouldn't it?

It would require a certain deal more additional scripting if I wished to make the player activate the still again in order to 'retrieve' their booze, no?



It seems to me that the lab's script would be perfect... just so long as I can figure out what I do and do not need to change, and how.

Or maybe I'm just missing something...

... I donno, but I do feel like I'm at least -learning- stuff. So that's good.


I'll wait to see what else you have to say before I go too far... but for now, I do have one question:


With the timer... if I wanted it to check for a different number of days passed dependent upon the liquor...

... could I add in some kind of a variable that checks if 'button one = 1' then 'if ( GameDaysPassed - PHECstillTime0 >= 1 ) or what-have-you...?


If so... what would be the proper way to set that up?

If I had three of those, it would mean that I could have the still check for different times for different liquor to be completed, and then just add in the code for it to give the item to the player, right?
User avatar
Iain Lamb
 
Posts: 3453
Joined: Sat May 19, 2007 4:47 am

Post » Sat May 28, 2011 6:08 am

Well I've never actually lppked at how recipes are handled so I was just kind of poiunting in the general direction. Now that I've actually looked at recipes and categories I would have to agree. I'm thinking in the section of the Lab script where it removes all the various effects, you would delete those and write in the commands used in the crafting scripts that call up the menus for crafting. Though you would be calling on the categories and recipes that you have created for your still.
That way the script would run once for every activation but if the timer had not run out, it would only display the message that the still was in use.
User avatar
Marina Leigh
 
Posts: 3339
Joined: Wed Jun 21, 2006 7:59 pm

Post » Sat May 28, 2011 12:17 pm

I'm groping in the dark too. I've just been through this process a few times with some success so I can shed a little bit of light. I don't know how to write code but I am fairly good at deciphering it.
User avatar
Chris Duncan
 
Posts: 3471
Joined: Sun Jun 24, 2007 2:31 am

Post » Sat May 28, 2011 7:05 am

Hrrm... well, I think we're both on the same page, at least...


The part of the code in which the lab's original 'detoxify' scripting is done is going to be removed and replaced with the new button selection codes.


Writing the code for this part is going to very likely be beyond my level of skill at the moment, but here's what I have now:



Spoiler
scn 03xPHECxDistillingshort Doneshort Buttonshort PHECstill0															1= The laboratory is now "brewing" a drugfloat PHECstillTime0														x.x= Float for how much time has passedshort ProcessButton;Globals used herebegin OnActivate	if IsActionRef player == 1			if ( PHECstill0 == 0 )				set ProcessButton to 1			ShowMessage 03xPHECxDistilleryVatMsg01		elseif ( PHECstill0 == 1 )			ShowMessage 03xPHECxDistilleryVatMsg02		elseif ( PHECstill0 == 2 )			Set PHECstill0 to 0			ShowMessage 03xPHECxDistilleryVatMsg03			Player.AddItem LootChemsAll100 1		endif	endifendbegin gamemode;This section of the gamemode block handles all of the button presses on the Laboratory kit	set Button to GetButtonPressed	if Button > -1		if ProcessButton == 1			if ( Button == 0 )				Set PHECstill0 to 1				Set PHECstillTime0 to GameDaysPassed			elseif ( Button == 1 )								ShowMessage HDLabDetoxify			elseif ( Button == 2 )			endif		endif		; clear button variable		set ProcessButton to 0	endif		if ( PHECstill0 == 1 )		if ( GameDaysPassed - PHECstillTime0 >= 1 )			Set PHECstill0 to 2		endif	endifend


The part where it says...

elseif ( button == 1)

showmessage HDLabDetoxify
elseif


... and blah-blah-blah is going to be where I put in the second option, which will be to distill a batch of whiskey or vodka... I would have to check back to get the exact order. Anyways, does this mean that I'm going to also have the code change the variable ( PHECstill0 ) again to something like... 3 or 4 ... in order to differentiate between which timer and which liquor the player receives?

If so... I almost think I might understand what I'm doing.

... just a little bit...
User avatar
Yung Prince
 
Posts: 3373
Joined: Thu Oct 11, 2007 10:45 pm

Post » Sat May 28, 2011 5:05 pm

Yes. I think you are on the right track. I think in that section you might want something similar to whats in the crafting script. Assuming you are using actual "recipes" and "categories" created from the object window.

EDIT: This is what I've deciphered of the Lab script so far. My notes come after ;;;.
scn HD00LabScriptshort Done							;;;short Button							;;; Value of the button pressedshort HDLab0						;	1= The laboratory is now "brewing" a drugfloat HDLabTime0					;	x.x= Float for how much time has passedshort ProcessButton				;;; Has button been pressed;Globals used herebegin OnActivate	if IsActionRef player == 1			if ( HDLab0 == 0 )				;;; If the machine is not busy			set ProcessButton to 1		;;; Set button as pressed			ShowMessage HD00LabMessage	;;; Shows the menu to the player		elseif ( HDLab0 == 1 )				;;; If the machine is busy			ShowMessage HD00LabMessage01	;;; Show "machine in use" message		elseif ( HDLab0 == 2 )				;;; If the machine is finished			Set HDLab0 to 0			;;; Set machine to not busy			ShowMessage HD00LabMessage02	;;;Show the "completed a compound." message			Player.AddItem LootChemsAll100 1	;;; Gives player new compound. Haven't yet explored where it 		endif					;;; holds these items till they are given to the player.	endifendbegin gamemode;This section of the gamemode block handles all of the button presses on the Laboratory kit	set Button to GetButtonPressed				 ;;;	if Button > -1					;;;		if ProcessButton == 1						;;;			if ( Button == 0 )				Set HDLab0 to 1				Set HDLabTime0 to GameDaysPassed			elseif ( Button == 1 )				Player.RemoveSpell WithdrawalQuantumNukacola	;;; Here you would remove				Player.RemoveSpell WithdrawalAlcohol		;;; this section and process 				Player.RemoveSpell WithdrawalBuffout		;;; your recipe instead.				Player.RemoveSpell WithdrawalJet		;;;				Player.RemoveSpell WithdrawalMentats		;;;				Player.RemoveSpell WithdrawalMorphine		;;;				Player.RemoveSpell WithdrawalPsycho		;;;				ShowMessage HDLabDetoxify			;;;			elseif ( Button == 2 )			endif		endif		; clear button variable		set ProcessButton to 0	endif		if ( HDLab0 == 1 )		if ( GameDaysPassed - HDLabTime0 >= 1 )			Set HDLab0 to 2		endif	endifend
.
User avatar
how solid
 
Posts: 3434
Joined: Mon Apr 23, 2007 5:27 am

Post » Sat May 28, 2011 10:31 am

I was actually thinking of foregoing the recipe section for this part...


I've already got recipes in the works for the chemistry part of this project, and the actual apparatus for those is working just fine.

While I -could- use some sort of a recipe to handle the liquor portion of the mod as well... I really think it would just be easier to use the 'getitemcount' option, remove the necessary items from the player's inventory, and set the still to wait x-amount of days until the player comes back and activates it again, receiving their booze.

If I wanted to make it really complex, I suppose I could even force the player to -fuel- their still... >.> ... but that's definitely beyond my abilities at the moment.
User avatar
Izzy Coleman
 
Posts: 3336
Joined: Tue Jun 20, 2006 3:34 am

Post » Sat May 28, 2011 1:57 pm

I think fueling could be as easy as adding a "getitemcount" for flamer fuel and adding a "message" if there isn't sufficient fuel in the players possession.

EDIT: I just now learned how recipes work and thought it seemed like the proper application.
User avatar
helliehexx
 
Posts: 3477
Joined: Fri Jun 30, 2006 7:45 pm

Post » Sat May 28, 2011 12:15 pm

I really do like the recipes option for most things... but I wanted the still to feel unique... less like another menu in disguise... and more like a piece of equipment which just so happens to have a menu pop up.


I'm trying to figure out the proper way of writing the code needed in order to make the script check for the required items pertaining to the selected option, at the moment... however... I've got no idea what in the nine hells it should look like. >.<

I'm thinking it should be something like this:


elseif ( Button == 1 )
Player.GetItemCount NVFreshMaize >= 1

Player.GetItemCount GenericIngredient >= 1

Player.GetItemCount GenericOtherIngredient >= 1

elseif (so on and so forth == whatever )


... that would work, kind've... right? I could do it that way?

What I'm really concerned about with -that- method, though, is that... wouldn't I need another variable to check whether or not the right ingredients are had? Or at least something that triggers and tells the player that they don't have sufficient Moonshinejuice in order to create their batch of hooch?

>.< It's very strange to hear these words coming out of my mouth... I don't even know what the hell I'm saying half the time! X_X
User avatar
Ashley Hill
 
Posts: 3516
Joined: Tue Jul 04, 2006 5:27 am


Return to Fallout: New Vegas