- Joined
- Oct 10, 2017
- Messages
- 359
Hello, Community.
I was after this some time ago. I always thought the current combat system was bad for my opinion, not real. So now i began to check.
I always thought the melee combat was strange since you could attack from at least 15 meters away. So, i made some bit changes to get a normalization to melee attacks, excluding the lightsaber attacks (for forced PvP).
These changes include a checking for ranged weapons and the max distance for melee weapons is 4 meters away from the target. This quantity can be changed but i think it's the best realistic and moderate version.
>> Test Video: https://streamable.com/bh49w2
They are in "/src/server/zone/objects/creature/commands/AttackCommand.h".
*** It had a bug attacking with melee against debris or another destructible object. It froze the server...
I tested on the tutorial mission and the problem was fixed, at least for now. The new code was added.
Code:
The next part is to change the range value from every melee attack (1handled, 2handled, polearm and unarmed, even lightsaber attacks if you wish - i didn't do) to 5 , leaving the area ones to 6 in "bin/scripts/commands/" directory.
Also change the "Lunge" attacks from 20 meters to 15.
These are the best corrections from my point of view.
* After all these changes you will need to re-build your server.
Greetings and i hope this help someone.
I was after this some time ago. I always thought the current combat system was bad for my opinion, not real. So now i began to check.
I always thought the melee combat was strange since you could attack from at least 15 meters away. So, i made some bit changes to get a normalization to melee attacks, excluding the lightsaber attacks (for forced PvP).
These changes include a checking for ranged weapons and the max distance for melee weapons is 4 meters away from the target. This quantity can be changed but i think it's the best realistic and moderate version.
>> Test Video: https://streamable.com/bh49w2
They are in "/src/server/zone/objects/creature/commands/AttackCommand.h".
*** It had a bug attacking with melee against debris or another destructible object. It froze the server...
I tested on the tutorial mission and the problem was fixed, at least for now. The new code was added.
Code:
C++:
/*
Copyright <SWGEmu>
See file COPYING for copying conditions.*/
#ifndef ATTACKCOMMAND_H_
#define ATTACKCOMMAND_H_
#include "CombatQueueCommand.h"
class AttackCommand : public CombatQueueCommand {
public:
AttackCommand(const String& name, ZoneProcessServer* server)
: CombatQueueCommand(name, server) {
}
int doQueueCommand(CreatureObject* creature, const uint64& target, const UnicodeString& arguments) const {
if (!checkStateMask(creature))
return INVALIDSTATE;
if (!checkInvalidLocomotions(creature))
return INVALIDLOCOMOTION;
/// No range restriction for Melee Weapons
ManagedReference<WeaponObject*> weapon = creature->getWeapon();
if (weapon->isMeleeWeapon()) {
ManagedReference<SceneObject*> targetObject = server->getZoneServer()->getObject(target);
Creature* targetCreature = cast<Creature*>(targetObject.get());
if (targetObject == NULL)
return GENERALERROR;
if (!targetObject->isCreatureObject()) {
if (targetObject->getDistanceTo(creature) < 4.f) {
return doCombatAction(creature, target);
}
return GENERALERROR;
}
if (targetObject->isCreatureObject()) {
if (targetObject->getDistanceTo(creature) <= 4.f) {
return doCombatAction(creature, target);
}
return GENERALERROR;
}
}
////
return doCombatAction(creature, target); //// Ranged Weapon for default.
}
};
#endif //ATTACKCOMMAND_H_
The next part is to change the range value from every melee attack (1handled, 2handled, polearm and unarmed, even lightsaber attacks if you wish - i didn't do) to 5 , leaving the area ones to 6 in "bin/scripts/commands/" directory.
Also change the "Lunge" attacks from 20 meters to 15.
These are the best corrections from my point of view.
* After all these changes you will need to re-build your server.
Greetings and i hope this help someone.
Last edited: