Closed lnpro34 closed 1 day ago
I'll be honest with you, to use an AI for things with code you have to know how to program anyway, you can't just come and copy the code and put it here to tell you if it's okay
I don't know too, I have to try to answer it, and I don't want to try.
Creating a grab with combo system in a game developed with Unity using the MMORPG Kit and Dev Extensions without modifying the core is a challenging but feasible task. Here's a detailed step-by-step guide to implementing this functionality:
Allow a player to perform a grab on another player. Immobilize the target player during the grab. Enable the attacker to execute a skill combo while the target is immobilized. For this, you’ll need:
A trigger to initiate the grab (e.g., via a skill or command). Player states (attacker and target) to control actions during the grab. Movement restriction for the target during the grab. A synchronization system to ensure proper server-client behavior (essential for MMORPGs).
Step 1: Add a New State for Grab Create a new script named PlayerGrabState. This state will handle immobilizing the target and allowing combos from the attacker. Example:
csharp Copiar código using UnityEngine;
public class PlayerGrabState : BaseCharacterState { public override void EnterState() { // Immobilize the target owner.SetCanMove(false); owner.SetCanAttack(false); Debug.Log($"{owner.CharacterName} has been grabbed!"); }
} Step 2: Create the Grab Skill In the MMORPG Kit, skills are managed by Skill Scripts. You can create a new skill that applies the grab state.
Create a new script named GrabSkill. Extend BaseSkill to define the behavior of the grab skill. Example:
csharp Copiar código using UnityEngine;
public class GrabSkill : BaseSkill { public override void ApplySkillEffect(BaseCharacterEntity attacker, BaseCharacterEntity target) { if (target != null) { // Apply the grab state to the target target.SetState(new PlayerGrabState());
} Configure the skill in the MMORPG Kit interface (set cooldown, mana cost, etc.).
Step 1: Combo System Create a script GrabComboManager to handle combos during the grab. Use the attacker’s state to check if they’re in the middle of a combo. Example:
csharp Copiar código using UnityEngine;
public class GrabComboManager : MonoBehaviour { private int comboStep = 0; private float comboTimer = 0f; private const float maxComboTime = 2f;
} Step 2: Integrate Combo with Grab During the grab state, allow the attacker to execute skills that advance the combo. Use a reference to the GrabComboManager on the attacker.
The grab state is synchronized using network events (Rpc or Cmd). The movement and attack restrictions on the target are applied on the server to prevent exploits. Example of synchronization:
csharp Copiar código [Command] void CmdApplyGrabEffect(string targetId) { var target = FindPlayerById(targetId); if (target != null) { target.SetState(new PlayerGrabState()); RpcNotifyGrabEffect(targetId); } }
[ClientRpc] void RpcNotifyGrabEffect(string targetId) { var target = FindPlayerById(targetId); if (target != null) { target.SetState(new PlayerGrabState()); } }
With these steps, you can implement a grab and combo system in the MMORPG Kit using Dev Extensions without modifying the core.
this info from gpt is valid?