'********************************
'| |
'| Barons Super Main |
'| |
'********************************
' Black = 0
' Blue = 1
' Green = 2
' Cyan = 3
' Red = 4
' Magenta = 5
' Brown = 6
' Grey = 7
' DarkGrey = 8
' BrightBlue = 9
' BrightGreen = 10
' BrightCyan = 11
' BrightRed = 12
' Pink = 13
' Yellow = 14
' White = 15
'********************************
Sub JoinGame(index)
'********************************
Dim GameName
Dim MOTD
Dim getadmin
GameName = Trim(GetVar("Data.ini", "CONFIG", "GameName"))
MOTD = GetVar("motd.ini", "MOTD", "Msg")
Call PlayerMsg(index, "Welcome to " & GameName & "!", 14)
If Trim(MOTD) <> "" Then
Call PlayerMsg(index, "MOTD: " & MOTD, 11)
End If
End Sub
'********************************
Sub LeftGame(index)
'********************************
Dim GameName
GameName = Trim(GetVar("Data.ini", "CONFIG", "GameName"))
Call GlobalMsg(GetPlayerName(index) & " has left " & GameName & "!", 4)
End Sub
'********************************
Sub DropItems(index)
'********************************
Call Playermsg(index, "You rummage through your belongings. It appears death did not affect them!", 10)
End Sub
'********************************
Sub OnDeath(index)
'********************************
Dim townmap
Dim townx
Dim towny
If GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "TOWNPORTS", "townmap") > 0 Then
townmap = Int( GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "TOWNPORTS", "townmap") )
townx = Int( GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "TOWNPORTS", "townx") )
towny = Int( GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "TOWNPORTS", "towny") )
Call PlayerWarp(index, Int(townmap), Int(townx), Int(towny) )
Else
townx=107
towny=13
townmap=12
Call PlayerWarp(index, Int(townmap), Int(townx), Int(towny) )
End If
End Sub
'********************************
Sub PlayerLevelUp(index)
'********************************
Dim I
Dim D
Do While GetPlayerExp(index) => GetPlayerNextLevel(index)
D = GetPlayerExp(index) - GetPlayerNextLevel(index)
Call SetPlayerLevel(index, GetPlayerLevel(index) + 1)
I = 1 + (Int(GetPlayerSpeed(index) / 20) )
Call SetPlayerPoints(index, GetPlayerPoints(index) + ( 1 * I ) )
Call SetPlayerExp(index, D)
Loop
Call PlayerMsg(index, "You have " & GetPlayerPoints(index) & " stat points remaining.", 14)
End Sub
'********************************
Sub UsingStatPoints(index, PointType)
'********************************
Select Case PointType
'<><><><><>
Case 0
If GetPlayerSTR(index) + 1 > 1000 Then
Call PlayerMsg(index, "You have maxed your strength!", 14)
Exit Sub
End If
Call SetPlayerSTR(index, GetPlayerSTR(index) + 1)
Call PlayerMsg(index, "You increase in strength!", 10)
'<><><><><>
Case 1
If GetPlayerDEF(index) + 1 > 1000 Then
Call PlayerMsg(index, "You have maxed your defence!", 14)
Exit Sub
End If
Call SetPlayerDEF(index, GetPlayerDEF(index) + 1)
Call PlayerMsg(index, "You have gained more defense!", 14)
'<><><><><>
Case 2
If GetPlayerMAGI(index) + 1 > 1000 Then
Call PlayerMsg(index, "You have maxed your magic!", 14)
Exit Sub
End If
Call SetPlayerMAGI(index, GetPlayerMAGI(index) + 1)
Call PlayerMsg(index, "You grow in magical power!", 14)
'<><><><><>
Case 3
If GetPlayerSpeed(index) + 1 > 1000 Then
Call PlayerMsg(index, "You have maxed your speed!", 14)
Exit Sub
End If
Call SetPlayerSPEED(index, GetPlayerSpeed(index) + 1)
Call PlayerMsg(index, "You increase in speed!", 14)
'<><><><><>
End Select
Call SetPlayerPoints(index, GetPlayerPoints(index) - 1)
End Sub
'********************************
Sub ScriptedTile(index, Script)
'********************************
Select Case Script
'<><><><><>
Case 0
Call Baron_Uber_skills(index)
'<><><><><>
Case 1
Call Baron_Stam_regain(index)
'<><><><><>
Case 2
Call Set_town_portal(index)
'<><><><><>
End Select
End Sub
'********************************
Sub Commands(index)
'********************************
On Error Resume Next
Dim i
Dim TextSay
Dim n
Dim m
Dim C
Dim test
Dim mapnum
Dim x
Dim y
m = GetVar("Data.ini", "MAX", "MAX_MAPS")
TextSay = GetVar("Scripts\Command.ini", "TEMP", "Text" & index)
i = 1
C = 0
'<><><><><>
If LCase(Mid(TextSay, 1, 5)) = "/wish" Then
If Len(TextSay) > 6 Then
TextSay = Mid(TextSay, 6, Len(TextSay) - 5)
Do While C = 0
If GetVar("wishes.ini", "WISH", "Wish" & i) <> "" Then
i = i + 1
Else
Call PutVar("wishes.ini", "WISH", "Wish" & i, Trim(TextSay))
Call PlayerMsg(index, "Thank You For Wishing!", 10)
C = 1
End If
Loop
End If
Exit Sub
End If
'<><><><><>
If LCase(Mid(TextSay, 1, 9)) = "/warpmeto" Then
If Len(TextSay) > 10 Then
TextSay = Mid(TextSay, 10, Len(TextSay) - 9)
' Prevent hacking
If GetPlayerAccess(index) < 2 Then
Call PlayerMsg(index, "You need be of a higher access to use this command!", 12)
Exit Sub
End If
' The player
n = FindPlayer(TextSay)
If n <> index Then
If n > 0 Then
Call PlayerWarp(index, GetPlayerMap(n), GetPlayerX(n), GetPlayerY(n))
Call PlayerMsg(n, GetPlayerName(index) & " has warped to you.", 14)
Call PlayerMsg(index, "You have been warped to " & GetPlayerName(n) & ".", 10)
Call AddLog(GetPlayerName(index) & " has warped to " & GetPlayerName(n) & ", map #" & GetPlayerMap(n) & ".", ADMIN_LOG)
Else
Call PlayerMsg(index, "Player is not online.", 12)
End If
Else
Call PlayerMsg(index, "You cannot warp to yourself!", 12)
End If
End If
Exit Sub
End If
'<><><><><>
If LCase(Mid(TextSay, 1, 10)) = "/setportal" Then
n = Mid(TextSay, 11, Len(TextSay) - 10)
If GetPlayerAccess(index) >= 1 Then
Call PlayerMsg(index, "You have created a portal opening at this spot! You may now return to this spot at any time by typing /portal " & n, 10)
Call PutVar("scripts\charextras\" & trim(GetPlayerName(index)) & ".ini", "PORTALS", "map" & n, GetPlayerMap(index))
Call PutVar("scripts\charextras\" & trim(GetPlayerName(index)) & ".ini", "PORTALS", "x" & n, GetPlayerX(index))
Call PutVar("scripts\charextras\" & trim(GetPlayerName(index)) & ".ini", "PORTALS", "y" & n, GetPlayerY(index))
Else
Call PlayerMsg(index, "You do not have that ability.", 12)
End If
Exit Sub
End If
'<><><><><>
If LCase(Mid(TextSay, 1, 7)) = "/portal" Then
n = Mid(TextSay, 8, Len(TextSay) - 7)
mapnum = GetVar("scripts\charextras\" & trim(GetPlayerName(index)) & ".ini", "PORTALS", "map" & n)
y = GetVar("scripts\charextras\" & trim(GetPlayerName(index)) & ".ini", "PORTALS", "y" & n)
x = GetVar("scripts\charextras\" & trim(GetPlayerName(index)) & ".ini", "PORTALS", "x" & n)
If GetPlayerAccess(index) >= 1 Then
Call PlayerWarp(index, mapnum, x, y)
Else
Call PlayerMsg(index, "You do not have that ability.", 12)
End If
Exit Sub
End If
'<><><><><>
If LCase(Mid(TextSay, 1, 9)) = "/warptome" Then
If Len(TextSay) > 10 Then
If GetPlayerAccess(index) < 2 Then
Call PlayerMsg(index, "You need be of a higher access to use this command!", 12)
Exit Sub
End If
n = Mid(TextSay, 10, Len(TextSay) - 9)
n = FindPlayer(n)
If n <> index Then
If n > 0 Then
Call PlayerWarp(n, GetPlayerMap(index), GetPlayerX(index), GetPlayerY(index))
Call PlayerMsg(n, "You have been summoned by " & GetPlayerName(index) & ".", 14)
Call PlayerMsg(index, GetPlayerName(n) & " has been summoned.", 10)
Call AddLog(GetPlayerName(index) & " has warped " & GetPlayerName(n) & " to self, map #" & GetPlayerMap(index) & ".", ADMIN_LOG)
Else
Call PlayerMsg(index, "Player is not online.", 12)
End If
Else
Call PlayerMsg(index, "You cannot warp yourself to yourself!", 12)
End If
End If
Exit Sub
End If
'<><><><><>
If LCase(Mid(TextSay, 1, 7)) = "/warpto" Then
If Len(TextSay) > 8 Then
TextSay = Mid(TextSay, 8, Len(TextSay) - 7)
n = TextSay
If n > 0 and n <= m Then
If GetPlayerAccess(index) < 2 Then
Call PlayerMsg(index, "You need be of a higher access to use this command!", 12)
Exit Sub
End If
Call PlayerWarp(index, n, GetPlayerX(index), GetPlayerY(index))
Call PlayerMsg(index, "You have been warped to map #" & n, 10)
Call AddLog(GetPlayerName(index) & " warped to map #" & n & ".", ADMIN_LOG)
Else
Call PlayerMsg(index, "Invalid map number.", 12)
End If
End If
Exit Sub
End If
'-------------------------------
Select Case LCase(Trim(TextSay))
'-------------------------------
'<><><><><>
Case "/help"
Call PlayerMsg(index, "Social Commands:", 14)
Call PlayerMsg(index, "'msghere = Broadcast Message", 15)
Call PlayerMsg(index, "-msghere = Emote Message", 15)
Call PlayerMsg(index, "!namehere msghere = Player Message", 15)
Call PlayerMsg(index, "Available Commands: /help, /info, /who, /fps, /inv, /stats, /train, /party, /join, /leave, /refresh, /town, /8ball, /rainbow", 15)
Exit Sub
'<><><><><>
Case "/calladmins"
If GetPlayerAccess(index) = 0 Then
Call AdminMsg(GetPlayerName(index) & " needs an admin!", 14)
Call PlayerMsg(index, "You have requested help from an admin.", 14)
Else
Call PlayerMsg(index, "You are an admin, grow up and solve the problem.", 12)
End If
Exit Sub
'<><><><><>
Case "/admin"
If GetPlayerAccess(index) > 0 Then
Call PlayerMsg(index, "Social Commands:", 14)
Call PlayerMsg(index, """msghere = Global Admin Message", 15)
Call PlayerMsg(index, "=msghere = Private Admin Message", 15)
Call PlayerMsg(index, "Available Commands: /admin, /loc, /mapeditor, /warpmeto, /warptome, /warpto, /setsprite, /mapreport, /kick, /ban, /edititem, /respawn, /editnpc, /motd, /editshop, /ban, /editspell", 15)
End If
Exit Sub
'<><><><><>
Case "/away"
If GetPlayerAccess(index) >= 1 Then
If GetVar("accounts\" & GetPlayerLogin(index) & ".ini", "CHAR" & GetPlayerCharNum(index), "Status") = 0 Then
Call GlobalMsg(GetPlayerName(index) & " is now away.", 14)
Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini", "CHAR" & GetPlayerCharNum(index), "Status", 1)
Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini", "CHAR" & GetPlayerCharNum(index), "TempPlayerName", GetPlayerName(index))
Call SetPlayerName(index, GetPlayerName(index) & " - Away")
Call SendPlayerData(index)
Exit Sub
ElseIf GetVar("accounts\" & GetPlayerLogin(index) & ".ini", "CHAR" & GetPlayerCharNum(index), "Status") = 1 Then
Call SetPlayerName(index, GetVar("accounts\" & GetPlayerLogin(index) & ".ini", "CHAR" & GetPlayerCharNum(index), "TempPlayerName"))
Call GlobalMsg(GetPlayerName(index) & " has returned from being away.", 14)
Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini", "CHAR" & GetPlayerCharNum(index), "Status", 0)
Call SendPlayerData(index)
Exit Sub
End If
End If
'<><><><><>
Case "/test"
Call testmain(index)
Exit Sub
'<><><><><>
Case "/8ball"
Call Prediction_Ball(index)
Exit Sub
'<><><><><>
Case "/rainbow"
Call all_the_colors_of_the_rainbow(index)
Exit Sub
'<><><><><>
Case "/town"
Call use_town_portal(index)
Exit Sub
'<><><><><>
Case "/expgen"
If Int(GetPlayerAccess(index)) >= Int(4) Then
Call Generate_exp(index)
End If
Exit Sub
'<><><><><>
End Select
Call PlayerMsg(index, "Thats not a valid command!", 12)
End Sub
'********************************
Sub all_the_colors_of_the_rainbow(index)
'********************************
Call playerMsg(index, "Black", 0)
Call playerMsg(index, "Blue", 1 )
Call playerMsg(index, "Green", 2 )
Call playerMsg(index, "Cyan", 3 )
Call playerMsg(index, "Red", 4 )
Call playerMsg(index, "Magenta", 5 )
Call playerMsg(index, "Brown", 6 )
Call playerMsg(index, "Grey", 7 )
Call playerMsg(index, "DarkGrey", 8 )
Call playerMsg(index, "BrightBlue", 9 )
Call playerMsg(index, "BrightGreen", 10 )
Call playerMsg(index, "BrightCyan", 11 )
Call playerMsg(index, "BrightRed", 12 )
Call playerMsg(index, "Pink", 13 )
Call playerMsg(index, "Yellow", 14)
Call playerMsg(index, "White", 15)
End Sub
'********************************
Sub Blockplayer(index)
'********************************
Dim direction
direction = GetPlayerDir(index)
Select Case Int(direction)
Case 0
Call PlayerWarp(index, GetPlayerMap(index), GetPlayerX(index), GetPlayerY(index)+1)
Case 1
Call PlayerWarp(index, GetPlayerMap(index), GetPlayerX(index), GetPlayerY(index)-1)
Case 2
Call PlayerWarp(index, GetPlayerMap(index), GetPlayerX(index)+1, GetPlayerY(index))
Case 3
Call PlayerWarp(index, GetPlayerMap(index), GetPlayerX(index)-1, GetPlayerY(index))
End Select
End Sub
'********************************
Sub Prediction_Ball(index)
'********************************
Dim randomiser
Dim max
Dim message
max = Getvar("scripts\8ball.ini", "index", "total_messages")
randomiser = Int((Int(max) + 1) * Rnd) + 0
If randomiser = 0 Then
randomiser = 1
End If
message = Getvar("scripts\8ball.ini", "messages", Int(randomiser) )
Call Playermsg(index, message, 10)
End Sub
'********************************
Sub Set_town_portal(index)
'********************************
Dim townmap
Dim townx
Dim towny
townmap = 0 + GetPlayerMap(index)
townx = 0 + GetPlayerX(index)
towny = 0 + GetPlayerY(index)
Call PutVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "TOWNPORTS", "townmap", 0 + townmap)
Call PutVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "TOWNPORTS", "townx", 0 + townx)
Call PutVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "TOWNPORTS", "towny", 0 + towny)
Call PlayerMsg(index, "Your soul is now bound to this portal arch. Type /town to return here. " , 10)
End Sub
'********************************
Sub use_town_portal(index)
'********************************
Dim townmap
Dim townx
Dim towny
If GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "TOWNPORTS", "townmap") <> "" Then
townmap = Int( GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "TOWNPORTS", "townmap") )
townx = Int( GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "TOWNPORTS", "townx") )
towny = Int( GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "TOWNPORTS", "towny") )
Call PlayerWarp(index, Int(townmap), Int(townx), Int(towny) )
Call Playermsg(index,"You summon a town portal returning you to town.", 10)
Else
Call Playermsg(index,"You have not yet set a town to return to.", 12)
End If
End Sub
'********************************
Sub Generate_exp(index)
'********************************
Dim max_lvl
Dim start_exp
Dim increase_per_lvl
Dim count
Dim previous_exp
Dim new_exp
Dim first_check
first_check=0
max_lvl=100
count=1
increase_per_lvl=11
start_exp=100
Call putvar("experience.ini", "EXPERIENCE", "Exp0", Int(start_exp) )
Do While count <= max_lvl
previous_exp=Int(getvar("experience.ini", "EXPERIENCE", "Exp"& (Int(count)-1) ) )
Call playermsg(index, previous_exp, 10)
new_exp=previous_exp+(previous_exp/100*increase_per_lvl)
Call playermsg(index, new_exp, 10)
Call putvar("experience.ini", "EXPERIENCE", "Exp"&Int(count), Int(new_exp) )
count=count+1
Loop
Call playermsg(index, "New exp table created.", 10)
End Sub
'********************************
Function F_Freeslots(index)
'********************************
Dim slot
Dim count
slot=1
count=0
Do While slot < 25
If getplayerinvitemnum(index, slot) = 0 Then
count = Int(count) + 1
End If
slot=Int(slot) + 1
Loop
F_Freeslots=Int(count)
End Function
'********************************
Sub Give_Item(index, number, durability)
'********************************
Dim slot
slot = 1
Do While slot < 25
If Getplayerinvitemnum( index, Int( slot ) ) = 0 Then
Call SetPlayerInvItemNum(index, Int( slot ), Int( number ) )
Call SetPlayerInvItemDur(index, Int( slot ), Int( durability ) )
Call SetPlayerInvItemValue(index, Int( slot ), Int(0) )
Call SendInventoryUpdate(index, Int(slot) )
slot = 25
End If
slot = slot + 1
Loop
End Sub
'********************************
Sub Give_Currency(index, number, quantity)
'********************************
Dim slot
Dim initial
Dim final
Dim given
slot=1
given=0
Do While slot < 25
If Getplayerinvitemnum(index,Int(slot))=Int(number) Then
initial = Getplayerinvitemvalue( index, Int( slot ) )
final = Int( initial ) + Int( quantity )
Call setplayerinvitemvalue( index, Int( slot ), Int( final ) )
Call SendInventoryUpdate(index, Int(slot) )
slot = 25
given = 1
End If
slot = slot + 1
Loop
If given=1 Then
slot=25
Else
slot=1
End If
Do While slot < 25
If Getplayerinvitemnum(index,Int(slot)) = 0 Then
Call SetPlayerInvItemNum(index, Int( slot ), Int( number ) )
Call SetPlayerInvItemValue(index, Int( slot ), Int( quantity ) )
Call SetPlayerInvItemDur(index, Int( slot ), 0 )
Call SendInventoryUpdate(index, Int(slot) )
slot = 25
End If
slot = slot + 1
Loop
End Sub
'********************************
Function F_Check_Take(index, number, value)
'********************************
Dim slot
slot = 1
F_Check_Take =0
Do While slot < 25
If Getplayerinvitemnum( index, Int( slot ) ) = Int( number ) Then
If GetPlayerInvItemValue(index, Int( slot ) ) >= Int(value) Then
F_Check_Take=1
End If
End If
slot = slot + 1
Loop
End Function
'********************************
Sub Take_Item(index, number, value)
'********************************
Dim slot
Dim taken
Dim initial
Dim final
slot=1
taken=0
Do While Int(slot) < 25
If Int(taken)=0 Then
If Getplayerinvitemnum(index,Int(slot)) = Int(number) Then
If Int(getplayerinvitemvalue(index, Int(slot))) >= Int(value) Then
initial = Int(getplayerinvitemvalue(index, Int(slot) ) )
final = Int(initial) - Int(value)
If Int(final) <= 0 Then
Call setplayerinvitemnum(index, Int(slot), Int(0) )
Call setplayerinvitemvalue(index, Int(slot), Int(0) )
Call setplayerinvitemdur(index, Int(slot), Int(0) )
Call SendInventoryUpdate(index, Int(slot))
taken=1
Else
Call setplayerinvitemvalue(index, Int(slot), Int(final) )
Call SendInventoryUpdate(index, Int(slot) )
taken=1
End If
End If
End If
End If
slot = slot + 1
Loop
End Sub
'********************************
Sub Baron_Stam_regain(index)
'********************************
Dim skill_type
Dim skill_action
Dim stam_total
Dim player_lvl
skill_type=Trim( GetVar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "SKILL","type") )
If Int(Getvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type), "has_data") ) < 1 Then
Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "Exp", Int(0) )
Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "level", Int(0))
Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "stamina", Int(10))
Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "has_data", Int(1))
Call battlemsg(index, "You should return here if you wish to rest", 14, 1)
End If
player_lvl=Getvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "level")
skill_action=Trim(GetVar("scripts\skills\" & skill_type & ".ini", "INDEX","action"))
stam_total=5 + Int(player_lvl)
Call PutVar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "stamina", Int(stam_total))
Call battlemsg(index, "You feel refreshed and ready to " & skill_action & " again.", 14, 1)
End Sub
'********************************
Sub Baron_Uber_skills(index)
'********************************
'Do not modify this script in any way.
'It is provided as is in all goodwill.
'There is CONSIDERABLE time spent here.
On Error Resume next
Dim skill_type
Dim skill_number
Dim take_total
Dim give_total
Dim count
Dim take_count
Dim take_num
Dim take_val
Dim take_msg
Dim empty_space
Dim take_check
Dim needed_item
Dim player_weapon
Dim skill_action
Dim currency_check
Dim recipe_count
Dim recipe_total
Dim min_lvl
Dim player_lvl
Dim player_stam
Dim recipe_stam
Dim give_val
Dim give_num
Dim give_dur
Dim give_msg
Dim high_randomiser
Dim success_chance
Dim low_chance
Dim high_chance
Dim give_exp
Dim new_exp
Dim lvl_exp
Dim next_lvl
If Int(GetVar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "SKILL","has_data")) < 0 Then
Call Putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "SKILL","type", "")
Call Putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "SKILL","number", 0)
Call Putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "SKILL","has_data", 1)
Call Playermsg(index, "Made skill template for map", 14)
Call Playermsg(index, "Credits go to Baron - http://barony.deviantart.com/", 14)
End If
RECIPE_COUNT = Int(1)
skill_type=Trim( GetVar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "SKILL","type") )
recipe_total=Int(GetVar("scripts\skills\" & skill_type & ".ini","INDEX" ,"total_recipes"))
'RECIPES ALWAYS HAVE SKILL 1 SELECTED IN MAPEXTRAS AND TOTAL RECIPES IN SKILLS SET TO HIGHEST
'NON RECIPES HAVE ANY SKILL SELECTED IN MAPEXTRAS AND TOTAL RECIPES IN SKILLS SET TO 1
Do While Int(RECIPE_COUNT) <= Int(recipe_total)
If trim(skill_type) <> "" Then
skill_number = Int(GetVar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "SKILL","number"))
If Int(recipe_count) > 1 Then
skill_number = Int(recipe_count)
End If
needed_item=Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number),"item_num_needed"))
player_weapon=Int( Getplayerinvitemnum(index, Int(getplayerweaponslot(index)) ) )
skill_action=Trim(GetVar("scripts\skills\" & skill_type & ".ini", "INDEX","action"))
If Int(needed_item) = Int(player_weapon) Then
min_lvl = Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number),"min_level"))
If Int(Getvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type), "has_data") ) < 1 Then
Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "Exp", Int(0) )
Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "level", Int(0))
Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "stamina", Int(10))
Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "has_data", Int(1))
Call playermsg(index, "You attempt to " & skill_action & " for the first time!", 14)
End If
player_lvl = Int(Getvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "level"))
If Int(min_lvl) <= Int(player_lvl) Then
player_stam=Int(getvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "stamina"))
recipe_stam=Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number),"stam_taken"))
If Int(player_stam) >= Int(recipe_stam) Then
take_total = Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number),"take_total"))
give_total = Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number),"give_total"))
count = Int ( 1 )
take_count = Int ( 0 )
empty_space=F_Freeslots(index)
If Int(give_total) <= Int(empty_space) Then
Do While count <= Int(take_total)
take_num=Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_take_num"))
take_val=Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_take_val"))
take_check=F_Check_Take(index,take_num,take_val)
take_count=take_count + Int(take_check)
count=count+1
Loop
If Int(take_count) = Int(take_total) Then
count = Int ( 1 )
Do While Int(count) <= Int(take_total)
take_num=Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_take_num"))
take_val=Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_take_val"))
take_msg=Trim(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_take_Msg"))
Call battlemsg(index, trim(take_msg), 15, 1)
Call Take_Item(index, Int(take_num), Int(take_val) )
count=count+1
Loop
count = Int ( 1 )
new_exp = 0
Do While Int(count) <= Int(give_total)
give_val = Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_give_val"))
give_msg = Trim(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_give_msg"))
success_chance = Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_base_chance"))
low_chance= Int(player_lvl) - Int(min_lvl) + 1
high_chance = Int(player_lvl) - Int(min_lvl) + Int(success_chance)
high_randomiser = Int((high_chance + 1) * Rnd)
If Int(high_randomiser) <= Int(low_chance) Then
If Int(give_val) > 0 Then
give_num = Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_give_num"))
Call Give_Currency(index, Int(give_num), Int(give_val) )
Call battlemsg(index, Trim(give_msg),10, 1)
'TO HAVE THE SCRIPT AUTO CREATE ALL ITEMS IT CAN ONCE EACH, REMOVE LINE BELOW
RECIPE_COUNT= Int(recipe_total)
Else
give_num = Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_give_num"))
give_dur = Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_give_dur"))
Call Give_Item(index, give_num, give_dur)
Call battlemsg(index, Trim(give_msg),10, 1)
'TO HAVE THE SCRIPT AUTO CREATE ALL ITEMS IT CAN ONCE EACH, REMOVE LINE BELOW
RECIPE_COUNT= Int(recipe_total)
End If
give_exp = 0 + Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_EXP"))
new_exp = 0 + Int(getvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "exp")) + Int(give_exp)
Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "exp", Int(new_exp))
End If
If new_exp=0 Then
new_exp=Int(getvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "exp"))
End If
count=count+1
Loop
next_level = Int(player_lvl) + Int(1)
lvl_exp = Int(Getvar("experience.ini", "EXPERIENCE", "Exp" & Int(next_level) ) )
Call battlemsg(index,new_exp & " / " & lvl_exp & " For " & next_level & " " & trim(skill_type), 6, 0)
If Int(new_exp) >= Int(lvl_exp) and Int(player_lvl) < 100 Then
new_exp= 0 + Int(new_exp) - Int(lvl_exp)
Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "exp", Int(new_exp))
Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "level", Int(next_level))
Call battlemsg(index, "Congratulations, you are now level " & Int(next_level) & " in " & trim(skill_type) & "!", 13, 1)
End If
player_stam = Int(player_stam) - Int(recipe_stam)
Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "stamina", Int(player_stam))
If Int(recipe_total) = 1 Then
RECIPE_COUNT= Int(recipe_total)
End If
Else
If Int(recipe_count) + 1 > Int(recipe_total) and Int(recipe_total) > Int(1) Then
Call battlemsg(index, "You have no components to " & skill_action, 12, 1)
End If
End If
Else
Call battlemsg(index, "You need more inventory room to continue " & skill_type & ".", 15, 1)
End If
Else
Call battlemsg(index, "You are too tired to " & skill_action & ".", 12, 1)
End If
Else
Call battlemsg(index, "You need to be more skilled to " & skill_action & " here.", 12, 1)
End If
End If
'This continues off end of item script. Used when empty slot. Elseif errors usually.
If Int(needed_item) <> Int(player_weapon) and Int(recipe_count) = 1 Then
Call battlemsg(index, "You need to get the right tool to " & skill_action & " here.", 15, 1)
End If
Else
'Not working. Cant figure out why. Is non essential for the script to work.
Call Playermsg(index, "You still need to define a skill for this map", 14)
End If
RECIPE_COUNT = Int(recipe_count)+1
Loop
End Sub
'********************************
'| INSERT EXTRA SUBS ABOVE HERE |
'********************************
'********************************
Sub testmain(index)
'********************************
Call Playermsg(index, "All your scripts should be working if you recieved this message", 10)
End Sub
'********************************
'| END OF SUPER MAIN |
'| www.barony.deviantart.com |
'********************************