Dastyruck Posted May 14, 2009 Author Share Posted May 14, 2009 Alright, I made this skill script for woodcutting which is being called by a scripted tile.I have it so if the player doesnt have any data it creates data but this isnt working at all.If someone has data it works, but if they dont… it doesnt work... sooooo...Here is the code.```'********************************Sub WoodCut(index)'********************************Dim successDim slotDim number Dim level Dim timesnumber = 8slot = 1level = Getvar("scripts\charextras\" & GetPlayerName(index) & ".ini","woodcut","level")success = Rand(Int(level), 5)times = Getvar("scripts\charextras\" & GetPlayerName(index) & ".ini","woodcut","times") If Getvar("scripts\charextras\" & GetPlayerName(index) & ".ini","woodcut","level") <> "" Then Call PlayerMsg(index, "If", GREEN) If success = 1 Then Do While slot < 25 If Getplayerinvitemnum( index, Int( slot ) ) = Int( number ) Then Call SetPlayerInvItemNum(index, Int( slot ), Int( number ) ) Call SetPlayerInvItemValue(index, Int( slot ), Int(1) ) Call SendInventoryUpdate(index, Int(slot) ) slot = 25 End If slot = slot + 1 Loop Call Putvar("scripts\charextras\" & GetPlayerName(index) & ".ini","woodcut","times",Int( times ) + 1) If times = 50 Then If level < 4 Then Call Putvar("scripts\charextras\" & GetPlayerName(index) & ".ini","woodcut","level",Int( level) + 1) Call Putvar("scripts\charextras\" & GetPlayerName(index) & ".ini","woodcut","times",0) End If End If Call PlayerMsg(index, "You successfully harvested 1 wood!", GREEN) Else Call PlayerMsg(index, "You did not harvest any wood.", GREEN) End IfElse Call PlayerMsg(index, "Else", GREEN) times = 0 level = 1 Call Putvar("scripts\charextras\" & GetPlayerName(index) & ".ini","woodcut","level",Int(level)+0) Call Putvar("scripts\charextras\" & GetPlayerName(index) & ".ini","woodcut","times",Int(times)+0) number = 8 slot = 1 level = Getvar("scripts\charextras\" & GetPlayerName(index) & ".ini","woodcut","level") success = Rand(Int(level), 5) times = Getvar("scripts\charextras\" & GetPlayerName(index) & ".ini","woodcut","times") If success = 1 Then Do While slot < 25 If Getplayerinvitemnum( index, Int( slot ) ) = 0 Then Call SetPlayerInvItemNum(index, Int( slot ), Int( number ) ) Call SetPlayerInvItemValue(index, Int( slot ), Int(1) ) Call SendInventoryUpdate(index, Int(slot) ) slot = 25 End If slot = slot + 1 Loop Call Putvar("scripts\charextras\" & GetPlayerName(index) & ".ini","woodcut","times",Int( times ) + 1) If times = 50 Then If level < 4 Then Call Putvar("scripts\charextras\" & GetPlayerName(index) & ".ini","woodcut","level",Int( level) + 1) Call Putvar("scripts\charextras\" & GetPlayerName(index) & ".ini","woodcut","times",0) End If End If Call PlayerMsg(index, "You successfully harvested 1 wood!", GREEN) Else Call PlayerMsg(index, "You did not harvest any wood.", GREEN) End IfEnd IfCall PlayerMsg(index, "End", GREEN)End Sub``` Link to comment Share on other sites More sharing options...
Dastyruck Posted May 14, 2009 Author Share Posted May 14, 2009 FIXED!Right after posting… realized if im setting bad variables it makes a script error. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now