Creating Custom Lightsabers

Creating Custom Lightsabers (Part A)

This addon allows you to create your own lightsabers with different stats, allowing you to have unique gameplay choices (such as high force, low damage, no burn damage, customize abilties, etc.) The steps are very easy and require little lua knowledge.

  • Copy any weapon_lightsaber_*** lua file from the weapons folder
  • Paste it in the same folder and rename it to something unique (EX: weapon_lightsaber_vanguard)
  • Open up the file and edit the items BELOW the dotted line that says "Things you will edit"
  • Save the file, and spawn it in game through the Lightsaber Category under the weapons tab.

The list of options, descriptions, and example of each entry are listed below. Please pay attention to the type of value expected after the entry as well as the presence of any commas, and quotations. The description will explain a little of what it does and the example shows an entry IF you decide to use it.

The options listed below will be moved to Developer Resources->Structures->Lightsaber in the future

Entry: SWEP.PrintName = "STRING"
Description: The name of the weapon in the weapons category/selection
Example: SWEP.PrintName = "The King's Saber"
Entry: SWEP.Class = "STRING"
Description: The file name of this weapon.
Example: If your swep file name is weapon_lightsaber_vanguard.lua then SWEP.Class = "weapon_lightsaber_vanguard"
Entry: SWEP.DualWielded = BOOLEAN
Description: Should this lightsaber be a dual wielded lightsaber?
Example: To make this lightsaber be dual wielded ( one in each hand ), we set SWEP.DualWielded = true
Entry: SWEP.CanMoveWhileAttacking = BOOLEAN
Description: Can you move around while you swing? This is off by default due to the sliding animations while moving. The attacks automatically lunge you to the direction of the attack with this off as well.
Example: To activate this, we set SWEP.CanMoveWhileAttacking = true
Entry: SWEP.SaberDamage = NUMBER
Description: The amount of damage a lightsaber does when a swing hits somebody. Heavy attacks do 1.5x the amount of damage set here.
Example: To do 30 damage, we set SWEP.SaberDamage = 30
Entry: SWEP.SaberBurnDamage = NUMBER
Description: The amount of damage a lightsaber does when it comes in contact with a player when not swinging. This is the damage it does when you run into somebodys blade while they are idle or running.
Example: To do 0 damage and effectively disable it, we set SWEP.SaberBurnDamage = 0
Entry: SWEP.MaxForce = NUMBER
Description: The maximum force energy a user has ( this is that blue bar at the bottom ) Be aware that the percent on the force meter will not change as it is automatically calculated.
Example: To set the Max Force to 200, we set SWEP.MaxForce = 200
Entry: SWEP.RegenSpeed = NUMBER
Description: The regeneration rate of the force energy per tick. This is a multiplier value, so 0.5 would mean half speed, and 2 means double speed.
Example: To regenerate our force at 3 times the speed, we set SWEP.RegenSpeed = 3
Entry: SWEP.CanKnockback = BOOLEAN
Description: If we hit somebody with a lightsaber, should they get knocked back?
Example: To disable knockback, we set SWEP.CanKnockback = false
Entry: SWEP.ShouldStun = BOOLEAN
Description: When we hit somebody with a lightsaber, should they momentarily be stunned ( triggers an invincibility window while they are stunned as well )
Example: To disable stun-on-hit, we set SWEP.ShouldStun = false
Entry: SWEP.BlockDrainRate = NUMBER
Description: How much force energy do we lose per tick when we are holding down the block button ( THIS NUMBER SHOULD ALWAYS BE A SMALL DECIMAL IN RANGE 0.01 - 0.5 ). The formula for calculating ( loss per second ) = NUMBER/TICKRATE
Example: If we want to lose one force per second on a 64 tick server, we set SWEP.BlockDrainRate = 1/64
Entry: SWEP.FirstPerson = BOOLEAN
Description: Should this lightsaber start off as a First Person lightsaber? ( The view may be toggled with the wos_togglefirstperson console command )
Example: If we want the user to be in first person when they first equip the weapon, we set SWEP.FIrstPerson = true
Entry: SWEP.ForcePowerList = { "STRING1", "STRING2", ... }
Description: What force powers should this lightsaber have? For the exact STRING values, see the KEYS in the "lua/wos/advswl/forcepowers/wos_forcematerialbuilding.lua" file. As you keep adding force powers, add a comma at the end!
Example 1: To give this lightsaber Leap, Heal, and lightsaber throwing, we set SWEP.ForcePowerList = { "Force Leap", "Force Heal", "Saber Throw" }
Example 2: To give this lightsaber no force powers, we set SWEP.ForcePowerList = {}
Entry: SWEP.DevestatorList = { "STRING1", "STRING2", ... }
Description: What devestators should this lightsaber have? For the exact STRING values, see the KEYS in the "lua/wos/advswl/devestators/wos_devmaterialbuilding.lua" file. As you keep adding devestators, add a comma at the end! You MUST give them Meditation/Channel Hatred force powers if you want them to be able to use Devestators!
Example 1: To give this lightsaber Kyber Slam, we set SWEP.DevestatorList = { "Kyber Slam" }
Example 2: To give this lightsaber no devestators, we set SWEP.DevestatorList = {}
Entry: SWEP.UseSkills = BOOLEAN
Description: Should this lightsaber inherit properties from the user's Skill Trees?
Example: If we want the user's skills to be applied onto the lightsaber, we set SWEP.UseSkills = true
Entry: SWEP.PersonalLightsaber = BOOLEAN
Description: Should this lightsaber be considered a personal lightsaber and inherit properties from the users crafting bench? ( NOT RECOMMENDED! STICK TO USING THE PERSONAL LIGHTSABER WEAPON )
Example: If we want this weapon to be considered the personal lightsaber of a user, we set SWEP.PersonalLightsaber = true

Creating Custom Lightsabers (Part B)

When you are creating lightsabers you may also choose to overwrite the settings that the user has chosen with the tool gun. This allows you to force a player to use a specific model, color, sound, and etc.

Like in ( Part A ), the entry, description, and examples of the overwriting settings are below. Pay attention to the formatting, the use of any brackets, commas, and etc. Entries with || indicate it will accept either entry.

Entry: SWEP.UseModel = "STRING" || false
Description: Do we overwrite the player's hilt option from the toolgun and use this model instead? Enter the model path to overwrite with, or set to false to use the tool gun option.
Example 1: To force this lightsaber to use Darth Vader's hilt, we set SWEP.UseHilt = "models/sgg/starwars/weapons/w_vader_saber_hilt.mdl"
Example 2: To use the tool gun option, we set SWEP.UseHilt = false
Entry: SWEP.UseLength = NUMBER || false
Description: Do we overwrite the player's length option from the toolgun and use this size instead? Enter the number to overwrite with, or set to false to use the tool gun option.
Example 1: To force this lightsaber to use a length of 42, we set SWEP.UseLength = 42
Example 2: To use the tool gun option, we set SWEP.UseLength = false
Entry: SWEP.UseWidth = NUMBER || false
Description: Do we overwrite the player's width option from the toolgun and use this size instead? Enter the number to overwrite with, or set to false to use the tool gun option.
Example 1: To force this lightsaber to use a width of 6, we set SWEP.UseWidth = 6
Example 2: To use the tool gun option, we set SWEP.UseWidth = false
Entry: SWEP.UseColor = Color( NUMBER_RED, NUMBER_GREEN, NUMBER_BLUE ) || false
Description: Do we overwrite the player's blade color option from the toolgun and use this color instead? Enter the RGB Color values to overwrite with, or set to false to use the tool gun option.
Example 1: To force this lightsaber to use a RED color, we set SWEP.UseColor = Color( 255, 0, 0 )
Example 2: To use the tool gun option, we set SWEP.UseColor = false
Entry: SWEP.UseDarkInner = NUMBER || false
Description: Do we overwrite the player's inner blade option from the toolgun and use this core instead? Enter the number to overwrite with, or set to false to use the tool gun option.
Example 1: To force this lightsaber to use a dark inner blade, we set SWEP.UseDarkInner = 1
Example 2: To force this lightsaber to use a white inner blade, we set SWEP.UseDarkInner = 0
Example 3: To use the tool gun option, we set SWEP.UseDarkInner = false
Entry: SWEP.UseLoopSound = "STRING" || false
Description: Do we overwrite the player's humming sound option from the toolgun and this sound instead? Enter the sound path to overwrite with, or set to false to use the tool gun option.
Example 1: To force it to play kylo ren's humming sound, we set SWEP.UseLoopSound = "lightsaber/kylo_hum.wav"
Example 2: To use the tool gun option, we set SWEP.UseLoopSound = false
Entry: SWEP.UseSwingSound = "STRING" || false
Description: Do we overwrite the player's swinging sound option from the toolgun and this sound instead? Enter the sound path to overwrite with, or set to false to use the tool gun option.
Example 1: To force it to play kylo ren's swinging sound, we set SWEP.UseSwingSound = "lightsaber/kylo_swing.wav"
Example 2: To use the tool gun option, we set SWEP.UseSwingSound = false
Entry: SWEP.UseOnSound = "STRING" || false
Description: Do we overwrite the player's ignition sound option from the toolgun and this sound instead? Enter the sound path to overwrite with, or set to false to use the tool gun option.
Example 1: To force it to play kylo ren's ignition sound, we set SWEP.UseOnSound = "lightsaber/kylo_on.wav"
Example 2: To use the tool gun option, we set SWEP.UseOnSound = false
Entry: SWEP.UseOffSound = "STRING" || false
Description: Do we overwrite the player's extinguish sound option from the toolgun and this sound instead? Enter the sound path to overwrite with, or set to false to use the tool gun option.
Example 1: To force it to play kylo ren's extinguishing sound, we set SWEP.UseOffSound = "lightsaber/kylo_off.wav"
Example 2: To use the tool gun option, we set SWEP.UseOffSound = false
Entry: SWEP.UseSecHilt = "STRING" || false
Description: The same as SWEP.UseHilt, but for the off-hand ( left hand ) lightsaber of a dual wield lightsaber weapon. Does nothing for single lightsaber weapon.
Entry: SWEP.UseSecLength = NUMBER || false
Description: The same as SWEP.UseLengtht, but for the off-hand ( left hand ) lightsaber of a dual wield lightsaber weapon. Does nothing for single lightsaber weapon.
Entry: SWEP.UseWidth = NUMBER || false
Description: The same as SWEP.UseWidth, but for the off-hand ( left hand ) lightsaber of a dual wield lightsaber weapon. Does nothing for single lightsaber weapon.
Entry: SWEP.UseSecColor = Color( NUMBER_RED, NUMBER_GREEN, NUMBER_BLUE ) || false
Description: The same as SWEP.UseColor, but for the off-hand ( left hand ) lightsaber of a dual wield lightsaber weapon. Does nothing for single lightsaber weapon.
Entry: SWEP.UseSecDarkInner = NUMBER || false
Description: The same as SWEP.UseDarkInner, but for the off-hand ( left hand ) lightsaber of a dual wield lightsaber weapon. Does nothing for single lightsaber weapon.

Creating Custom Lightsabers (Part C)

You can also overwrite the form settings in the sh_swlwos file to give a lightsaber a particular set of forms/stances despite the user not being of the appropriate usergroup. This is useful for creating training sabers of particular forms and stances, or separating forms by jobs. I have put this in a separate section so I can show plenty of examples.

Entry: SWEP.UseForms = {
[ "STRING FORM NAME 1" ] = { NUMBER_STANCE1, NUMBER_STANCE2, ... },
[ "STRING FORM NAME 2" ] = { NUMBER_STANCE1, NUMBER_STANCE2, ... },
. . .
}

Description: Do we overwrite the user group settings defined in sh_swlwos.lua and instead make the lightsaber have these forms / stances available? For STRING FORM NAME entries, check the form names in the "lua/wos/advswl/config/sh_swlwos.lua" file. Remember to put a comma after every FORM entry line, and a comma after every STANCE. DUAL WIELD FORMS WILL NOT WORK ON SINGLE LIGHTSABERS AND VISA VERSA! If we want to use the restrictions set in that file, set it to false.



Example 1: If we want to set a lightsaber to have the stance 2 and 3 of the Defensive form, we set the entry as follows:
SWEP.UseForms = {
[ "Defensive" ] = { 2, 3 },
}



Example 2: If we want to set a lightsaber to have all stances of the Defensive form, and stance 1 and 3 of the Aggressive form, we set the entry as follows:
SWEP.UseForms = {
[ "Defensive" ] = { 1, 2, 3 },
[ "Aggressive" ] = { 1, 3 },
}



Example 3: If we want to set a lightsaber to have the stance 1 of Defensive, stance 2 of Aggressive, and stance 3 of Versatile we set the entry as follows:
SWEP.UseForms = {
[ "Defensive" ] = { 1 },
[ "Aggressive" ] = { 2 },
[ "Versatile" ] = { 3 },
}



Example 4: If we want to set a lightsaber to have stance 2 of the Arrogant form ( DUAL WIELD ONLY ) we set the entry as follows:
SWEP.UseForms = {
[ "Arrogant" ] = { 2 },
}



Example 5: If we want to use the restrictions given by the sh_swlwos.lua file, we set
SWEP.UseForms = false

In general you can replace the form string by the name of any form you create, and the stance by whatever stance number you choose.

wikOS powered By wiltOS Technologies