Author Topic: validatedistance before attack starts?  (Read 1155 times)

picobyte

  • Traveller
  • *
  • Posts: 12
    • View Profile
validatedistance before attack starts?
« on: February 14, 2006, 01:34:43 am »
When you see a monster far away, you can sellect it give the command to attack it. When you do that while running, your running movement stops, while you still move, attack music starts and the monster turns towards you aggressively, neglecting further all (nearer) other attackers. After all this, however your attack stance will be canceled because the target is too far away.

Wouldn\'t it be better if the validation was before all these changes, and canceled the attack beforehand?

I am a bit new to the planeshift code, but I think that in file combatmanager.cpp, function psCombatManager::HandleCombatEvent,

before calling

Client * attacker_client = psserver->GetNetManager()->GetClient(event->AttackerCID);

this could be placed

if ( !ValidateDistance(gemAttacker, gemTarget, weapon) )
{
    psserver->SendSystemError(event->AttackerCID, \"You are too far away to attack.\" );
    return;
}

or am I wrong?
« Last Edit: February 14, 2006, 01:37:42 am by picobyte »


DaveG

  • Forum Addict
  • *
  • Posts: 2058
    • View Profile
(No subject)
« Reply #1 on: February 14, 2006, 02:35:55 am »
Why are you posting this in the Wish List?...  This belongs in the bugs forum.

Yeah, the distance validation is a bit twitchy.

If you go down a bit, you\'ll see:
Code: [Select]
       // If the target is out of range, skip this attack round, send a warning
        if ( !ValidateDistance(gemAttacker, gemTarget, weapon) )
        {
            // Attacker is a npc so does not realise it\'s attack is cancelled
            attack_result=ATTACK_OUTOFRANGE;
        }


Which is then used:
Code: [Select]
       case ATTACK_OUTOFRANGE:
        {
            if (event->AttackerCID)
            {
                psserver->SendSystemError(event->AttackerCID,\"You are too far away to attack!\");
                if (event->attacker && event->attacker.IsValid())
              StopAttack(dynamic_cast(event->attacker->gemobj));  // if you run away, you exit attack mode
            }
            break;
        }


And then:
Code: [Select]
void psCombatManager::StopAttack(gemActor *attacker)
{
    // Sanity check
    if(!attacker || !attacker->IsAlive())
        return;
    attacker->SetMode(PSCHARACTER_MODE_PEACE);
    Debug2(LOG_COMBAT, \"%s stops attacking\", attacker->GetName());
}


So, the distance is checked in there just fine.  I\'ll probably be futzing with this at some point to get rid of that awkward pause, and to make it a bit less twitchy.

::  PlaneShift Team Programmer  ::

Pestilence

  • Hydlaa Notable
  • *
  • Posts: 872
    • View Profile
(No subject)
« Reply #2 on: February 14, 2006, 02:42:46 am »
Well only a bug if that wasnt the intention Dave and although I hope it\'s change I highly doubt it wasn\'t know before implementing it would work this way.

Therefor a wish to have it changed.
« Last Edit: February 14, 2006, 02:43:20 am by Pestilence »

DaveG

  • Forum Addict
  • *
  • Posts: 2058
    • View Profile
(No subject)
« Reply #3 on: February 14, 2006, 06:06:45 am »
Hmm... the twichyness was already fixed in CVS.  You don\'t stop for allot of those things anymore.

There shouldn\'t be any distance checks any earlier, because you are allowed to threaten people from a distance.  It\'s not handled that great, and there are animation glitches here, too, but that\'s another matter.

::  PlaneShift Team Programmer  ::

picobyte

  • Traveller
  • *
  • Posts: 12
    • View Profile
(No subject)
« Reply #4 on: February 14, 2006, 09:44:28 am »
Quote

Why are you posting this in the Wish List?... This belongs in the bugs forum.


Well it could have been, maybe it was the wrong choice. I thought while it bugs me, it may not bug others. As pestilence mentions, it is indeed my wish for it to change.

Quote

There shouldn\'t be any distance checks any earlier, because you are allowed to threaten people from a distance.


To be able to provoke an attack is realistic, but maybe that could be implemented as a seperate command like /provoke or /shout when targetting a monster, also I would like it if it involved more chances, that the creature (dependent on it\'s intelligence and the distance) may or may not take this aggressive stance.

I think right now you have too much power, on a monsters\' behaviour. Also I don\'t like that you are able to distract a monster that is right in front of another\'s players nose and lure it.

When there are bows and arrows, that a hit, possible from a certain distance, does give a high chance to provoke an attack would be logic.

I understand that some of these wishes may require a lot of changes. I\'ll try to look at the code and see whether I can suggest where changes could be made to make it work.
« Last Edit: February 14, 2006, 10:15:11 am by picobyte »


Pestilence

  • Hydlaa Notable
  • *
  • Posts: 872
    • View Profile
(No subject)
« Reply #5 on: February 14, 2006, 11:02:29 am »
Now thats something you don\'t see everyday :)

Thanks for the devotion to go look for yourself picobyte :)

DaveG

  • Forum Addict
  • *
  • Posts: 2058
    • View Profile
(No subject)
« Reply #6 on: February 15, 2006, 11:57:50 am »
Yes, I agree, you have too much control over the rather dumb AI at the point.  I may get around to making the defensive mode on attacked thing less annoying, but by and large no one is working on combat at the moment.  It works, and we\'re trying to focus on other areas now.

::  PlaneShift Team Programmer  ::

Gerbrant

  • Traveller
  • *
  • Posts: 21
    • View Profile
I've also had attack dist troubles
« Reply #7 on: February 16, 2006, 07:05:10 am »
When I accidentally attack a monster from a distance, it first says \"You started an attack\", the monster comes at you, but then it says \"You\'re too far away\" and the attack is called of.

The thing is, the monster will attack, while my avatar is standing passively like a crash test dummy. It gets even better: after this it becomes quite impossible to attack the monster; reselecting it and clicking attack, or changing stances don\'t help.

picobyte

  • Traveller
  • *
  • Posts: 12
    • View Profile
(No subject)
« Reply #8 on: February 20, 2006, 06:54:51 pm »
You can restart the attack when close enough by pressing stop attack and then start attack resp. 5, 4 on my ps. When it is mentioned that you have no target selected, while you have, (a bug) you have to unselect it first, reselect it and do the 5, 4 over. defensive mode (default) also requires to be overridden with 5, 4.

I agree this looks really silly, but it works for me.


Osiri

  • Wayfarer
  • *
  • Posts: 4
    • View Profile
(No subject)
« Reply #9 on: February 23, 2006, 02:28:33 am »
Quick and to the point:  My thoughts are if you want to taunt the monster you should actually use a taunt.  Attacks should be just that.

I also think that until the first blow has been landed if someone else lands a blow the monster will lock onto them instead.  This would prevent any griefing issues.

I\'ve died constant times by attacking a monster that was too far away to actually hit, then the combat bugging and when I get close to the monster having the cancel combat and restart it.

Just my 2 cents.

Osiri

BrotherCaine

  • Traveller
  • *
  • Posts: 41
    • View Profile
(No subject)
« Reply #10 on: February 24, 2006, 01:50:31 am »
I think it\'d be cool if all monsters attacked you when you came within range if they felt like they could take you.  Less artificial than just standing there till you whack at them.  Also, the combat initiator should not automatically get the first blow in.
\"Your rebellion is their marketing scheme.\"

clint8565

  • Hydlaa Resident
  • *
  • Posts: 52
    • View Profile
(No subject)
« Reply #11 on: February 24, 2006, 02:30:46 am »
Quote
Originally posted by BrotherCaine
I think it\'d be cool if all monsters attacked you when you came within range if they felt like they could take you.  Less artificial than just standing there till you whack at them.  Also, the combat initiator should not automatically get the first blow in.


Sometimes they do attack you if you come within range... actually most of the time they do(in the wild I mean) The combat initiator doesn\'t always get the first hit, I\'ve got the first hit in on people/monsters who attacked me, most NPCs are just too slow to hit before you ;)