Jump to content

Script fix


Recommended Posts

Ok, I stink at timers of all kinds. I've got a script I'm trying to implement. You have hired an NPC to work at your newly reopened blacksmith shop. Every 7 days you can come and collect your share of the profits. If you do nothing else you can come every 7 days and get a small sum of money. If you actually go out and collect ore from various mines (also added into all the mines in the game) you can dump the ore into an ore cart and when you talk to the NPC it will generate profit based on A) the number of days passed since you last collected (in 7 day blocks) and B) the amount of various types of ore you've placed in the box. The script will check for quantities of the ore, remove applicable amounts, and add to the total variable for gold payout accordingly and the timer will reset.

 

Now... So far I am only concentrating on the time check variables of the script because everything else I think I can handle coding just fine, as long as the time conditional triggers are being met right. Thus far here is what I have. When you talk to the NPC, he sets CRFFFprofitcollect to 1 (also need advice on implementing a timer IF/ENDIF check for him which generates the topic response (and code) only when 7 or more days has passed since you have collected.

 

ScriptName CRFFFprofitscript

Short button
short workweek
short grandopening
short doonce

Begin GameMode

if CRFFFprofitcollect == 1 ; set to 1 when you ask Finneas about profits
if getstage CRfinneasjob == 50  				; if finneas is back to work
            id doonce== 0
	set grandopening to gamedayspassed				 ; sets the current gamedaypassed as the "zero day" for business start
	set workweek to gamedayspassed - grandopening		; sets workweek to the number of days that have passed since the store's grand opening
        set doonce to 1
        endif
endif

end

Begin GameMode

if CRFFFprofitcollect == 1 ; set to 1 when you ask Finneas about profits
if workweek >= 7 && workweek <= 13	
messagebox "It's been a slow week, but Finneas has remained productive, you've earned 250 gold after Finneas' cut." "Ok"
set button to getbuttonpressed
	if button == 0
		player.additem gold001 250
		set CRFFFprofitcollect to 0
		return
	endif
	
elseif workweek >= 14 && workweek <= 20 			;testing.... should be 14 to 20
messagebox "It's been a slow couple weeks, but Finneas has remained productive, you've earned 500 gold after Finneas' cut." "Ok"
set button to getbuttonpressed
	if button == 0
		player.additem gold001 500
		set CRFFFprofitcollect to 0
		return
	endif

elseif workweek >= 21 && workweek <= 27
messagebox "It's been a slow few weeks, but Finneas has remained productive, you've earned 750 gold after Finneas' cut." "Ok"
set button to getbuttonpressed
	if button == 0
		player.additem gold001 750
		set CRFFFprofitcollect to 0
		return
	endif

elseif workweek >= 14 && workweek <= 20
messagebox "It's been a slow month, but Finneas has remained productive, you've earned 1000 gold after Finneas' cut." "Ok"
set button to getbuttonpressed
	if button == 0
		player.additem gold001 1000
		set CRFFFprofitcollect to 0
		return
	endif
else 
Message "not enough time has passed, try back later"
set CRFFFprofitcollect to 0

endif
endif


end

 

Any help is appreciated

Link to comment
Share on other sites

  • Recently Browsing   0 members

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