Evercyan's RPG Kit (V2)

,

This is really cool to see. I had been thinking of building a modern RPG kit myself for some time but I hadn’t gotten around to it. The community needs stuff like this.

1 Like

I’ll check out the kit and if I can find a way to do it I’ll let you know.

Could you tell me what specifically you are trying to do? Like are you trying to make a sword do some sort of sweep or whirlwind attack or are you trying to add an AOE effect to it like a shockwave or ?

2 Likes

Sort of both, at the original time I had a hammer i wanted to add a shockwave to, and a spinning sword i wanted to hit multiple enemies.

However, at this point I would be fine with something that just fixes one of those two things. It will probably depend on which one is more possible.

2 Likes

If you want you can DM me. I’m working on something right now but I’ll try to get to it soon and see what can be done. I dont want to promise too much on code I’ve never seen but it shouldn’t be that difficult.

2 Likes

found a exception occurring in the function Mob:Respawn()
in the line 149 for me where it says
NewMob.Parent = MobsFolder

Exeception message: exception while signaling: Must be a LuaSourceContainer

This only happens in the second time a monster is respawned. The first time it doesn’t appear at all.

Seems like it just a warning but I am trying to fix it for days and with zero success if anyone can help, I would love. Thank you!

3 Likes

Is there anyway to get mobs to use the ranged weapons?

2 Likes

How do you get multiple items, because when getting a drop you can only get it once in your inventory. How do you disable this?

1 Like

Are you trying to get multiple of the Same item?

1 Like

Yeah, I am wondering how you can stack items. For example making a more in depth crafting system where you chop down trees (mobs that dont move basically) and you stack wood to craft swords and stuff. But as of right now you can only stack items to 1.

1 Like

As far as I know, if you have to have it be items,

You can also try and do some magic to clone the item into the player’s backpack, but that won’t save after death.

If we can avoid using items, it’s pretty easy to add a new stat that gets stored, so you could add a Wood stat, but you might have to abandon the in-depth nature of the crafting system for that part.

Similarly, you could have someone sell wood, wood1, wood2, wood3, etc. for the price of 1 wood stat and but might be a little redundant at that point

I’m no true coder, and I haven’t done much overview of anything related, but maybe there is some real way, though you might have to change a lot of code for the item and data storage modules and scripts
But, aside from the issue of how you would even enable it on an enemy, I’m pretty sure the data stores are going to have a problem with multiple items of the same name no matter what you do.

EDIT: Also, check this:

2 Likes

For anyone wanting a quick fix to the awful mob damage system. The original code you could just go up to a mob, take one tick of damage (entering the hitbox) and just stand still (not taking any damage) and kill the mob. The code below is a replacement for the damage the player takes from mobs.

ServerStorage>Modules>MobLib> – Damage

This new code makes it so the player takes the initial tick of damage when entering the hitbox and take damage every second (which can be modified to your needs) after that initial tick.
I am not a great coder so this can be cleaned up or modified.

	-- Damage
	local function OnTouched(BasePart)
		local function DealDamage()
			local Player = Players:GetPlayerFromCharacter(BasePart.Parent)
			local Humanoid = Player and Player.Character:FindFirstChild("Humanoid")

			if Humanoid and Enemy.Health > 0 and not DamageCooldown[Player.UserId] then
				DamageCooldown[Player.UserId] = true
				task.delay(0.5, function()
					DamageCooldown[Player.UserId] = nil
				end)

				Humanoid.Health = math.clamp(Humanoid.Health - MobConfig.Damage, 0, Humanoid.MaxHealth)
				ReplicatedStorage.Remotes.MobDamagedPlayer:FireClient(Player, MobInstance, MobConfig.Damage)
			end
		end

		while wait(1) do
			local hitbox = MobInstance:FindFirstChild("Hitbox")
			if hitbox and hitbox:IsA("BasePart") and hitbox.Touched then
				local parts = (MobInstance:FindFirstChild("Hitbox") :: BasePart):GetTouchingParts()
				local playerFound = false

				for _, part in pairs(parts) do
					local character = part.Parent
					local player = Players:GetPlayerFromCharacter(character)

					if player then
						playerFound = true
						break
					end
				end

				if playerFound then
					DealDamage()
				end
			end
		end
	end
4 Likes

I’m having issues where the starter gear ends up in my inv’ twice.


7 Likes

Nvm fixed it, it was the respawn thing I forgot to disable.

6 Likes

I found this out too. It doesnt save on leaving. Only autosaving works.

2 Likes

Hello, I am wanting to expand the attribute system by adding strength, endurance, dexterity, and so on but currently the kit only supports health, jump power, and walk speed. I was wondering if anyone could lead me into the right direction to add configuration instances to the character? In short I want armor to give these stats and have it multiple weapon damage

Currently the only way that I’ve gotten this to sorta work how I want is to do it through the stat systems (Kill a mob gain a point of strength and so on)

1 Like

You can make AoE.

Modify the calculation of damages to support the player’s stats.
For the stats themselves, I’m gonna assume Evercyan done it like some other more up-to-date RPG kit, you just have to create an attribute “Strength” (…) and use those values.

Shoot me a DM with your communication profile, I’ll lend you a hand tomorrow after work.

1 Like

Well I figured out a way to make a strength NumberValue be created through humanoid attributes system. I also figured out how to update said NumberValue through ArmorLib IE when you equip armor you gain 10 strength. The problem is that I want a weapon to scale off of said strength but the only way to do that is through stats (which are gained through killing mobs as far as I know.)

I tried to create a copy of the attribute “Strength” to the stats in ReplicatedStorage but that wasn’t working and I also tried to modify DamageLib making it so it took the attribute “Strength” from the HumanoidAttriubtes section.

I hope this is making sense if not I can clear it up some more.

Edit: Well I finally got it working. When you equip armor it creates a new stat in this case either strength or wisdom (only ones I’ve created so far). It grabs stat info from itemconfig (armor) and updates pdata stat accordingly. When player unequips armor it deletes the create stats just in case exploits in stuff. Also works with scaling weapon damage as intended. :slight_smile:

1 Like

For anyone wanting to add player stats like old school rpg kits;
In CreateDataFolder under “Stats” (line 85) you add your stats like so ;

local Strength = CreateStat("NumberValue", "Strength", 0, {0})
    Strength.Parent = Stats

Everything automatically save without you doing anything else (thanks chrythm for doing that)

For using stats, for example, Strength in your damage calculation ;

function DamageLib:DamageMob(Player: Player, Mob): number?
    if Mob.isDead then return end
    
    local pData = ReplicatedStorage.PlayerData:FindFirstChild(Player.UserId)
    local Level = pData and pData:FindFirstChild("Stats") and pData.Stats:FindFirstChild("Level")
    local Strength = pData and pData:FindFirstChild("Stats") and pData.Stats:FindFirstChild("Strength")

    if not Level or not Strength or (Level.Value < Mob.Config.Level[2]) then
        return
    end
    
    -- Make sure the equipped tool can be found, so we can safely grab the damage from it.
    -- Never pass damage as a number through a remote, as the client can manipulate this data.
    local Character = Player.Character
    local Tool = Character and Character:FindFirstChildOfClass("Tool")
    local ItemConfig = Tool and Tool:FindFirstChild("ItemConfig") and require(Tool.ItemConfig)
    if not ItemConfig or not ItemConfig.Damage then return end
    
    -- Damage Cooldown
    if DamageCd[Player.UserId] then return end
    DamageCd[Player.UserId] = true
    task.delay(ItemConfig.Cooldown - 0.03, function() -- We subtract just a tad so inconsistencies with timing on the client (ie. time to raycast) is less likely to stop a hit from going through
        DamageCd[Player.UserId] = nil
    end)
    
    -- Calculate damage
    local BaseDamage = typeof(ItemConfig.Damage) == "table" and Random:NextInteger(unpack(ItemConfig.Damage)) or ItemConfig.Damage
    local isCrit = Random:NextInteger(1, 10) == 1
    local Damage = isCrit and BaseDamage * 2 or BaseDamage

    -- Incorporate player's Strength into damage calculation
    Damage = Damage + Strength.Value
    
    self:TagMobForDamage(Player, Mob, Damage)
    Mob.Enemy.Health = math.clamp(Mob.Enemy.Health - Damage, 0, Mob.Enemy.MaxHealth)
    ReplicatedStorage.Remotes.PlayerDamagedMob:FireClient(Player, Mob.Instance, Damage)
    
    return Damage
end

Note that this is an untested code and copying/pasting might not function as you’d expect.

You can later on increase the player’s stats as you see fit in your game (on level up, etc…)

2 Likes

WHAT IS HAPPENING: For some reason I am getting DataManager errors. The errors still occur when installing a new kit. It is happening on two of my games. (One where I didn’t touch anything and the other where I was messing around with armor system.)

WHEN DID IT START OCCURRING: I first duplicated the game so I could have a functioning game and a testing game. (All of this I am doing on the duplicated testing game) It started to occur when I duplicated all of the armor logic and replaced the duplicated armor logics name to “Helm” (Armor —> Helm). I could equip two sets of armor at the same time for a while and worked fine (except for a bug in craftingUI). I took a break, came back and started to get these DataMananger errors.

The errors and code down below are from a freshly installed kit on the non messed with game.

-- Armor
local ArmorFolder = Items:FindFirstChild("Armor")
for _, ItemName in Data.Items.Armor do
	local Armor = ContentLibrary.Armor[ItemName]
	if Armor then
		CreateStat("BoolValue", ItemName).Parent = ArmorFolder
	end
end

14:47:16.487 ServerScriptService.DataManager:133: attempt to iterate over a nil value - Server - DataManager:133
14:47:16.487 Stack Begin - Studio
14:47:16.487 Script ‘ServerScriptService.DataManager’, Line 133 - function UnloadData - Studio - DataManager:133
14:47:16.487 Script ‘ServerScriptService.DataManager’, Line 356 - function OnPlayerAdded - Studio - DataManager:356
14:47:16.487 Stack End - Studio

The code line 133 points to this section.

THIS NEXT SECTION IS THE PLACE/GAME WHERE I WAS MESSING AROUND WITH THE ARMOR SYSTEM.

-- Helm
local HelmFolder = Items:FindFirstChild("Helm")
for _, ItemName in Data.Items.Helm do
	local Helm = ContentLibrary.Helm[ItemName]
	if Helm then
	CreateStat("BoolValue", ItemName).Parent = HelmFolder
	end
end

-- Armor
local ArmorFolder = Items:FindFirstChild("Armor")
for _, ItemName in Data.Items.Armor do
	local Armor = ContentLibrary.Armor[ItemName]
	if Armor then
		CreateStat("BoolValue", ItemName).Parent = ArmorFolder
	end
end

14:56:25.715 ServerScriptService.DataManager:167: attempt to iterate over a nil value - Server - DataManager:167
14:56:25.715 Stack Begin - Studio
14:56:25.715 Script ‘ServerScriptService.DataManager’, Line 167 - function UnloadData - Studio - DataManager:167
14:56:25.715 Script ‘ServerScriptService.DataManager’, Line 406 - function OnPlayerAdded - Studio - DataManager:406
14:56:25.715 Stack End - Studio

Line 167 points to this section.

EDIT: It has to be some sort of corruption or something. I publish it to a new game and I don’t get errors? I am sure eventually the datamanager errors will prop back up which then I would have to publish it to a new game. It is like the whole game gets corrupted (only if there was a way to reset data stores I could do more testing on this.)

EDIT 2: I figured it out.

(pData:FindFirstChild("ActiveShoulders") :: StringValue).Value = Data.ActiveShoulders;

Changed this line of code under " – Preferences / Misc" to the code down below and it fixed my problems.

local ActiveShouldersValue = pData:FindFirstChild("ActiveShoulders") :: StringValue
if ActiveShouldersValue and Data.ActiveShoulders then
	ActiveShouldersValue.Value = Data.ActiveShoulders
end
3 Likes


Green = HealRange, Grey = AttackRange, Black = MobHitBox

Does anyone know where the mob is creating its hitbox? As of right now the whole model is a hitbox for the player to hit but the “Hitbox (original)” is the attack hit for the mob (step inside deals damage to you).

I am wanting to make separate hit boxes (MobHitBox: If tool touches this it deals damage), (AttackRange: If player enters this it deals damage to them), and (HealRange: When other mobs in here it heals them)

Down below is an example. I added a part inside the mob off to the side. I don’t want this part to be apart of the hitbox of the mob. Touching the part with a tool damages the mob which I don’t want. Also entering the part doesn’t make the mob deal damage to the player. Which I do want it to do. (hope all of this makes sense)

Video Example

SOLVED :smiley:

2 Likes