DemonicHowler Posted May 5, 2013 Share Posted May 5, 2013 Okay, so. Edited the mining script so that it is infinite and I get 3 ore at a time. I've noticed other mods out there that change the amount of ore per smithing level and add smithing exp when mining, but they don't come with the source files to study. I'm wanting to add these functions to my own script though, and I'm not sure how. I'm guessing it has something to do with the 'auto' function at the end of each function, but I don't want to mess with these until I know for sure.Any feed back and clarification on this would be appreciated! ^-^''PS: Also wanting to edit the amount of gems per vein, it seems a bit much. The vanilla, I mean. The gems are too common. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted May 5, 2013 Share Posted May 5, 2013 (edited) Random Mining I've got a version in that mod which adds a small amount of smithing exp with each ore gain. The source file is included. I've setup my own personal subdirectory to house my mod source files instead of them overwriting the originals (much like the DLCs do). As far as editing the amount of gems, I'd have to take a look at the script again to see what is going on and what would be possible. ***************Ok so the gems are given based on a leveled list. Therefore the player needs to be certain levels before obtaining certain gems. If the ore vein has that property filled then the player will get a certain gem based on their level. The easiest method to change from getting one at every valid moment to getting them on a less likely basis is to add in a random number check. Try something like the following... Original segementfunction giveOre() if ResourceCountCurrent == -1 ResourceCountCurrent = ResourceCountTotal EndIf if ResourceCountCurrent > 0 ResourceCountCurrent -= 1 ; debug.Trace(self + ": ResourceCountCurrent = " + ResourceCountCurrent) if ResourceCountCurrent == 0 ; debug.Trace(self + ": ResourceCountCurrent == 0 - depleted" ) self.damageObject(50) getLinkedRef().activate(objSelf) DrScOreOpen.play(self) self.setDestroyed(true) ; if this vein has ore and/or gems defined, give them. if ore (game.getPlayer()).addItem(Ore, ResourceCount) endif if lItemGems10 (game.getPlayer()).addItem(lItemGems10) endif DepletedMessage.Show() else DrScOreOpen.play(self) ; if this vein has ore and/or gems defined, give them. if ore (game.getPlayer()).addItem(Ore, ResourceCount) endif if lItemGems10 (game.getPlayer()).addItem(lItemGems10) endif endif elseif ResourceCountCurrent == 0 getLinkedRef().activate(objSelf) (getLinkedRef() as MineOreFurnitureScript).goToDepletedState() DepletedMessage.Show() endif EndFunction Modified segementfunction giveOre() Int Random ;define the variable as an integer -- Ishara if ResourceCountCurrent == -1 ResourceCountCurrent = ResourceCountTotal EndIf if ResourceCountCurrent > 0 ResourceCountCurrent -= 1 ; debug.Trace(self + ": ResourceCountCurrent = " + ResourceCountCurrent) if ResourceCountCurrent == 0 ; debug.Trace(self + ": ResourceCountCurrent == 0 - depleted" ) self.damageObject(50) getLinkedRef().activate(objSelf) DrScOreOpen.play(self) self.setDestroyed(true) ; if this vein has ore and/or gems defined, give them. if ore (game.getPlayer()).addItem(Ore, ResourceCount) game.advanceskill("smithing", 1) Debug.TraceUser("RandomMining", self + ": Smithing skill given 1 point on last ore gain") endif Random = Utility.RandomInt(1,10) ;give a random number between 1 and 10 to the variable -- Ishara if lItemGems10 && Random == 5 ;Only give the gem if the player meets leveled list requirements and the variable is equal to 5. a 1/10th chance -- Ishara (game.getPlayer()).addItem(lItemGems10) endif DepletedMessage.Show() else DrScOreOpen.play(self) ; if this vein has ore and/or gems defined, give them. if ore (game.getPlayer()).addItem(Ore, ResourceCount) game.advanceskill("smithing", 1) Debug.TraceUser("RandomMining", self + ": Smithing skill given 1 point on non-last ore gain") endif Random = Utility.RandomInt(1,10) ;give a random number between 1 and 10 to the variable -- Ishara if lItemGems10 && Random == 5 ;Only give the gem if the player meets leveled list requirements and the variable is equal to 5. a 1/10th chance -- Ishara (game.getPlayer()).addItem(lItemGems10) endif endif elseif ResourceCountCurrent == 0 getLinkedRef().activate(objSelf) (getLinkedRef() as MineOreFurnitureScript).goToDepletedState() DepletedMessage.Show() endif EndFunction In fact that is the same function where you apply the simithing exp gain. Just slip the command in with the command where the ore is given. Edited May 5, 2013 by IsharaMeradin Link to comment Share on other sites More sharing options...
DemonicHowler Posted May 5, 2013 Author Share Posted May 5, 2013 Random Mining I've got a version in that mod which adds a small amount of smithing exp with each ore gain. The source file is included. I've setup my own personal subdirectory to house my mod source files instead of them overwriting the originals (much like the DLCs do). As far as editing the amount of gems, I'd have to take a look at the script again to see what is going on and what would be possible. ***************Ok so the gems are given based on a leveled list. Therefore the player needs to be certain levels before obtaining certain gems. If the ore vein has that property filled then the player will get a certain gem based on their level. The easiest method to change from getting one at every valid moment to getting them on a less likely basis is to add in a random number check. Try something like the following... Original segement function giveOre() if ResourceCountCurrent == -1 ResourceCountCurrent = ResourceCountTotal EndIf if ResourceCountCurrent > 0 ResourceCountCurrent -= 1 ; debug.Trace(self + ": ResourceCountCurrent = " + ResourceCountCurrent) if ResourceCountCurrent == 0 ; debug.Trace(self + ": ResourceCountCurrent == 0 - depleted" ) self.damageObject(50) getLinkedRef().activate(objSelf) DrScOreOpen.play(self) self.setDestroyed(true) ; if this vein has ore and/or gems defined, give them. if ore (game.getPlayer()).addItem(Ore, ResourceCount) endif if lItemGems10 (game.getPlayer()).addItem(lItemGems10) endif DepletedMessage.Show() else DrScOreOpen.play(self) ; if this vein has ore and/or gems defined, give them. if ore (game.getPlayer()).addItem(Ore, ResourceCount) endif if lItemGems10 (game.getPlayer()).addItem(lItemGems10) endif endif elseif ResourceCountCurrent == 0 getLinkedRef().activate(objSelf) (getLinkedRef() as MineOreFurnitureScript).goToDepletedState() DepletedMessage.Show() endif EndFunction Modified segement function giveOre() Int Random ;define the variable as an integer -- Ishara if ResourceCountCurrent == -1 ResourceCountCurrent = ResourceCountTotal EndIf if ResourceCountCurrent > 0 ResourceCountCurrent -= 1 ; debug.Trace(self + ": ResourceCountCurrent = " + ResourceCountCurrent) if ResourceCountCurrent == 0 ; debug.Trace(self + ": ResourceCountCurrent == 0 - depleted" ) self.damageObject(50) getLinkedRef().activate(objSelf) DrScOreOpen.play(self) self.setDestroyed(true) ; if this vein has ore and/or gems defined, give them. if ore (game.getPlayer()).addItem(Ore, ResourceCount) game.advanceskill("smithing", 1) Debug.TraceUser("RandomMining", self + ": Smithing skill given 1 point on last ore gain") endif Random = Utility.RandomInt(1,10) ;give a random number between 1 and 10 to the variable -- Ishara if lItemGems10 && Random == 5 ;Only give the gem if the player meets leveled list requirements and the variable is equal to 5. a 1/10th chance -- Ishara (game.getPlayer()).addItem(lItemGems10) endif DepletedMessage.Show() else DrScOreOpen.play(self) ; if this vein has ore and/or gems defined, give them. if ore (game.getPlayer()).addItem(Ore, ResourceCount) game.advanceskill("smithing", 1) Debug.TraceUser("RandomMining", self + ": Smithing skill given 1 point on non-last ore gain") endif Random = Utility.RandomInt(1,10) ;give a random number between 1 and 10 to the variable -- Ishara if lItemGems10 && Random == 5 ;Only give the gem if the player meets leveled list requirements and the variable is equal to 5. a 1/10th chance -- Ishara (game.getPlayer()).addItem(lItemGems10) endif endif elseif ResourceCountCurrent == 0 getLinkedRef().activate(objSelf) (getLinkedRef() as MineOreFurnitureScript).goToDepletedState() DepletedMessage.Show() endif EndFunction In fact that is the same function where you apply the simithing exp gain. Just slip the command in with the command where the ore is given.Thankyou, I'll test this out! ^-^ Link to comment Share on other sites More sharing options...
DemonicHowler Posted May 5, 2013 Author Share Posted May 5, 2013 Random Mining I've got a version in that mod which adds a small amount of smithing exp with each ore gain. The source file is included. I've setup my own personal subdirectory to house my mod source files instead of them overwriting the originals (much like the DLCs do). As far as editing the amount of gems, I'd have to take a look at the script again to see what is going on and what would be possible. ***************Ok so the gems are given based on a leveled list. Therefore the player needs to be certain levels before obtaining certain gems. If the ore vein has that property filled then the player will get a certain gem based on their level. The easiest method to change from getting one at every valid moment to getting them on a less likely basis is to add in a random number check. Try something like the following... Original segement function giveOre() if ResourceCountCurrent == -1 ResourceCountCurrent = ResourceCountTotal EndIf if ResourceCountCurrent > 0 ResourceCountCurrent -= 1 ; debug.Trace(self + ": ResourceCountCurrent = " + ResourceCountCurrent) if ResourceCountCurrent == 0 ; debug.Trace(self + ": ResourceCountCurrent == 0 - depleted" ) self.damageObject(50) getLinkedRef().activate(objSelf) DrScOreOpen.play(self) self.setDestroyed(true) ; if this vein has ore and/or gems defined, give them. if ore (game.getPlayer()).addItem(Ore, ResourceCount) endif if lItemGems10 (game.getPlayer()).addItem(lItemGems10) endif DepletedMessage.Show() else DrScOreOpen.play(self) ; if this vein has ore and/or gems defined, give them. if ore (game.getPlayer()).addItem(Ore, ResourceCount) endif if lItemGems10 (game.getPlayer()).addItem(lItemGems10) endif endif elseif ResourceCountCurrent == 0 getLinkedRef().activate(objSelf) (getLinkedRef() as MineOreFurnitureScript).goToDepletedState() DepletedMessage.Show() endif EndFunction Modified segement function giveOre() Int Random ;define the variable as an integer -- Ishara if ResourceCountCurrent == -1 ResourceCountCurrent = ResourceCountTotal EndIf if ResourceCountCurrent > 0 ResourceCountCurrent -= 1 ; debug.Trace(self + ": ResourceCountCurrent = " + ResourceCountCurrent) if ResourceCountCurrent == 0 ; debug.Trace(self + ": ResourceCountCurrent == 0 - depleted" ) self.damageObject(50) getLinkedRef().activate(objSelf) DrScOreOpen.play(self) self.setDestroyed(true) ; if this vein has ore and/or gems defined, give them. if ore (game.getPlayer()).addItem(Ore, ResourceCount) game.advanceskill("smithing", 1) Debug.TraceUser("RandomMining", self + ": Smithing skill given 1 point on last ore gain") endif Random = Utility.RandomInt(1,10) ;give a random number between 1 and 10 to the variable -- Ishara if lItemGems10 && Random == 5 ;Only give the gem if the player meets leveled list requirements and the variable is equal to 5. a 1/10th chance -- Ishara (game.getPlayer()).addItem(lItemGems10) endif DepletedMessage.Show() else DrScOreOpen.play(self) ; if this vein has ore and/or gems defined, give them. if ore (game.getPlayer()).addItem(Ore, ResourceCount) game.advanceskill("smithing", 1) Debug.TraceUser("RandomMining", self + ": Smithing skill given 1 point on non-last ore gain") endif Random = Utility.RandomInt(1,10) ;give a random number between 1 and 10 to the variable -- Ishara if lItemGems10 && Random == 5 ;Only give the gem if the player meets leveled list requirements and the variable is equal to 5. a 1/10th chance -- Ishara (game.getPlayer()).addItem(lItemGems10) endif endif elseif ResourceCountCurrent == 0 getLinkedRef().activate(objSelf) (getLinkedRef() as MineOreFurnitureScript).goToDepletedState() DepletedMessage.Show() endif EndFunction In fact that is the same function where you apply the simithing exp gain. Just slip the command in with the command where the ore is given.Out of sheer laziness I did copy+paste that in and then edit it a bit, but now I can't compile the script. I try to compile it and the CK throws this error here. "Starting 1 compile threads for 1 files...Compiling "MineOreScript"...F:\Program Files\Steam\steamapps\Common\Skyrim\Data\Scripts\Source\MineOreScript.psc(194,15): required (...)+ loop did not match anything at input '('F:\Program Files\Steam\steamapps\Common\Skyrim\Data\Scripts\Source\MineOreScript.psc(196,1): missing EOF at 'if'No output generated for MineOreScript.psc, compilation failed. Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on MineOreScript.psc" I'll paste in the script itself so you can look it over, if you wouldn't mind. ^-^ See what I screwed up. scriptName MineOreScript extends objectReference;;This script handles the Ore Veins and handshakes with the mining furniture;=================================================================== sound property DrScOreOpen auto{sound played when Ore is acquired} formlist property mineOreToolsList auto{Optional: Player must have at least one item from this formlist to interact} Message Property FailureMessage Auto {Message to say why you can't use this without RequiredWeapon} Message Property DepletedMessage Auto {Message to say that this vein is depleted} MiscObject Property Ore Auto {what you get from this Ore Vein} LeveledItem property lItemGems10 auto{Optional: Gems that may be mined along with ore} int Property ResourceCount = 5 Auto{how many resources you get per drop} int property ResourceCountTotal = 999999999999999 auto{how many resources this has before it is depleted} int property ResourceCountCurrent = -1 auto Hidden{Used to track the current remaining resources} int property StrikesBeforeCollection = 1 Auto{how many times this is struck before giving a resource} int property StrikesCurrent = -1 Auto hidden{Current number of strikes} int property AttackStrikesBeforeCollection = 3 Auto{how many times this is struck by attacks before giving a resource} int property AttackStrikesCurrent = -1 Auto hidden{Current number of attack strikes} mineOreFurnitureScript property myFurniture auto hidden{the furniture for this piece of ore, set in script} objectReference property objSelf auto hidden{objectReference to self} AchievementsScript property AchievementsQuest auto Location Property CidhnaMineLocation Auto Quest Property MS02 Auto Quest Property DialogueCidhnaMine Auto ObjectReference Property CidhnaMinePlayerBedREF Auto ;===================================================================;;EVENT BLOCK;=================================================================== event onCellAttach(); debug.Trace(self + ": is running onCellAttach")blockActivation()SetNoFavorAllowed()objSelf = self as objectReferenceif !getLinkedRef(); debug.Trace(self + ": does not have a linked ref, going to depleted state")depleteOreDueToFailure()endifendEvent event onActivate(objectReference akActivator); debug.Trace(self + " has been activated by " + akActivator) ;Actor is attempting to mineif akActivator as actor;if the actor is the playerif akActivator == game.getPlayer();if this is not depleted and the player has the right itemIf ResourceCountCurrent == 0DepletedMessage.Show()elseif playerHasTools() == falseFailureMessage.Show();enter the furnitureelseIf Game.GetPlayer().GetCurrentLocation() == CidhnaMineLocation && MS02.ISRunning() == False; debug.Trace(self + "Player is in Cidhna Mine, activate the bed to serve time")CidhnaMinePlayerBedREF.Activate(Game.GetPlayer())DialogueCidhnaMine.SetStage(45)ReturnEndIf; debug.Trace(self + " should cause " + akActivator + " to activate " + getLinkedRef())if getLinkedRef()myFurniture = getLinkedRef() as mineOreFurnitureScriptmyFurniture.lastActivateRef = objSelfgetLinkedRef().activate(akActivator)AchievementsQuest.incHardworker(2)Else; debug.Trace(self + ": error this ore does not have a linkedRef")endifendifElseif getLinkedRef()getLinkedRef().activate(akActivator)Else; debug.Trace(self + ": error this ore does not have a linkedRef")endifEndIf ;Furniture is telling ore it has been struck ElseIf akActivator == GetLinkedRef(); debug.Trace(self + ": has been activated by" + akActivator)ProccessStrikes() ;Something unexpected has activated the oreElse; debug.Trace(self + "has been activated by: " + akActivator + " why?")endifendEvent ;;;May add on hit with pickaxe here laterEvent OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked); debug.Trace(self + ": onHit - akAgressor = " + akAggressor + "; akSource = " + akSource)if akAggressor == game.getPlayer() ;PATCH 1.5 CAPTURE ON HIT EVENT AND BRING UP SERVE TIME DIALOG FOR CIDHNA MINEif mineOreToolsList.hasForm(akSource) If Game.GetPlayer().GetCurrentLocation() == CidhnaMineLocation && MS02.ISRunning() == False; debug.Trace(self + "Player is in Cidhna Mine, activate the bed to serve time")CidhnaMinePlayerBedREF.Activate(Game.GetPlayer())DialogueCidhnaMine.SetStage(45)ReturnEndIfproccessAttackStrikes()endifendifendEvent event onReset() ; debug.Trace(self + ": is running onReset");THIS WASN'T WORKING RIGHTself.Reset()self.clearDestruction()self.setDestroyed(False); if getLinkedRef()resourceCountCurrent = -1; else; depleteOreDueToFailure(); endifendEvent ;===================================================================;;FUNCTION BLOCK;===================================================================bool function playerHasTools()if Game.GetPlayer().GetItemCount(mineOreToolsList) > 0; debug.Trace(self + ": playerHasTools is returning true")return trueElse; debug.Trace(self + ": playerHasTools is returning false")return falseendIfendFunction function proccessAttackStrikes()if AttackStrikesCurrent <= -1AttackStrikesCurrent = AttackStrikesBeforeCollectionEndIfAttackStrikesCurrent -= 1 if AttackStrikesCurrent == 0AttackstrikesCurrent = AttackStrikesBeforeCollectiongiveOre()endIfendFunction function proccessStrikes()if StrikesCurrent <= -1StrikesCurrent = StrikesBeforeCollectionEndIfStrikesCurrent -= 1 if StrikesCurrent == 0strikesCurrent = StrikesBeforeCollectiongiveOre()endIfendFunction unction giveOre()Int Random ;define the variable as an integer -- Isharaif ResourceCountCurrent == -1ResourceCountCurrent = ResourceCountTotalEndIf if ResourceCountCurrent > 0ResourceCountCurrent -= 1; debug.Trace(self + ": ResourceCountCurrent = " + ResourceCountCurrent)if ResourceCountCurrent == 0 ; debug.Trace(self + ": ResourceCountCurrent == 0 - depleted" )self.damageObject(50)getLinkedRef().activate(objSelf)DrScOreOpen.play(self)self.setDestroyed(true); if this vein has ore and/or gems defined, give them.if ore(game.getPlayer()).addItem(Ore, ResourceCount)game.advanceskill("smithing", 100)Debug.TraceUser("RandomMining", self + ": Smithing skill given 1 point on last ore gain")endifRandom = Utility.RandomInt(1,10) ;give a random number between 1 and 10 to the variable -- Isharaif lItemGems10 && Random == 5 ;Only give the gem if the player meets leveled list requirements and the variable is equal to 5. a 1/10th chance -- Ishara(game.getPlayer()).addItem(lItemGems10)endifDepletedMessage.Show()elseDrScOreOpen.play(self); if this vein has ore and/or gems defined, give them.if ore(game.getPlayer()).addItem(Ore, ResourceCount)game.advanceskill("smithing", 100)Debug.TraceUser("RandomMining", self + ": Smithing skill given 1 point on non-last ore gain")endifRandom = Utility.RandomInt(1,10) ;give a random number between 1 and 10 to the variable -- Isharaif lItemGems10 && Random == 5 ;Only give the gem if the player meets leveled list requirements and the variable is equal to 5. a 1/10th chance -- Ishara(game.getPlayer()).addItem(lItemGems10)endifendifelseif ResourceCountCurrent == 0getLinkedRef().activate(objSelf)(getLinkedRef() as MineOreFurnitureScript).goToDepletedState()DepletedMessage.Show()endif function depleteOreDueToFailure()self.damageObject(50);THIS WASN'T WORKING RIGHTself.setDestroyed(true)ResourceCountCurrent = 0endFunction PS: I don't know how to use the damned Spoiler thing on these forums, hah. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted May 6, 2013 Share Posted May 6, 2013 The mistake is a simple mispelling. When you copy pasted from the forum post to your script you missed the beginning "F" in the word "Function" Since "unction" made no sense it errored on the following bits that did make sense. To access the spoiler tag: Click the green and white button third from the left top row. Then open the dropdown box and locate spoiler. To access the code tag: It is the blue angle brackets button "<>" located in the middle of the bottom row Alternatively, you can simply type [ spoiler ] Stuff here [ /spoiler ] & [ code ] Stuff here [ /code ]. Just be sure to remove the spaces from inside the brackets "[ ]" Link to comment Share on other sites More sharing options...
DemonicHowler Posted May 7, 2013 Author Share Posted May 7, 2013 The mistake is a simple mispelling. When you copy pasted from the forum post to your script you missed the beginning "F" in the word "Function" Since "unction" made no sense it errored on the following bits that did make sense. To access the spoiler tag: Click the green and white button third from the left top row. Then open the dropdown box and locate spoiler. To access the code tag: It is the blue angle brackets button "<>" located in the middle of the bottom row Alternatively, you can simply type [ spoiler ] Stuff here [ /spoiler ] & [ code ] Stuff here [ /code ]. Just be sure to remove the spaces from inside the brackets "[ ]"Thanks! Gah, I'm blind, I didn't notice the missing letter! ^-^' Link to comment Share on other sites More sharing options...
Recommended Posts