Hey Guys and Girls,
I have a Big Problem.
I want to make a Pointssystem for my Forcepowers for Robotboys lightsaber addon
Every Forcepower is possible to have 3 Stages of the Power Stage 1 lowest DMG Stage 3 Highest Possible Damage.
I Want a DermaPanel where the User can give out Points to Level Up the Stages.
They are 5 Force Option where u can reach Stage 3 but i want that u only can make 3 or 2 Forces on astage 3 and other not. So u have a limited stock of points to give out the reach the stages.
For storing the the Infos i want to use pdata so save it locally in the sv.db and the force powers script should load up the netstring of the points so if Force Power 1 have 3 points it uses the part for stage 3.
here is my code from my forcepowers (without net or pdata)
[CODE]uCg.AvailablePowers = { ["Force Leap"] = {
name = "Force Leap",
icon = "L",
description = "Jump longer and higher.Aim higher to jump higher/further.",
action = function( self )
if ( self:GetForce() < 30 || !self.Owner:IsOnGround() ) then return end
self:SetForce( self:GetForce() - 30 )
self:SetNextAttack( 0.5 )
if self.JumpForce == 1 then
self.Owner:SetVelocity( self.Owner:GetAimVector() * 456 + Vector( 0, 0, 456 ) )
elseif self.JumpForce == 2 then
self.Owner:SetVelocity( self.Owner:GetAimVector() * 712 + Vector( 0, 0, 712 ) )
elseif self.JumpForce == 3 then
self.Owner:SetVelocity( self.Owner:GetAimVector() * 964 + Vector( 0, 0, 964 ) )
else
self.Owner:SetVelocity( self.Owner:GetAimVector() * 256 + Vector( 0, 0, 256 ) )
end
self:PlayWeaponSound( "lightsaber/force_leap.wav" )
// Trigger the jump animation, yay
self:CallOnClient( "ForceJumpAnim", "" )
end
},[/CODE]
self.JumpForce == 1 is the part for the Stages
in the weapon swep there is a option called SWEP:JumpForce = 1
but i want like i explained at the beginning a derma panel where i can set up a limited amount of points.
I just need the functions not the code which i can use.
[QUOTE=Sodak;51988761]Hey Guys and Girls,
I have a Big Problem.
I want to make a Pointssystem for my Forcepowers in my Lightsaber Addon.[/QUOTE]
I wonder how you coded [b]your[/b] entire lightsaber addon but can't figure out how to make a simple derma menu.
Oh i forget its ur i mean the forces. sry i will edit it
Creating a panel is quiet easy. It's just making it look good. And I do say, Robotboy (or Rubat.. I dunno which one you prefer).
Example of a cl_init.lua:
[code]
function OnReceivePanelOpen()
local frame = vgui.Create( "DFrame" )
frame:SetSize( 300, 250 )
frame:Center()
frame:MakePopup()
local DermaButton = vgui.Create( "DButton", frame ) // Create the button and parent it to the frame
DermaButton:SetText( "Say hi" ) // Set the text on the button
DermaButton:SetPos( 25, 50 ) // Set the position on the frame
DermaButton:SetSize( 250, 30 ) // Set the size
DermaButton.DoClick = function() // A custom function run when clicked ( note the . instead of : )
RunConsoleCommand( "say", "Hi" ) // Run the console command "say hi" when you click it ( command, args )
end
end
net.Receive("OpenMyPanel",OnReceivePanelOpen) -- Note: add a util.AddNetworkString("OpenMyPanel") into the init.lua
[/code]
Update: DButton, not Button.. my bad :/
Thanks alot Pixx.. but how is it possible to make a certain amount of points. So that the panel checks if option one uses all points that are able to spend so option 2 can just use 1 more point and so on.
[QUOTE=Sodak;51989019]Thanks alot Pixx.. but how is it possible to make a certain amount of points. So that the panel checks if option one uses all points that are able to spend so option 2 can just use 1 more point and so on.[/QUOTE]
This should work.. not 100 % sure :/
[code]
function YourFrameFunction()
if ( self:GetForce() > 30 || self.Owner:IsOnGround() ) then
-- Code goes here. This should work.. but I am not sure :/
end
end
[/code]
thanks alot the idea is rly good and helpful.
I bought skilltree for a few time ago. and changed the code so it looks like this
[code]
local Skills = {
{ Name = "Lightning", Value = 0, Icon = "ucg/forceicons/lightning_strike.png" },
{ Name = "Jump", Value = 0, Icon = "ucg/forceicons/leap.png"},
{ Name = "Throw", Value = 0, Icon = "ucg/forceicons/throw.png"},
{ Name = "Heal", Value = 0, Icon = "ucg/forceicons/group_heal.png"},
{ Name = "Reflect", Value = 0, Icon = "ucg/forceicons/reflect.png"},
{ Name = "Cloak", Value = 0, Icon = "ucg/forceicons/advanced_cloak.png"},
{ Name = "Rage", Value = 0, Icon = "ucg/forceicons/rage.png"},
}
[/code]
but now i want that if i have in the derma panel the value 3 that my forcepowers check which value i got so if value == 3 then do this like
[code]if self.JumpForce == 1 then
self.Owner:SetVelocity( self.Owner:GetAimVector() * 456 + Vector( 0, 0, 456 ) )
elseif self.JumpForce == 2 then
self.Owner:SetVelocity( self.Owner:GetAimVector() * 712 + Vector( 0, 0, 712 ) )
elseif self.JumpForce == 3 then
self.Owner:SetVelocity( self.Owner:GetAimVector() * 964 + Vector( 0, 0, 964 ) )
else
self.Owner:SetVelocity( self.Owner:GetAimVector() * 256 + Vector( 0, 0, 256 ) )
end[/code]
do. I can make a closed github for the one who would help me
Sorry, you need to Log In to post a reply to this thread.