Jump to content

Smelting script


bencebence

Recommended Posts

Hey everyone.

Do anyone know how to do that, it needs two components, because as Skevitj pointed on it, now the two set ---bars overwrite each other.

set copperbarsmade to copperorecount/2
set copperbarsmade to coalcount
set copperremoved to copperbarsmade*2
set coalremoved to copperbarsmade

 

Thanks in advance,

 

bencebence

Edited by bencebence
Link to comment
Share on other sites

There's a missing endif after the first "Smelting Failed" message. That's probably generating both the errors.

 

EDIT: Any reason why you need to use

set apron to player.getequipped LowerShirt01      	
set gear to apron      	
if gear == 1

instead of

set gear to player.getequipped LowerShirt01      	
if gear == 1

Apron just seems redundant, as do a lot of variables in your script.

 

EDIT2: There are a lot of occasions of

set copperbarsmade to copperorecount/2
set copperbarsmade to coalcount

What's the point of the first set statement if you're just going to immediately overwrite it?

Edited by Skevitj
Link to comment
Share on other sites

Just bumping it incase you didn't see my edits... On closer look there are actually a fair few errors, not so much on the syntax side, but definitely errors in the logic.

 

EDIT: Not entirely sure, but

if player.getequipped LowerShirt01

should be sufficient, no need for either gear or apron.

Edited by Skevitj
Link to comment
Share on other sites

ScriptName RaivenSmelt

Short copperorecount
Short coalcount
Short pureironorecount
Short mithrilorecount
Short ayliiteorecount
Short dwarfiteorecount
Short tinorecount
Short ironorecount
Short silverorecount
Short goldorecount
Short daedriteore

Short armorerskill
Short chance
Short gear
Short menulevel
Short button

Short ironbarsmade
Short ironremoved
Short copperbarsmade
Short copperremoved
Short tinremoved
Short mithrilbarsmade
Short mithrilremoved
Short bronzebarsmade
Short bronzeremoved
Short steelbarsmade
Short coalremoved
Short coalremoved1
Short coalremoved2
Short coalremoved3
Short coalremoved4
Short coalremoved5
Short coalremoved6
Short dwarvenbarsmade
Short dwarvenremoved
Short silverbarsmade
Short silverremoved
Short ayliitebarsmade
Short ayliiteremoved
Short pureironremoved
Short daedricbarsmade
Short daedriteremoved

Begin OnActivate
set armorerskill to player.getactorvalue armorer
set gear to player.getequipped LowerShirt01
if gear == 1
	messagebox "What kind of bar would you like to create?", "Iron", "Copper", "Bronze", "Steel", "Ayliite", "Dwarven", "Mithril", "Daedric", "Cancel"
	set menulevel to 1
else
	Message "Not wearing suitable gear."
endif
end


Begin gamemode
set ironorecount to player.getitemcount IroneOre
set pureironorecount to player.getitemcount PureIronOre
set mithrilorecount to player.getitemcount MithrilOre
set ayliiteorecount to player.getitemcount AyliiteOre
set tinorecount to player.getitemcount TinOre
set daedriteorecount to player.getitemcount DaedriteOre
set copperorecount to player.getitemcount CopperOre
set coalcount to player.getitemcount Coal
set silverorecount to player.getitemcount gem0silvernugget
set goldorecount to player.getitemcount gem0goldnugget
set chance to 1 + 0.3*getrandompercent
set armorerskill to player.getactorvalue armorer + chance

set copperbarsmade to copperorecount/2
set copperbarsmade to coalcount
set copperremoved to copperbarsmade*2
set coalremoved to copperbarsmade

set bronzebarsmade to copperorecount/2
set bronzebarsmade to tinorecount/2
set copperremoved to copperbarsmade*2
set tinremoved to copperbarsmade

set ironbarsmade to ironorecount/2
set ironbarsmade to coalcount/2
set ironremoved to ironbarsmade*2
set coalremoved1 to ironbarsmade*2

set steelbarsmade to pureironorecount/2
set steelbarsmade to coalcount/3
set pureironremoved to steelbarsmade*2
set coalremoved2 to steelbarsmade*3

set mithrilbarsmade to mithrilorecount/2
set mithrilbarsmade to coalcount/3
set mithrilremoved to mithrilbarsmade*2
set coalremoved3 to mithrilbarsmade*3

set dwarvenbarsmade to dwarfiteorecount/2
set dwarvenbarsmade to coalcount/3
set dwarvenremoved to dwarvenbarsmade*2
set coalremoved4 to dwarvenbarsmade*3

set ayliitebarsmade to ayliiteorecount*2
set ayliitebarsmade to coalcount*3
set ayliiteremoved to ayliitebarsmade*2
set coalremoved5 to ayliitebarsmade*3

set daedricbarsmade to daedriteorecount/3
set daedricbarsmade to coalcount/5
set daedriteremoved to daedricbarsmade*3
set coalremoved6 to daedricbarsmade*5
	

if (menulevel == 1)
	set button to getbuttonpressed
		if (button > -1)
			if (button == 0 && ironbarsmade > 0)
				if (armorerskill > 10)
					player.removeitem IroneOre ironremoved
					player.removeitem Coal coalremoved1
					playsound splfireballfail
					player.additem IronBar ironbarsmade
				else
					player.removeitem IroneOre ironremoved
					player.removeitem Coal coalremoved1
					playsound splpoisonhit
					message "Smelting failed."
			elseif (button == 1 && copperbarsmade > 0)
				if (armorerskill > 1)
					player.removeitem CopperOre copperremoved
					player.removeitem Coal coalremoved
					playsound splfireballfail
					player.additem CopperBar copperbarsmade
				else
					player.removeitem CopperOre copperremoved
					player.removeitem Coal coalremoved
					playsound splpoisonhit
					message "Smelting failed."
				endif
			elseif (button == 2 && bronzebarsmade > 0)
				if (armorerskill > 5)
					player.removeitem CopperOre copperremoved
					player.removeitem TinOre tinremoved
					playsound splfireballfail
					player.additem BronzeBar bronzebarsmade
				else
					player.removeitem CopperOre copperremoved
					player.removeitem TinOre tinremoved
					playsound splpoisonhit
					message "Smelting failed."
				endif
			elseif (button == 3 && steelbarsmade > 0)
				if (armorerskill > 15)
					player.removeitem PureIronOre pureironremoved
					player.removeitem Coal coalremoved2
					playsound splfireballfail
					player.additem SteelBar steelbarsmade
				else
					player.removeitem PureIronOre pureironremoved
					player.removeitem Coal coalremoved2
					playsound splpoisonhit
					message "Smelting failed."
				endif
			elseif (button == 4 && ayliitebarsmade > 0)
				if (armorerskill > 25)
					player.removeitem AyliiteOre ayliiteremoved
					player.removeitem Coal coalremoved5
					playsound splfireballfail
					player.additem AyliiteBar ayliitebarsmade
				else
					player.removeitem AyliiteOre ayliiteremoved
					player.removeitem Coal coalremoved5
					playsound splpoisonhit
					message "Smelting failed."
				endif
			elseif (button == 5 && dwarvenbarsmade > 0)
				if (armorerskill > 30)
					player.removeitem DwarfiteOre dwarvenremoved
					player.removeitem Coal coalremoved4
					playsound splfireballfail
					player.additem DwarvenBar dwarvenbarsmade
				else
					player.removeitem DwarfiteOre dwarvenremoved
					player.removeitem Coal coalremoved4
					playsound splpoisonhit
					message "Smelting failed."
				endif
			elseif (button == 6 && mithrilbarsmade > 0)
				if (armorerskill > 30)
					player.removeitem MithrilOre mithrilremoved
					player.removeitem Coal coalremoved3
					playsound splfireballfail
					player.additem MithrilBar mithrilbarsmade
				else
					player.removeitem MithrilOre mithrilremoved
					player.removeitem Coal coalremoved3
					playsound splpoisonhit
					message "Smelting failed."
				endif
			elseif (button == 7 && daedricbarsmade > 0)
				if (armorerskill > 55)
					player.removeitem DaedriteOre daedriteremoved
					player.removeitem Coal coalremoved6
					playsound splfireballfail
					player.additem DaedricBar daedricbarsmade
				else
					player.removeitem DaedriteOre daedriteremoved
					player.removeitem Coal coalremoved6
					playsound splpoisonhit
					message "Smelting failed."
				endif
			elseif (button == 8)
				message "Smelting cancelled."
			else
				message "Smelting failed.  Not enough raw materials."
			endif
		endif
	endif
endif
end

I want that X coals and Y Ores make a bar. But Skevitj told me that it isn't good that I've done.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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