[2.0] WCS - A combat system framework

alright thank u so much!, a suggestion, you should add a method to get the time left on a cooldown to be used again

1 Like

and a custom inventory hotbar showing it would be killer 2.0!

:sparkles:Refx

2 Likes

Sorry for bothering you again, but I was wondering how you would do a damage buff status effect. I vaguely understand the :HandleDamage() function, just I don’t really get how you would handle outgoing damage rather than incoming.

you can’t edit outgoing damage, handle this inside a status effect of your enemy to increase incoming damage

1 Like

Just sharing a bit of my progress with the framework:



This uses both WCS and refx btw.

5 Likes

Are you using another framework to organize your scripts and localscripts?, if so, can you tell me which one?, and how did you make the cooldown time left visual thingy? would help me a lot

Also, that looks sick as hell, keep it up

1 Like

Firstly, no I’m not using any framework for organization, I just have a lot of folders in replicated storage properly labeled:

image

And since the framework lets you handle most things within the constructors, I don’t have that many local scripts in the first place.

And the cooldown timer on the buttons is pretty simple, just a while loop that does task.wait(1) every second and changes the text label to fit the current time.

1 Like

Okay, thank you, one last question, are you using your own hitbox? or using the damageContainer function from the api?

The damageContainer function has nothing to do with actual hitboxes, its just a way to handle damage with the framework. So no, I’m using my own hitboxes

1 Like

This looks fire :fire: Keep up the work!

2 Likes

Hey, i use the On Moveset changed, is it a function?, because when i do Character.MovesetChanged:Connect(function(newmoveset, oldmoveset) on the client, it doesn’t works

possibly doesn’t fire first time, running the callback for :GetMovesetName(), nil

1 Like

error

Players.SanJoseYTXD.PlayerScripts.ClientInitializer:72: attempt to index nil with ‘Connect’ - Client - ClientInitializer:72
18:29:44.072 Stack Begin - Studio
18:29:44.072 Script ‘Players.SanJoseYTXD.PlayerScripts.ClientInitializer’, Line 72 - Studio - ClientInitializer:72
18:29:44.072 Stack End - Studio

Can’t tell whats wrong without seeing your code

Nevermind, i got it fixced, anyways, i found another error, there’s no message printed on the console

here’s my modules

clientHandler Module :sweat_smile:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local modules = ReplicatedStorage:WaitForChild("modules")
local WCS = require(modules:WaitForChild("wcs"))
local Skills = ReplicatedStorage:WaitForChild("skills")
local skillsFolder = ReplicatedStorage:WaitForChild("skills")

local HakariFolder = Skills:WaitForChild("hakari")
local localfolder = HakariFolder:WaitForChild("local")
local uisFolder = HakariFolder:WaitForChild("uis")
local hakari_clientUI = uisFolder:WaitForChild("hakari_client")

local handle_client = WCS.RegisterSkill("ClientHandler")
local players = game:GetService("Players")

local localPlayer = players.LocalPlayer
local Character = WCS.Character

local UserInputService = game:GetService("UserInputService")

function handle_client:getCurrentWCS_Character()

	local characterModel = localPlayer.Character
	if not characterModel then return end

	return Character.GetCharacterFromInstance(characterModel)

end



function handle_client:OnConstructClient()
	print("Hi, client handler constructed on client ")
	
	-- get some skills hakari // --

	self.getlightcombat = self.Character:GetSkillFromString("lightcombat")
	
	
	
	-- ///// common variables
	
	local player = self.Player
	local character = player.Character
	
	-- /////
	
	--self.Destroyed:Connect(function()
	--	self.Theme:Stop()
		--self.cloneHakariUI:Destroy()
	--end)
	
	-- // self. variables
	
	self.cloneHakariUI = hakari_clientUI:Clone()
	self.cloneHakariUI.Parent = player.PlayerGui
		
	self.Theme = self.cloneHakariUI:WaitForChild("jackpot")
	self.Theme.Looped = true
	self.Theme:Play()
	
	-- ///////
	
	
	-- charactersSkillsModules.lua --

	-- ///////////

	-- moveset table --

	local movesetNames = {

		[1] = {
			movesetName = "hakari",
			skillsNames = {
				"lightcombat",
			}
		},
	}

	local WCS_Char = self.getCurrentWCS_Character()

	-- // hakari  // --

	-- dw


	local hakariMoveSetTable = movesetNames[1]
	local hakariMoveSetName = hakariMoveSetTable.movesetName
	local hakariMoveSetSkills = hakariMoveSetTable.skillsNames

	local lightcombatName = hakariMoveSetSkills[1]


	UserInputService.InputBegan:Connect(function(Input, GameProcessed)
		if GameProcessed then return end
		if Input.UserInputState ~= Enum.UserInputState.Begin then return end


		if Input.UserInputType == Enum.UserInputType.MouseButton1 then
			local character = self.getCurrentWCS_Character()
			if not character then return end

			if character:GetMoveset(hakariMoveSetName) then
				for _, skillsnames in pairs(hakariMoveSetSkills) do
					if skillsnames then
						if character:GetSkillFromConstructor(lightcombatName) then 
							self.getlightcombat:Start()
						else
							warn("no lightcombat for ".. localPlayer:GetFullName())
						end
					end
				end
			else
				warn("no moveset named ".. tostring(hakariMoveSetName) .. " for ".. localPlayer:GetFullName())
			end
		end

	end)
	
	
	--print(self.getlightcombat:GetCooldownTimeLeft())
	--print(self.getlightcombat:getstate())
	
	
	
end

function handle_client:HandleServerMessage(message)
	if message == "disableTheme" then
		warn("DISABLED THEME WOWOWWWWW")
	end
end


return handle_client

ServerHandler Module :

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local modules = ReplicatedStorage:WaitForChild("modules")
local WCS = require(modules:WaitForChild("wcs"))
local Skills = ReplicatedStorage:WaitForChild("skills")
local skillsFolder = ReplicatedStorage:WaitForChild("skills")

local HakariFolder = Skills:WaitForChild("hakari")
local localfolder = HakariFolder:WaitForChild("local")
local uisFolder = HakariFolder:WaitForChild("uis")
local hakari_clientUI = uisFolder:WaitForChild("hakari_client")

local handle_server = WCS.RegisterSkill("ServerHandler")

local players = game:GetService("Players")

local Character = WCS.Character



function handle_server:OnConstructServer()
	print("Hi, server handler constructed on server ")	
	
	local player = self.Player
	local charactermodel = player.Character
	local Humanoid = charactermodel:WaitForChild("Humanoid") or charactermodel:FindFirstChildWhichIsA("Humanoid")
	task.wait(.1)
	if Humanoid then
		warn("got hum")
		Humanoid.Died:Once(function()
			warn("send")
			self:SendMessageToClient("disableTheme")
		end)
	end
	
	
	
end

function handle_server:HandleClientMessage(type_)
	if type_ == "nil" then
		warn("wowwwwwwwwwww")
	end
end



return handle_server

The bug here is that it doesn’t fires when i send the “disableTheme” message to the client, why?

specifics parts :

if Humanoid then
		warn("got hum")
		Humanoid.Died:Once(function()
			warn("send")
			self:SendMessageToClient("disableTheme")
		end)
	end

function handle_client:HandleServerMessage(message)
	if message == "disableTheme" then
		warn("DISABLED THEME WOWOWWWWW")
	end
end

this is how i organized my things :

image

those shouldn’t be skills at all

1 Like

yeahh, i am still searching for a good way of handling this, but since your module provides all of these, it comes in handy to me, But this normally would work, even if it’s a skill , right?

right now everything works (i am surprised it does, honestly) , but doesn’t sends the message

Alright so, i did some prints and found this, don’t know if it has something to do but anyways

image

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local modules = ReplicatedStorage:WaitForChild("modules")
local WCS = require(modules:WaitForChild("wcs"))
local Skills = ReplicatedStorage:WaitForChild("skills")

local handle_server = WCS.RegisterSkill("ServerHandler")

local players = game:GetService("Players")

local Character = WCS.Character



function handle_server:OnConstructServer()
	print("Hi, server handler constructed on server ")	
	
	local player = self.Player
	local charactermodel = player.Character
	local Humanoid = charactermodel:WaitForChild("Humanoid") or charactermodel:FindFirstChildWhichIsA("Humanoid")
		
	self.getclienthandler = self.Character:GetSkillFromString("ClientHandler")
	self.player = self.Player
	self.charactermodel = self.Player.Character
	self.Humanoid = self.charactermodel:WaitForChild("Humanoid") or charactermodel:FindFirstChildWhichIsA("Humanoid")
	
	task.wait(.1)
	
	if Humanoid then
		warn("got hum")
		Humanoid.Died:Once(function()
			warn("send")
		
		
			self:SendMessageToClient("disableTheme")
			print(self.getclienthandler)
			print(self)
			
		end)
	end
	
	
	
end

function handle_server:OnStartServer()
	print("Hi, server handler started on server ")
	

end
 
--function handle_server:HandleClientMessage(type_)
	--if type_ == "nil" then
	--	warn("wowwwwwwwwwww")
	--end
--end



return handle_server

this isn’t something should be stored in a skill.
wcs covers only the combat system, not your whole game