bencebence Posted July 6, 2011 Author Share Posted July 6, 2011 Scriptname RaivenMineScript short bluntskill short chance short chanceIron short chanceSilver short chanceGold short chanceGlass short chanceEbony Begin OnActivate set bluntskill to player.getactorvalue blunt set chance to getrandompercent set chanceIron to 2 set chanceSilver to 3 set chanceGold to 4 set chanceGlass to 5 set chanceEbony to 6 if player.getequipped MiningPick == 1 if IsKeyPressed 44 == 1 ;Z key player.playgroup AttackPower 1 if (bluntskill > chance*chanceIron) playsound wpnblockblunt player.additem IroneOre 1 elseif (bluntskill > chance*chanceSilver) playsound wpnblockblunt player.additem Gem0SilverNugget 1 elseif (bluntskill > chance*chanceGold) playsound wpnblockblunt player.additem Gem0GoldNugget 1 elseif (bluntskill > chance*chanceGlass) playsound wpnblockblunt player.additem glassore 1 elseif (bluntskill > chance*chanceEbony) playsound wpnblockblunt player.additem EbonOre 1 else playsound wpnhitblunt message "You found nothing." endif endif if (chance == 10) playsound wpnblockblunt player.additem Coal 1 message "You found some coal." elseif (chance == 84) playsound wpnblockblunt player.additem gem2topazflawed 1 message "You found a flawed topaz." elseif (chance == 85) playsound wpnblockblunt player.additem gem2topaz 1 message "You found a topaz." elseif (chance == 86) playsound wpnblockblunt player.additem gem2topazflawless 1 message "You found a flawless topaz." elseif (chance == 87) playsound wpnblockblunt player.additem gem3rubyflawed 1 message "You found a flawed ruby." elseif (chance == 88) playsound wpnblockblunt player.additem gem3ruby 1 message "You found a ruby." elseif (chance == 89) playsound wpnblockblunt player.additem gem3rubyflawless 1 message "You found a flawless ruby." elseif (chance == 90) playsound wpnblockblunt player.additem gem4sapphireflawed 1 message "You found a flawed sapphire." elseif (chance == 91) playsound wpnblockblunt player.additem gem4sapphire 1 message "You found a sapphire." elseif (chance == 92) playsound wpnblockblunt player.additem gem4sapphireflawless 1 message "You found a flawless sapphire." elseif (chance == 93) playsound wpnblockblunt player.additem gem5emeraldflawed 1 message "You found a flawed emerald." elseif (chance == 94) playsound wpnblockblunt player.additem gem5emerald 1 message "You found am emerald." elseif (chance == 95) playsound wpnblockblunt player.additem gem5emeraldflawless 1 message "You found a flawless emerald." elseif (chance == 96) playsound wpnblockblunt player.additem gem6diamondflawed 1 message "You found a flawed diamond." elseif (chance == 97) playsound wpnblockblunt player.additem gem6diamond 1 message "You found a diamond." elseif (chance == 98) playsound wpnblockblunt player.additem gem6diamondflawless 1 message "You found a flawless diamond." endif else player.playgroup Idle 1 message "You must equip a Mining Pick to mine the rock." endif endNow the code seems to be working, I could save it. Link to comment Share on other sites More sharing options...
fg109 Posted July 6, 2011 Share Posted July 6, 2011 (edited) Then try this: scn example short ready Begin GameMode if (GetCrossHairRef == GetSelf) && (OnControlDown 4) if (Player.GetEquipped MiningPick) set ready to 1 else Message "You must equip a Mining Pick to mine the rock." endif endif if (ready) set ready to 0 .... endif End You can put in all your if conditions where the "..." is. Edited July 6, 2011 by fg109 Link to comment Share on other sites More sharing options...
MarkInMKUK Posted July 6, 2011 Share Posted July 6, 2011 OK, having had another look - you'll get the ore items with the probabilities I gave earlier, plus a 1% chance of each of the items in the second list, tied to specific percentages. So you could still end up with Ebony ore + a gemstone, but coal you can only get on its own as you have to hit at least 50% to get iron ore. If you want to get gemstones OR metal ores, they need to be set up as one long set of if statements with the gems and coal first, then the rest as "if I didn't get a gem" Link to comment Share on other sites More sharing options...
bencebence Posted July 6, 2011 Author Share Posted July 6, 2011 Scriptname RaivenMineScript short bluntskill short ready short chance short chanceIron short chanceSilver short chanceGold short chanceGlass short chanceEbony Begin GameMode if (GetCrossHairRef == GetSelf) && (OnControlDown 4) if (Player.GetEquipped MiningPick) set ready to 1 else Message "You must equip a Mining Pick to mine the rock." endif endif if (ready) set ready to 0 set bluntskill to player.getactorvalue blunt set chance to getrandompercent set chanceIron to 2 set chanceSilver to 3 set chanceGold to 4 set chanceGlass to 5 set chanceEbony to 6 if player.getequipped MiningPick == 1 if IsKeyPressed 44 == 1 ;Z key player.playgroup AttackPower 1 if (bluntskill > chance*chanceIron) playsound wpnblockblunt player.additem IroneOre 1 elseif (bluntskill > chance*chanceSilver) playsound wpnblockblunt player.additem Gem0SilverNugget 1 elseif (bluntskill > chance*chanceGold) playsound wpnblockblunt player.additem Gem0GoldNugget 1 elseif (bluntskill > chance*chanceGlass) playsound wpnblockblunt player.additem glassore 1 elseif (bluntskill > chance*chanceEbony) playsound wpnblockblunt player.additem EbonOre 1 else playsound wpnhitblunt message "You found nothing." endif endif if (chance == 10) playsound wpnblockblunt player.additem Coal 1 message "You found some coal." elseif (chance == 84) playsound wpnblockblunt player.additem gem2topazflawed 1 message "You found a flawed topaz." elseif (chance == 85) playsound wpnblockblunt player.additem gem2topaz 1 message "You found a topaz." elseif (chance == 86) playsound wpnblockblunt player.additem gem2topazflawless 1 message "You found a flawless topaz." elseif (chance == 87) playsound wpnblockblunt player.additem gem3rubyflawed 1 message "You found a flawed ruby." elseif (chance == 88) playsound wpnblockblunt player.additem gem3ruby 1 message "You found a ruby." elseif (chance == 89) playsound wpnblockblunt player.additem gem3rubyflawless 1 message "You found a flawless ruby." elseif (chance == 90) playsound wpnblockblunt player.additem gem4sapphireflawed 1 message "You found a flawed sapphire." elseif (chance == 91) playsound wpnblockblunt player.additem gem4sapphire 1 message "You found a sapphire." elseif (chance == 92) playsound wpnblockblunt player.additem gem4sapphireflawless 1 message "You found a flawless sapphire." elseif (chance == 93) playsound wpnblockblunt player.additem gem5emeraldflawed 1 message "You found a flawed emerald." elseif (chance == 94) playsound wpnblockblunt player.additem gem5emerald 1 message "You found am emerald." elseif (chance == 95) playsound wpnblockblunt player.additem gem5emeraldflawless 1 message "You found a flawless emerald." elseif (chance == 96) playsound wpnblockblunt player.additem gem6diamondflawed 1 message "You found a flawed diamond." elseif (chance == 97) playsound wpnblockblunt player.additem gem6diamond 1 message "You found a diamond." elseif (chance == 98) playsound wpnblockblunt player.additem gem6diamondflawless 1 message "You found a flawless diamond." endif else player.playgroup Idle 1 message "You must equip a Mining Pick to mine the rock." endif endif endNow it looks like this.@MarkInMKUKI can't really understand what do you mean (Sorry not native English speaker). Do you mean that I have to set if-s without finding gem? Can you show an example of what do you mean? Link to comment Share on other sites More sharing options...
MarkInMKUK Posted July 6, 2011 Share Posted July 6, 2011 Bencebence - can it wait a few hours - about 9 or so? - I'm at work, and I really shouldn't be trying to sort stuff out until I'm at home this evening. Link to comment Share on other sites More sharing options...
bencebence Posted July 6, 2011 Author Share Posted July 6, 2011 Alright. It can wait. Till that I will work on the smithing scripts. Anyways thanks both of you! You helped me a lot. I'd give kudos for boh of you, I didn't do it before. Feel like I've given a second kudos :P Link to comment Share on other sites More sharing options...
fg109 Posted July 6, 2011 Share Posted July 6, 2011 I'm going to bed now. This is what Mark wanted: Scriptname RaivenMineScript short bluntskill short ready short chance short chanceIron short chanceSilver short chanceGold short chanceGlass short chanceEbony short playhitsound Begin GameMode if (GetCrossHairRef == GetSelf) && (OnControlDown 4) if (Player.GetEquipped MiningPick) set ready to 1 else Message "You must equip a Mining Pick to mine the rock." endif endif if (ready) set ready to 0 set bluntskill to player.getactorvalue blunt set chance to getrandompercent set chanceIron to 2 set chanceSilver to 3 set chanceGold to 4 set chanceGlass to 5 set chanceEbony to 6 if (chance == 98) player.additem gem6diamondflawless 1 message "You found a flawless diamond." elseif (chance == 97) player.additem gem6diamond 1 message "You found a diamond." elseif (chance == 96) player.additem gem6diamondflawed 1 message "You found a flawed diamond." elseif (chance == 95) player.additem gem5emeraldflawless 1 message "You found a flawless emerald." elseif (chance == 94) player.additem gem5emerald 1 message "You found am emerald." elseif (chance == 93) player.additem gem5emeraldflawed 1 message "You found a flawed emerald." elseif (chance == 92) player.additem gem4sapphireflawless 1 message "You found a flawless sapphire." elseif (chance == 91) player.additem gem4sapphire 1 message "You found a sapphire." elseif (chance == 90) player.additem gem4sapphireflawed 1 message "You found a flawed sapphire." elseif (chance == 89) player.additem gem3rubyflawless 1 message "You found a flawless ruby." elseif (chance == 88) player.additem gem3ruby 1 message "You found a ruby." elseif (chance == 87) player.additem gem3rubyflawed 1 message "You found a flawed ruby." elseif (chance == 86) player.additem gem2topazflawless 1 message "You found a flawless topaz." elseif (chance == 85) player.additem gem2topaz 1 message "You found a topaz." elseif (chance == 84) player.additem gem2topazflawed 1 message "You found a flawed topaz." elseif (chance > 10) player.additem Coal 1 message "You found some coal." else ;or it could be an endif if (bluntskill > chance*chanceIron) player.additem IroneOre 1 elseif (bluntskill > chance*chanceSilver) player.additem Gem0SilverNugget 1 elseif (bluntskill > chance*chanceGold) player.additem Gem0GoldNugget 1 elseif (bluntskill > chance*chanceGlass) player.additem glassore 1 elseif (bluntskill > chance*chanceEbony) player.additem EbonOre 1 elseif (chance <= 10) message "You found nothing." set playhitsound to 1 endif endif ;if you chose endif, then delete this line if (playhitsound == 1) playsound wpnhitblunt set playhitsound to 0 else playsound wpnblockblunt endif endif End Link to comment Share on other sites More sharing options...
MarkInMKUK Posted July 6, 2011 Share Posted July 6, 2011 (edited) Thanks fg109 - saved me the effort of typoing it :) One general comment - always add plenty of comments to the code. That way if you need to look at it in six months time, you'll find it easier to remember what you were doing and why. I sometimes write code by writing the comments first, then fill in the code to match. If the comments don't tell you how the code is going to work, then the chances are the code won't work properly either. Edited July 6, 2011 by MarkInMKUK Link to comment Share on other sites More sharing options...
bencebence Posted July 6, 2011 Author Share Posted July 6, 2011 Thank you very much again. I love you two :P :biggrin: Link to comment Share on other sites More sharing options...
MarkInMKUK Posted July 6, 2011 Share Posted July 6, 2011 (edited) With the modification as fg109 has done it, the probabilities are now 2% chance of EbonOre (100% or 99%)15% Gemstone of some kind (98% to 84%)4% chance of GlassOre (80% to 83%) 5% chance of Gold (76% to 80%)8% chance of Silver (67 to 75%)16% chance of Iron (51% to 66%)49% chance of nothing (1-9%, 11-49%)1% of coal (10%) And the ore selection section is upside down again - you need to use the one with ebon ore at the top not iron ore Edited July 6, 2011 by MarkInMKUK Link to comment Share on other sites More sharing options...
Recommended Posts