Jump to content

Refill Script


hunter5637

Recommended Posts

Ok, I created a script that, when the player activates the urn, if they have at least one of the nine bottles with corks, they can fill it up with water.

 

It should add a bottle of water to the player's inventory and remove one of the bottles. If the bottle being used is one of the three jugs, it should add two of the correspoding smaller bottles. Then after fifty uses of this urn, there shouldn't be anymore water to use. Then I've given the urn a day to refill.

 

The message box doesn't even come up. In fact, nothing happens at all. For the life of me, I don't know what I'm missing in this script...please help me...

 

begin 00_urn_water

short bottle
short button
short type1
short type2
short type3
short type4
short type5
short type6
short type7
short type8
short type9
short use
short hour
short refill

set type1 to player->getitemcount "misc_com_bottle_03"
set type2 to player->getitemcount "misc_com_bottle_04"
set type3 to player->getitemcount "misc_com_bottle_05"
set type4 to player->getitemcount "misc_com_bottle_07"
set type5 to player->getitemcount "misc_com_bottle_08"
set type6 to player->getitemcount "misc_com_bottle_10"
set type7 to player->getitemcount "misc_com_bottle_12"
set type8 to player->getitemcount "misc_com_bottle_14"
set type9 to player->getitemcount "misc_com_bottle_15"

if ( onactivate == 1 )
if ( use < 49 )
	messagebox "Would you like to fill up a bottle with water?", "Yes", "No"
elseif ( use >= 50 )
	messagebox "There is no more water left in this urn. Check back later."
endif

set button to getbuttonpressed
if ( button == 0 )
if ( type1 > 0 )
	player->additem "00_water_normal_05"  2
	player->removeitem "misc_com_bottle_03" 1
	set bottle to 0
	set use to use + 2
elseif ( type1 == 0 )
	set bottle to 1
endif

if ( bottle == 1 )
	if ( type2 > 0 )
		player->additem "00_water_normal_02" 1
		player->removeitem "misc_com_bottle_04" 1
		set bottle to 0
		set use to use + 1
	elseif ( type2 == 0 )
		set bottle to 2
	endif
endif

if ( bottle == 2 )
	if ( type3 > 0 )
		player->additem "00_water_normal_03" 1
		player->removeitem "misc_com_bottle_05" 1
		set bottle to 0
		set use to use + 1
	elseif ( type3 == 0 )
		set bottle to 3
	endif
endif

if ( bottle == 3 )
	if ( type4 > 0 )
		player->additem "00_water_normal_03" 2
		player->removeitem "misc_com_bottle_07" 1
		set bottle to 0
		set use to use + 2
	elseif ( type4 == 0 )
		set bottle to 4
	endif
endif

if ( bottle == 4 )
	if ( type5 > 0 )
		player->additem "00_water_normal_05" 1
		player->removeitem "misc_com_bottle_08" 1
		set bottle to 0
		set use to use + 1
	elseif ( type5 == 0 )
		set bottle to 5
	endif
endif

if ( bottle == 5 )
	if ( type6 > 0 )
		player->additem "00_water_normal_06" 1
		player->removeitem "misc_com_bottle_10" 1
		set bottle to 0
		set use to use + 1
	elseif ( type6 == 0 )
		set bottle to 6
	endif
endif

if ( bottle == 6 )
	if ( type7 > 0 )
		player->additem "00_water_normal_08" 2
		player->removeitem "misc_com_bottle_12" 1
		set bottle to 0
		set use to use + 2
	elseif ( type7 == 0 )
		set bottle to 7
	endif
endif

if ( bottle == 7 )
	if ( type8 > 0 )
		player->additem "00_water_normal_08" 1
		player->removeitem "misc_com_bottle_14" 1
		set bottle to 0
		set use to use + 1
	elseif ( type8 == 0 )
		set bottle to 8
	endif
endif

if ( bottle == 8 )
	if ( type9 > 0 )
		player->additem "00_water_normal_09" 1
		player->removeitem "misc_com_bottle_15" 1
		set bottle to 0
		set use to use + 1
	elseif ( type9 == 0 )
		set bottle to 9
	endif
endif
			
if ( bottle == 9 )
	Messagebox "You have no bottles to fill."
	set bottle to 0
endif
endif
endif

if ( use == 50 )
set hour to hour + gamehour
if ( hour != gamehour )
	set hour to hour + gamehour
	set refill to refill +1
endif

if ( refill > 24 )
	set use to 0
	set refill to 0
endif
endif



end

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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