Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- charCreate={}
- charCreate.Functions={}
- charCreate.Vars={}
- charCreate.Hooks={}
- charCreate.Opened=false
- charCreate.Vars.Angles=Angle(0, 0, 0)
- charCreate.Vars.ReadingX=false
- charCreate.Vars.ReadingY=false
- charCreate.Vars.ReadingZ=false
- charCreate.Vars.Zoom=1
- charCreate.Vars.CurX=0
- charCreate.Vars.CurY=0
- local classes={
- ["Mage"]= {
- ["Advanced"]={
- ["Templar"]="Specialty: Healing/Support\nTotal Health: Low\nAttacks: Low power, low cooldown",
- ["Sorceror"]="Specialty: Damage over Time\nTotal Health: Medium\nAttacks: Medium power, low cooldown",
- ["Warlock"]="Specialty: High Power\nTotal Health: High\nAttacks: High Power, low cooldown"
- }
- },
- ["Swordsman"]= {
- ["Advanced"]={
- ["Cutthroat"]="Specialty: Speed\nTotal Health: Medium\nAttacks: Fast, medium power",
- ["Knight"]="Specialty: High Power\nTotal Health: Very high\nAttacks: Slow, high power"
- }
- }
- }
- function OpenCharacterCreation()
- charCreate.Opened=true
- local CreateChar
- local AdvancedType
- local CharDescription
- local DLabel4
- local DLabel3
- local DLabel2
- local CharName
- local BaseType
- local ModelSelectR
- local ModelSelectName
- local ModelSelectL
- local DFrame1
- local selectedClass
- DFrame1 = vgui.Create('DFrame')
- DFrame1:SetSize(230, 480)
- DFrame1:SetPos(10, 10)
- DFrame1:SetTitle('Character Creation')
- DFrame1:SetSizable(false)
- DFrame1:SetDraggable(false)
- DFrame1:SetDeleteOnClose(false)
- --DFrame1:ShowCloseButton(false)
- DFrame1:MakePopup()
- ModelSelectL = vgui.Create('DButton')
- ModelSelectL:SetParent(DFrame1)
- ModelSelectL:SetSize(20, 20)
- ModelSelectL:SetPos(20, 110)
- ModelSelectL:SetText('<')
- ModelSelectL.DoClick = function() end
- ModelSelectName = vgui.Create('DLabel')
- ModelSelectName:SetParent(DFrame1)
- ModelSelectName:SetPos(60, 110)
- ModelSelectName:SetText("Model Selection Here")
- ModelSelectName:SizeToContents()
- ModelSelectR = vgui.Create('DButton')
- ModelSelectR:SetParent(DFrame1)
- ModelSelectR:SetSize(20, 20)
- ModelSelectR:SetPos(190, 110)
- ModelSelectR:SetText('>')
- ModelSelectR.DoClick = function() end
- CharName = vgui.Create('DTextEntry')
- CharName:SetParent(DFrame1)
- CharName:SetSize(190, 20)
- CharName:SetPos(20, 70)
- CharName:SetText('')
- CharName.OnEnter = function() end
- DLabel2 = vgui.Create('DLabel')
- DLabel2:SetParent(DFrame1)
- DLabel2:SetPos(30, 160)
- DLabel2:SetText('Base Class')
- DLabel2:SizeToContents()
- DLabel3 = vgui.Create('DLabel')
- DLabel3:SetParent(DFrame1)
- DLabel3:SetPos(30, 50)
- DLabel3:SetText('Character Name')
- DLabel3:SizeToContents()
- DLabel4 = vgui.Create('DLabel')
- DLabel4:SetParent(DFrame1)
- DLabel4:SetPos(30, 220)
- DLabel4:SetText('Advanced Class')
- DLabel4:SizeToContents()
- CharDescription = vgui.Create('DLabel')
- CharDescription:SetParent(DFrame1)
- CharDescription:SetPos(30, 350)
- CharDescription:SetText("Select a class to see it's\nfull description")
- CharDescription:SizeToContents()
- AdvancedType = vgui.Create('DComboBox')
- AdvancedType:SetParent(DFrame1)
- AdvancedType:SetMultiple(false)
- AdvancedType:SetSize(190, 100)
- AdvancedType:SetPos(20, 240)
- AdvancedType:EnableHorizontal(false)
- AdvancedType:EnableVerticalScrollbar(true)
- function AdvancedType:OnMousePressed()
- if AdvancedType:GetSelectedItems() and AdvancedType:GetSelectedItems()[1] and selectedClass then
- --PrintTable(AdvancedType:GetSelectedItems())
- CharDescription:SetText(classes[selectedClass].Advanced[AdvancedType:GetSelectedItems()[1]:GetValue()])
- CharDescription:SizeToContents()
- end
- end
- AdvancedType:SetMultiple(false)
- BaseType = vgui.Create('DMultiChoice')
- BaseType:SetParent(DFrame1)
- BaseType:SetPos(20, 180)
- BaseType:SetSize(190, 20)
- BaseType.OnMousePressed = function()
- BaseType:OpenMenu()
- end
- BaseType:SetEditable(false)
- function BaseType:OnSelect(index, value, data)
- AdvancedType:Clear()
- for f, v in pairs(classes[value].Advanced) do
- AdvancedType:AddItem(f)
- end
- AdvancedType:SetSelected(1)
- selectedClass=value
- end
- BaseType:AddChoice('Mage')
- BaseType:AddChoice('Swordsman')
- CreateChar = vgui.Create('DButton')
- CreateChar:SetParent(DFrame1)
- CreateChar:SetSize(140, 30)
- CreateChar:SetPos(40, 430)
- CreateChar:SetText('Create Character')
- CreateChar.DoClick = function() end
- end
- concommand.Add("showCharacterCreation", OpenCharacterCreation)
- local oldMouseX=nil
- local oldMouseY=nil
- function charCreate.Hooks.Think()
- if charCreate.Opened and !MWCursorEnabled then
- gui.EnableScreenClicker(true)
- MWCursorEnabled=true
- end
- if charCreate.Vars.ReadingX then
- charCreate.Vars.CurX=charCreate.Vars.CurX+(gui.MouseX()-oldMouseX)
- oldMouseX=gui.MouseX()
- elseif charCreate.Vars.ReadingY then
- charCreate.Vars.CurY=math.Clamp(charCreate.Vars.CurY+(gui.MouseY()-oldMouseY), -60, 60)
- oldMouseY=gui.MouseY()
- end
- if charCreate.Vars.ReadingZ then
- charCreate.Vars.Zoom=math.Clamp(charCreate.Vars.Zoom+((gui.MouseY()-oldMouseY)/50), 0.22, 1)
- oldMouseY=gui.MouseY()
- end
- charCreate.Vars.Angles=Angle(charCreate.Vars.CurY, charCreate.Vars.CurX, 0)
- end
- function charCreate.Hooks.CallScreenClickHook( click, mousecode, vec )
- if click and mousecode==107 then
- charCreate.Vars.ReadingX=true
- oldMouseX=gui.MouseX()
- --print("Clicked left")
- --print(tostring(charCreate.Vars.ReadingX))
- elseif !click and mousecode==107 then
- charCreate.Vars.ReadingX=false
- oldMouseX=nil
- --print("Unclicked left")
- -- print(tostring(charCreate.Vars.ReadingX))
- end
- if click and mousecode==108 then
- charCreate.Vars.ReadingY=true
- oldMouseY=gui.MouseY()
- --print("Clicked left")
- --print(tostring(charCreate.Vars.ReadingX))
- elseif !click and mousecode==108 then
- charCreate.Vars.ReadingY=false
- oldMouseY=nil
- --print("Unclicked left")
- -- print(tostring(charCreate.Vars.ReadingX))
- end
- end
- function charCreate.Hooks.CalcView(ply, pos, angles, fov)
- local view={}
- view.angles=angles+charCreate.Vars.Angles
- view.origin=pos-(view.angles:Forward()*(100*charCreate.Vars.Zoom))
- view.fox=fov
- return view
- end
- function charCreate.Hooks.GUIMousePressed(mc)
- if mc==MOUSE_MIDDLE then
- charCreate.Vars.ReadingZ=true
- oldMouseY=gui.MouseY()
- end
- end
- function charCreate.Hooks.GUIMouseReleased(mc)
- if mc==MOUSE_MIDDLE then
- charCreate.Vars.ReadingZ=false
- oldMouseY=nil
- end
- end
- function charCreate.Hooks.CreateMove(cmd)
- cmd:SetViewAngles(LocalPlayer():GetAngles())
- end
- local bindFunctions={
- ["+forward"]=function()
- return true
- end,
- ["+moveright"]=function()
- return true
- end,
- ["+back"]=function()
- return true
- end,
- ["+moveleft"]=function()
- return true
- end,
- ["+duck"]=function()
- return true
- end,
- ["+attack"]=function()
- return true
- end,
- ["+attack2"]=function()
- return true
- end,
- ["messagemode"]=function()
- return true
- end,
- ["invnext"]=function()
- charCreate.Vars.Zoom=charCreate.Vars.Zoom+30
- print(charCreate.Vars.Zoom)
- -- return true
- end,
- ["invprev"]=function()
- charCreate.Vars.Zoom=charCreate.Vars.Zoom+30
- print(charCreate.Vars.Zoom)
- -- return true
- end
- }
- function charCreate.Hooks.PlayerBindPress(ply, bind, active)
- if bindFunctions[bind] and active and charCreate.Opened then
- return bindFunctions[bind]()
- end
- end
- for f, v in pairs(charCreate.Hooks) do
- hook.Add(f, "char_create_hook", function(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)
- if charCreate.Opened then
- return v(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)
- end
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment