Jump to content

Script help


scrivener07

Recommended Posts

Im trying modify the xander root script to allow a harvest everyday. I used parts of this script to get myself started. Until now the script would at least save so there must be an error somewhere and Im not getting the results I wanted. Any advice would be greatly appreciated.

scn NovecXanderRootScript

int State 
short Timepassed

begin onActivate
if State == 0 && GetActionRef == player
	player.additem XanderRoot 2
	set State to 1
	playGroup Backward 1
	setdestroyed 1
	Set Timepassed to GameDaysPassed + 1		
endif
end



begin onLoad
if State == 1 && GameDaysPassed > Timepassed	
	set State == 0
	playGroup Forward 1
	setdestroyed 0
elseif State == 1
	playGroup Backward 1		
endif
end

This is my first serious attempt at scripting for fallout. I can already see why so many people do this for fun.

 

edit: heres the vanillia script btw

scn XanderRootScript

int State

begin onActivate
if State == 0 && GetActionRef == player
	player.additem XanderRoot 1
	set State to 1
	playGroup Backward 1
	setdestroyed 1
endif
end

begin onLoad
if State == 0
	playGroup Forward 1
elseif State == 1
	playGroup Backward 1		
endif
end

begin onReset
if State == 1
	playgroup Forward 1
	set State to 0
	setdestroyed 0
endif
end

Link to comment
Share on other sites

Some functions don't compile in the onActivate section

 

My gut is telling me it is GameDaysPassed in the onActivate section thats the culprit.

 

An easy way to isolate the problem line is put a ; at the start of each suspect line of code and see if it saves. When it saves you've identified the culprit. You may have to add quite a few to narrow it down, and depending on how much stuff you added since the last save it could be more than one thing.

 

Sometimes it's easier to ; off the whole section then remove the ; one line at a time until it stops saving.

Link to comment
Share on other sites

I take that back, it is "set state == 0" needs to read "set state to 0"; however, using the ; is a good strategy to identify such problems they are easy to make with a compliler that doesn't provide any info. Edited by drakeelvin
Link to comment
Share on other sites

 

begin onLoad
if State == 1 && GameDaysPassed > Timepassed	
;		set State == 0 
	playGroup Forward 1
	setdestroyed 0
elseif State == 1
	playGroup Backward 1		
endif
end

Ha thanks for the awesome tip using comments to isolate issues!

Yes I got it! " set State == 0 " is incorrect it should be " set State to 0 "

 

edit: looks like you found it right when I did

 

KUDOS

Link to comment
Share on other sites

Darn, Im still not getting the results I want. Initially when I enter the cell its in it appears harvested but it can still be activated and picked. After a day it appears harvestable but it is not. I feel so close I can almost taste the xander root. My logic is must be backwards somewhere but Im just not seeing it. :) need advice and thanks in advance!

 

scn NovecXanderRootScript

int State 
short Timepassed

begin onActivate
if State == 0 && GetActionRef == player
	player.additem XanderRoot 2
	set State to 1
	playGroup Backward 1
	setdestroyed 1
	Set Timepassed to GameDaysPassed + 1		
endif
end

begin onLoad
if State == 1 && GameDaysPassed > Timepassed	
	set State to 0
	setdestroyed 0
else State == 1
	playGroup Backward 1		

elseif State == 0
	playGroup Forward 1
endif
end

Link to comment
Share on other sites

  • Recently Browsing   0 members

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