Infomation for Plant growing mod v0.04:

Test Cell: Plants R Us

Global variables:  	sltw_KA_plantday
			sltw_KA_globalplantX
			sltw_KA_globalplantY
			sltw_KA_globalplantZ
			sltw_KA_plantkillswitch

Global Scripts:		sltw_KA_plantdaytracking

Items used:		
			sltw_KA_water			Alchemy
			sltw_KA_vigor_berry		Alchemy
			sltw_KA_wisdom_berry		Alchemy
			sltw_KA_tonic_berry		Alchemy
			sltw_KA_enhanced_health_p	Alchemy
			sltw_KA_enhanced_magic_p	Alchemy
			sltw_KA_plant_killing_juice	Alchemy

			sltw_KA_gold_kanet_seed		Ingredient
			sltw_KA_black_anther_seed	Ingredient
			sltw_KA_willow_seed		Ingredient
			sltw_KA_comberry_seed		Ingredient
			sltw_KA_blue_anther_seed	Ingredient
			sltw_KA_fire_anther_seed	Ingredient
			sltw_KA_coral_seed		Ingredient
			sltw_KA_heather_seed		Ingredient

			sltw_KA_plant_destroyed		Spell
			sltw_KA_plant_watered		Spell
			sltw_KA_seed_planted		Spell

    plants from game->	sltw_KA_clay_pot		Container	Script: sltw_KA_plantpot
			sltw_KA_plant_s1		Container	Script: sltw_KA_delete_extra_object
			sltw_KA_gold_kanet_s2		Container	Script: sltw_KA_delete_extra_object
			sltw_KA_gold_kanet_s3		Container	Script: sltw_KA_kill_plant
			sltw_KA_gold_kanet_s3_c		Container	Script: sltw_KA_kill_plant
			sltw_KA_heather_s1		Container	Script: sltw_KA_delete_extra_object
			sltw_KA_heather_s2 		Container	Script: sltw_KA_delete_extra_object
			sltw_KA_heather_s3		Container	Script: sltw_KA_kill_plant
			sltw_KA_willow_s2		Container	Script: sltw_KA_delete_extra_object
			sltw_KA_willow_s3		Container	Script: sltw_KA_kill_plant
			sltw_KA_black_anther_s2		Container	Script: sltw_KA_delete_extra_object
			sltw_KA_black_anther_s3		Container	Script: sltw_KA_kill_plant
			sltw_KA_comberry_s3		Container	Script: sltw_KA_kill_plant

    new plants->	sltw_KA_ruby_kanet_s2		Container	Script: sltw_KA_delete_extra_object
			sltw_KA_ruby_kanet_s3		Container	Script: sltw_KA_kill_plant
			sltw_KA_ice_kanet_s2		Container	Script: sltw_KA_delete_extra_object
			sltw_KA_ice_kanet_s3		Container	Script: sltw_KA_kill_plant			
			sltw_KA_coral_s2   		Container	Script: sltw_KA_delete_extra_object
			sltw_KA_coral_s3		Container	Script: sltw_KA_kill_plant
			sltw_KA_cotton_s2		Container	Script: sltw_KA_delete_extra_object
			sltw_KA_cotton_s3		Container	Script: sltw_KA_kill_plant
			sltw_KA_fire_anther_s2		Container	Script: sltw_KA_delete_extra_object
			sltw_KA_fire_anther_s3		Container	Script: sltw_KA_kill_plant
			sltw_KA_blue_anther_s2		Container	Script: sltw_KA_delete_extra_object
			sltw_KA_blue_anther_s3		Container	Script: sltw_KA_kill_plant
			sltw_KA_tall_heather_s2 	Container	Script: sltw_KA_delete_extra_object	
			sltw_KA_tall_heather_s3		Container	Script: sltw_KA_kill_plant
			sltw_KA_Cancer_bush_s2		Container	Script: sltw_KA_delete_extra_object
			sltw_KA_Cancer_bush_s3		Container	Script: sltw_KA_kill_plant
			- - -sltw_KA_brush_lily_s2	-->pending
			sltw_KA_brush_lily_s3		Container	Script: sltw_KA_kill_plant
			sltw_KA_Moon_heather_s2		Container	Script: sltw_KA_delete_extra_object
			sltw_KA_Moon_heather_s3		Container	Script: sltw_KA_kill_plant
			sltw_KA_joy_s2			Container	Script: sltw_KA_delete_extra_object
			sltw_KA_joy_s3			Container	Script: sltw_KA_kill_plant
			sltw_KA_jealousy_s2		Container	Script: sltw_KA_delete_extra_object
			sltw_KA_jealousy_s3		Container	Script: sltw_KA_kill_plant
			sltw_KA_sorrow_s2		Container	Script: sltw_KA_delete_extra_object
			sltw_KA_sorrow_s3		Container	Script: sltw_KA_kill_plant
			sltw_KA_fear_s2			Container	Script: sltw_KA_delete_extra_object
			sltw_KA_fear_s3			Container	Script: sltw_KA_kill_plant
			sltw_KA_love_s2			Container	Script: sltw_KA_delete_extra_object
			sltw_KA_love_s3			Container	Script: sltw_KA_kill_plant
			sltw_KA_comberry_h_s2		Container	Script: sltw_KA_delete_extra_object
			sltw_KA_comberry_m_s3		Container	Script: sltw_KA_delete_extra_object
			sltw_KA_vigor_s3		Container	Script: sltw_KA_kill_plant
			sltw_KA_wisdom_s3		Container	Script: sltw_KA_kill_plant
			sltw_KA_tonic_s3		Container	Script: sltw_KA_kill_plant


Scripts:




begin sltw_KA_plantdaytracking ;Global script for tracking how many days have passed

short KA_myday

if ( sltw_KA_plantday == 0 )
	set sltw_KA_plantday to 1
	set KA_myday to Day
endif

if ( KA_myday != Day )
	set sltw_KA_plantday to ( sltw_KA_plantday +1 )
	set KA_myday to Day
endif

end




begin sltw_KA_plantpot ;Local script for the pot, determines kind of seed, checks watering states, keeps the time passed, places the plants

short watered		;varible that tracks whether the plant has been watered
short cycle		;varible that tracks the stage of plant development
short seed		;varible that tracks the type of seed planted
short daysgoneby	;varible used to determine days passed since the begining of each plant cycle
short myday		;varible to assist in daysgoneby function, makes sure days passed away from cell are accounted for
short potX		;position of x coordinate
short potY		;position of y coordinate
short potZ		;position of z coordinate
short doOnce		;varible used for starting the global script
short resetvar     	;sets and resets x,y, and z coordinates and other variables

if ( MenuMode == 1 )
	return
endif

if ( doOnce == 0 )	;sets x,y,z and starts the global script if not already running
	if ( ScriptRunning, sltw_KA_plantdaytracking == 0 )
		StartScript, sltw_KA_plantdaytracking
	endif
	set doOnce to 1
endif 

if ( resetvar == 0 )
	set potX to GetPos, x
	set potY to GetPos, y
	set potZ to ( GetPos, z + 60 )
	set seed to 0
	set daysgoneby to 0
	set cycle to 0
	set watered to 0
	set resetvar to 1
endif

if ( cycle == 0 )	;sets up what kind of seed is planted
	if ( GetItemCount, sltw_KA_gold_kanet_seed >= 1 )
		RemoveItem, sltw_KA_gold_kanet_seed, 1
		cast, sltw_KA_seed_planted, Player
		set seed to 1
		set cycle to 1
		MessageBox "seed planted"
	elseif ( GetItemCount, sltw_KA_black_anther_seed >= 1 )
		RemoveItem, sltw_KA_black_anther_seed, 1
		cast, sltw_KA_seed_planted, Player
		set seed to 2
		set cycle to 1
		MessageBox "seed planted"
	elseif ( GetItemCount, sltw_KA_willow_seed >= 1 )
		RemoveItem, sltw_KA_willow_seed, 1
		cast, sltw_KA_seed_planted, Player
		set seed to 3
		set cycle to 1
		MessageBox "seed planted"
	endif
endif

if ( cycle > 0 )	;after a seed is planted, this determines the passing of time
	if ( daysgoneby == 0 )
		set daysgoneby to 1
		set myday to sltw_KA_plantday
	endif
	if ( myday != sltw_KA_plantday )
		set daysgoneby to ( daysgoneby + ( sltw_KA_plantday - myday ) )
		set myday to sltw_KA_plantday
	endif
	if ( GetItemCount, sltw_KA_water >= 1 )		;checks to see if plant has been watered this cycle, and how many times
		cast, sltw_KA_plant_watered, Player
		set watered to watered + 1
		RemoveItem, sltw_KA_water, 1
	endif
endif

if ( cycle == 1 )	;places the appropriate plant after a certain time, if the seed has been watered
	if ( daysgoneby > 3 )
		if ( daysgoneby < 7 )	;too much time passed since last watered, plant dies
			if ( watered >= 1 ) ;if not watered, plant dies
				if ( seed >= 1 )
					PlaceItem, sltw_KA_plant_s1, potX, potY, potZ, 0
				endif
				
					set daysgoneby to 0
					set cycle to 2
					set watered to 0
					MessageBox "your plant has grown some"
			else	
				MessageBox "your plant has died because it wasn't watered"
				set resetvar to 0
			endif
		elseif ( daysgoneby >= 7 )
			MessageBox "your plant has died because it wasn't watered"
			set resetvar to 0
		endif
	endif
elseif ( cycle == 2 )
	if ( daysgoneby > 3 )
		if ( daysgoneby < 7 )
			if ( watered >= 1 )
				if ( seed == 1 )
					PlaceItem, sltw_KA_gold_kanet_s2, potX, potY, potZ, 0
				elseif ( seed == 2 )
					PlaceItem, sltw_KA_black_anther_s2, potX, potY, potZ, 0
				elseif ( seed == 3 )
					set potY to ( potY + 20 )
					set potZ to ( potZ + 20 )
					PlaceItem, sltw_KA_willow_s2, potX, potY, potZ, 0
				endif

					set daysgoneby to 0
					set cycle to 3
					set watered to 0
					MessageBox "Your plant has grown some"
			else
				MessageBox "your plant has died due to a lack of water"
				set resetvar to 0
			endif
		else
			MessageBox "your plant has died due to a lack of water"
			set resetvar to 0
		endif	
	endif
elseif ( cycle == 3 )
	if ( daysgoneby > 3 )
		if ( daysgoneby < 7 )
			if ( watered >= 1 )
				if ( seed == 1 )
					PlaceItem, sltw_KA_gold_kanet_s3, potX, potY, potZ, 0
				elseif ( seed == 2 )
					set potY to ( potY + 10 )
					set potZ to ( potZ + 20 )
					PlaceItem, sltw_KA_black_anther_s3, potX, potY, potZ, 0
				elseif ( seed == 3 )
					PlaceItem, sltw_KA_willow_s3, potX, potY, potZ, 0
				endif

					set daysgoneby to 0
					set cycle to 4
					set watered to 0
					MessageBox "your plant has grown some"
			else
				MessageBox "your plant has died because you didn't water it"
				set resetvar to 0
			endif
		else
			MessageBox "your plant has died because you didn't water it"
			set resetvar to 0
		endif	
	endif
elseif ( cycle == 4 ) ;when in the fourth stage, the plant can be destroyed by clicking on the pot/will change to require a certain item for destruction later
	if ( GetItemCount, sltw_KA_plant_killing_juice == 1 )
		RemoveItem, sltw_KA_plant_killing_juice, 1
		cast, sltw_KA_plant_destroyed, Player
		set sltw_KA_globalplantX to potX  	;sets x, y, z coordinates of pot, to compare with coordinates of plant, so only the plant at this location is destroyed
		set sltw_KA_globalplantY to potY
		set sltw_KA_globalplantZ to potZ
		set sltw_KA_plantkillswitch to 1	;global that tells script sltw_KA_kill_plant to destroy the plant
		set resetvar to 0
	endif
endif
		
end




begin sltw_KA_delete_extra_object	;script placed on objects to delete them after a certain number of days pass. used to delete the objects associated with stages 1 and 2 of plant growth

short daystoobjectdeath
short mydeathday
short deletetime

if ( MenuMode == 1 )
	return
endif


if ( daystoobjectdeath == 0 )
	set mydeathday to sltw_KA_plantday
	set daystoobjectdeath to 1
endif

if ( daystoobjectdeath <= 3 )
	if ( mydeathday != sltw_KA_plantday )
		set daystoobjectdeath to ( daystoobjectdeath + ( sltw_KA_plantday - mydeathday ) )
		set mydeathday to sltw_KA_plantday
	endif
endif

if ( daystoobjectdeath >= 4 )
	if ( deletetime == 0 )
		Disable
	endif
	if ( deletetime < 10 )
		set deletetime to ( deletetime + 1 )
	endif
	if ( deletetime == 10 )
		set daystoobjectdeath to 0
		SetDelete, 1
	endif
endif

end




begin sltw_KA_kill_plant	;script placed on objects that are at last stage of growth, used to delete the object at the players discretion and set the pot up to plant a new seed

short deletetime
short plantkiller
short doOnce
short potX
short potY
short potZ

if ( MenuMode == 1 )
	return
endif

if ( doOnce == 0 )	;gets plant's position to compare with globals set by the pot's position
	set potX to GetPos, x
	set potY to GetPos, y
	set potZ to GetPos, z
	set doOnce to 1
endif 

if ( sltw_KA_plantkillswitch == 1 )	;checks to see if its time to kill a plant
	if ( potX == sltw_KA_globalplantX )	;checks to see if this plant (one running the script) is the right one
		if ( potY == sltw_KA_globalplantY )
			set plantkiller to 1
			set sltw_KA_plantkillswitch to 0
		endif
	endif
endif

if ( plantkiller == 1 )		;if all is well, the plant is disabled and then a short while later deleted... the delay is to keep the game from crashing
		if ( deletetime == 0 )
			Disable
		endif
		if ( deletetime < 10 )
			set deletetime to ( deletetime + 1 )
		endif
		if ( deletetime == 10 )
			SetDelete, 1
		endif
endif

end




