Jump to content

Mining -again


bencebence

Recommended Posts

Hey everyone!

I'm having problem with the mining script (again. :wallbash: The funny thing is that the smelting (ore ->bar) was a script I could make so fast, but the mining always has problems)

So, I made the script, and now in testing, I found two things:

- I don't know why but I only get !rare! gems, which have really small chance. :facepalm:

- I can only mine at one specific rock, the others does not work. It seems they doesn't use the script, which would be strange, because all of them are same activator objects, and the object has the scripted applied on it.

Here is the script, I hope someone can find a solution:

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

 

Thanks in advance,

 

bencebence

Link to comment
Share on other sites

Hey man, posting in here to keep updated. I take it you're gonna replace the glass/ebony chances with our own things once we've got everything set up?
Link to comment
Share on other sites

GetRandomChance generates a number within 0 - 99. If you multiply it by two for iron, you have a 1/2 chance of getting unreachable blunt levels. The others are even harder.

If you test with a level 1 character or someone with low blunt, you can get a lot more gems than anything else. Try modifying your Blunt to 100 and test then.

It only working on one rock is strange though. Try it on one rock, reload and try it on another without getting your crosshair over the first. If it works then, the GetCrossHairRef will probably be the fault.

 

Also, please tell us what should happen in steps, so we can see what is wrong. Right now, we could be assuming that it's a gem-mine and normal ore is quite rare (of course we won't, but ... ;) )

Link to comment
Share on other sites

This script 'should' make me if I have a pick equiped, then I can mine at veins. Also it should mine ores mostly. Like there should be a 20% chance for iron, 10% chance for silver, 10% chance for glass, 8% chance for gold and about 4% chance for ebony, and 46% chance for nothing, 2% chance for all gems.

Also with higher blunt skill, the chances would grow.

Edited by bencebence
Link to comment
Share on other sites

Modified some blocks, now I think it should have higher chance for ores.

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 10
               set chanceSilver to 8
               set chanceGold to 5
               set chanceGlass to 3
               set chanceEbony to 2 
               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 < 20)
                       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

Also the strange thing with the rock, that there are a lot of rocks in the mine, I tried all of them, and only one at the deepest part works. None of them, only that.

Edited by bencebence
Link to comment
Share on other sites

I'm so happy about the progress this has made. I would never in a million years have thought the scripting would progress this fast. Bence - I salute you.
Link to comment
Share on other sites

Okay, what are the problems in-game now? I can't see anything wrong with the script.

Although I'd suggest the following:

Short Vein
Begin GameMode
Set Vein to GetSelf
       if (Player.GetCrossHairRef == Vein) && (OnControlDown 4)
               if (Player.GetEquipped MiningPick)
               set ready to 1
               else
               Message "You must equip a Mining Pick to mine the rock."
               endif
       endif

Maybe that will fix the only-one-rock problem.

 

I did notice this:

                       elseif (chance <= 10)
                               message "You found nothing."
                               set playhitsound to 1
                       endif

Shouldn't that be just else? What if you have Blunt 5 and the chance generated 11 you would get nothing and no message would show up.

Also, perhaps you should change your ore generating a bit. Now, if you have a bluntskill of 50 you will get all ores. I could be wrong, but that shouldn't be so:

                       if (bluntskill > chance/chanceEbony)
                               player.additem EbonOre 1
                               Return
                       elseif (bluntskill > chance/chanceGlass)
                               player.additem glassore 1
                               Return
                       elseif (bluntskill > chance/chanceGold)
                               player.additem Gem0GoldNugget 1
                               Return
                       elseif (bluntskill > chance/chanceSilver)
                               player.additem Gem0SilverNugget 1
                               Return
                       elseif (bluntskill > chance/chanceIron)
                               player.additem IroneOre 1
                               Return
                       else
                               message "You found nothing."
                               set playhitsound to 1
                       endif

I placed the "higher class" ores above, so if you succeed in mining, you will get the best ore. The Return makes the script stop there, so if you mine now you will get the best ore your blunt and chance can provide and only that ore.

You can always delete them, so you will get everything, and you can play with the chances as much as you want.

 

;)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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