Jump to content

Scripting help: Re-usable chemistry set


AtomicAmelyn

Recommended Posts

Hi.

 

I starting this topic because I need help into making chemistry sets re-usable in New Vegas. I find it sad that I could only use them once, to create chems or stimpacks, and what I'd like to do would be to make them re-usable every 24 or 48 hours, for example.

 

Therefore, I'll post the Chemistry Set script here and have you guys take a look.

 

 

scn GSChemistrySetScript

 

short Button

 

begin OnActivate

 

if IsActionRef player

ShowMessage GSChemistrySetMsg

endif

 

end

 

BEGIN MenuMode 1001

 

set Button to GetButtonPressed

 

if ( Button == 1 )

player.AddItem Stimpak 5

SetDestroyed 1

elseif ( Button == 2 )

player.AddItem Psycho 1

player.AddItem Buffout 1

player.AddItem Mentats 1

player.AddItem NVSteadyChem 1

player.AddItem NVReboundChem 1

SetDestroyed 1

endif

 

END

 

PasteBin version available here.

 

 

If anyone good enough with scripting may know which variables I need to change, please tell me. I will like you and give you kudos.

 

Thanks again.

 

Lady S.

Edited by LadySinestro
Link to comment
Share on other sites

Hi.

 

I starting this topic because I need help into making chemistry sets re-usable in New Vegas. I find it sad that I could only use them once, to create chems or stimpacks, and what I'd like to do would be to make them re-usable every 24 or 48 hours, for example.

 

Therefore, I'll post the Chemistry Set script here and have you guys take a look.

 

 

scn GSChemistrySetScript

 

short Button

 

begin OnActivate

 

if IsActionRef player

ShowMessage GSChemistrySetMsg

endif

 

end

 

BEGIN MenuMode 1001

 

set Button to GetButtonPressed

 

if ( Button == 1 )

player.AddItem Stimpak 5

SetDestroyed 1

elseif ( Button == 2 )

player.AddItem Psycho 1

player.AddItem Buffout 1

player.AddItem Mentats 1

player.AddItem NVSteadyChem 1

player.AddItem NVReboundChem 1

SetDestroyed 1

endif

 

END

 

PasteBin version available here.

 

 

If anyone good enough with scripting may know which variables I need to change, please tell me. I will like you and give you kudos.

 

Thanks again.

 

Lady S.

 

EDIT01: After half a cup of coffee, my brain figured out what was nagging me...

 

That check should be in the activate block. So.

 

scn GSChemistrySetScript

short Button
short bTimeFlag
float fDayUsed
float fDayToday

begin OnActivate

if IsActionRef player

Set fDayToday to GetGameDaysPassed
Set bTimeFlag to 0

if (fDayToday >= (fDayUsed + 3))
Set bTimeFlag to 1
ShowMessage GSChemistrySetMsg
else
;Probably want to show a message about needing mor time here.
endif

end

BEGIN MenuMode 1001

set Button to GetButtonPressed

if bTimeFlag == 1
if ( Button == 1 )
player.AddItem Stimpak 5
Set fDayUsed to GetGameDaysPassed
Set bTimeFlag to 0
elseif ( Button == 2 )
player.AddItem Psycho 1
player.AddItem Buffout 1
player.AddItem Mentats 1
player.AddItem NVSteadyChem 1
player.AddItem NVReboundChem 1
Set bTimeFlag to 0
endIf
else
;Might use this block to let the character 'reload' the chemset.
endif

End[/Code]

 

That's still off the top of my head, untested, etc.

 

EDIT02: Added a missing LeftSquareBracket

EDIT03: Added a missing assignment statement. Right, no more coding before coffee.

Edited by Xaranth
Link to comment
Share on other sites

remove SetDestroyed 1 from the script

 

 

scn GSChemistrySetScript

short Button

begin OnActivate

if IsActionRef player
	ShowMessage GSChemistrySetMsg
endif

end

BEGIN MenuMode 1001

set Button to GetButtonPressed

	if ( Button == 1 )
		player.AddItem Stimpak 5
		SetDestroyed 1
	elseif ( Button == 2 )
		player.AddItem Psycho 1
		player.AddItem Buffout 1
		player.AddItem Mentats 1
		player.AddItem NVSteadyChem 1
		player.AddItem NVReboundChem 1
		SetDestroyed 1
	endif

END

Link to comment
Share on other sites

remove SetDestroyed 1 from the script

 

 

That was my first thought, too, but then I realized that just striking the SetDestroyed would allow it to be reused, but it wouldn't impose a once every several days limit. You could just keep using it forever.

Link to comment
Share on other sites

EDIT01: After half a cup of coffee, my brain figured out what was nagging me...

 

That check should be in the activate block. So.

 

scn GSChemistrySetScript

short Button
short bTimeFlag
float fDayUsed
float fDayToday

begin OnActivate

if IsActionRef player

Set fDayToday to GetGameDaysPassed
Set bTimeFlag to 0

if (fDayToday >= (fDayUsed + 3))
Set bTimeFlag to 1
ShowMessage GSChemistrySetMsg
else
;Probably want to show a message about needing mor time here.
endif

end

BEGIN MenuMode 1001

set Button to GetButtonPressed

if bTimeFlag == 1
if ( Button == 1 )
player.AddItem Stimpak 5
Set fDayUsed to GetGameDaysPassed
Set bTimeFlag to 0
elseif ( Button == 2 )
player.AddItem Psycho 1
player.AddItem Buffout 1
player.AddItem Mentats 1
player.AddItem NVSteadyChem 1
player.AddItem NVReboundChem 1
Set bTimeFlag to 0
endIf
else
;Might use this block to let the character 'reload' the chemset.
endif

End[/Code]

 

That's still off the top of my head, untested, etc.

 

EDIT02: Added a missing LeftSquareBracket

EDIT03: Added a missing assignment statement. Right, no more coding before coffee.

 

I tried your script, but it gave me this error message upon saving:

 

http://i1161.photobucket.com/albums/q513/LadySinestro/errormessage00.jpg

 

I don't know what to do.

 

Lady S.

Link to comment
Share on other sites

In your OnActivate block you are missing an EndIf for "if IsActionRef player".

 

Yeah, it should look like this:

 

begin OnActivate

       if IsActionRef player
       
               Set fDayToday to GetGameDaysPassed
               Set bTimeFlag to 0

               if (fDayToday >= (fDayUsed + 3))
                       Set bTimeFlag to 1
                       ShowMessage GSChemistrySetMsg
               else
                       ;Probably want to show a message about needing mor time here.
               endif

endIf     
end

 

My bad, but that's what happens when you mix me, coding, and no coffee. >.>

 

Good catch, blove.

Link to comment
Share on other sites

Alright guys. I tried out the new script and it saved just fine but, I have another problem now. I tested it in-game and when I tried to activate the chemistry set, it didn't do anything. What should I do now?

 

I think the fault here is that I took GetGameDaysPassed for a function, when what's proper is checking the variable GameDaysPassed. With some minimal testing, this works for me. I don't know why yours compiled with GetGameDaysPassed used, but the GECK is weird.

 

scn GSChemistrySetScript
    
       short DARCdummyButton
       short bTimeFlag
       float fDayUsed
       float fDayToday

begin OnActivate

       if IsActionRef player
       
               Set fDayToday to GameDaysPassed
               Set bTimeFlag to 0

               if (fDayToday >= (fDayUsed + 3))
                       Set bTimeFlag to 1
                       ShowMessage GSChemistrySetMsg
               else
                       ;Probably want to show a message about needing mor time here.
               endif

endif
    
end
    
BEGIN MenuMode 1001
    
       set DARCdummyButton to GetButtonPressed

       if bTimeFlag == 1
               if ( DARCdummyButton == 1 )
                       player.AddItem Stimpak 5
                       Set fDayUsed to GameDaysPassed
                       Set bTimeFlag to 0
               elseif ( DARCdummyButton == 2 )
                       player.AddItem Psycho 1
                       player.AddItem Buffout 1
                       player.AddItem Mentats 1
                       player.AddItem NVSteadyChem 1
                       player.AddItem NVReboundChem 1
                       Set bTimeFlag to 0
               endIf
       else
               ;Might use this block to let the character 'reload' the chemset.
       endif

End

Link to comment
Share on other sites

scn GSChemistrySetScript

short Button
float Timer

Begin GameMode

if (Timer > 0)
	Set Timer to Timer - GetSecondsPassed
endif
END

begin OnActivate

if IsActionRef player
if (Timer <= 0)
	ShowMessage GSChemistrySetMsg
else
	If you want a message for timer put here (but you will have to change the buttons below)
endif

end

BEGIN MenuMode 1001

set Button to GetButtonPressed

	if ( Button == 1 )
		player.AddItem Stimpak 5
		Set Timer to 86400
	elseif ( Button == 2 )
		player.AddItem Psycho 1
		player.AddItem Buffout 1
		player.AddItem Mentats 1
		player.AddItem NVSteadyChem 1
		player.AddItem NVReboundChem 1
           Set Timer to 86400
	endif
   
END

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...