hard to click on enemies

Got something on your mind about the project? This is the correct place for that.


Forum rules

This forum is for feature requests, content changes additions, anything not a Bug in the software.
Please report all bugs on the Support Forums

Post Reply
Chaaalle
Peon
Peon
Posts: 4
Joined: 16 Aug 2005, 01:38

hard to click on enemies

Post by Chaaalle »

It?s hard sometimes to click on one enemy to attack it?s happens all the time i click and walk forward and got attacked instead i was suppose to klick on the enemie!

please fix it
User avatar
ElvenProgrammer
Founder
Founder
Posts: 2526
Joined: 13 Apr 2004, 19:11
Location: Italy
Contact:

Post by ElvenProgrammer »

We're working on it, anyway you can still press shift to avoid moving toward enemies
xand
Novice
Novice
Posts: 95
Joined: 19 Jul 2005, 18:08

Post by xand »

I had a patch from ados that enabled my to assign a key to "target nearest monster"
but I lost that... :roll:
That worked well, especially when using bow.

I don't think I can reproduce it, but maybe someone else has it or knows if ados will be back ?
User avatar
ElvenProgrammer
Founder
Founder
Posts: 2526
Joined: 13 Apr 2004, 19:11
Location: Italy
Contact:

Post by ElvenProgrammer »

Maybe I have it somewhere, did you take a look at sourceforge patch tracker?
Matt
Grand Knight
Grand Knight
Posts: 1759
Joined: 07 Aug 2004, 10:47
Location: Germany->Bavaria

Post by Matt »

Code: Select all

void select_nearest_enemy()
{
    // Find monster to attack
    std::list<Being*>::iterator i;
    int mindist = INT_MAX;
    Being *minmonster;
    for (i = beings.begin(); i != beings.end(); i++) {
        Being *being = (*i);
        // Check if is a MONSTER that is alive
        int rx, ry;
        if ((being->getType() == Being::MONSTER || being->getType() == Being::PLAYER) && ((being->action == Being::STAND) || (being->action == Being::WALK)))
        {
            int a = (being->x - player_node->x);
            int b = (being->y - player_node->y);
            int curdist = (a*a + b*b);
            if (mindist > curdist && curdist != 0) {
                mindist = curdist;
                minmonster = being;
                //strcat(logstring, tempstring);
                //chatWindow->chat_log(logstring, BY_OTHER);
            }
        }
    }
    // If Monster found
    if (mindist != INT_MAX)
    {
        //char tempstring[100];
        //sprintf(tempstring,"monster found: (%d|%d)", minmonster->x, minmonster->y);
        //chatWindow->chat_log(tempstring, BY_OTHER);
        autoTarget = minmonster;
    }
}
xand
Novice
Novice
Posts: 95
Joined: 19 Jul 2005, 18:08

Post by xand »

Nice :D

But it seems a bit much code... :roll:
xand
Novice
Novice
Posts: 95
Joined: 19 Jul 2005, 18:08

Post by xand »

OK I modified it that one version only targets monsters and the other
one should target players. But it doesn't work....

Note: your version only works for standing/walking players and monsters.
Sitting Players can't be targeted.

that:
if ((being->getType() == Being::PLAYER) && ((being->action == Being::STAND) || (being->action == Being::WALK)))

always targets myself...
Matt
Grand Knight
Grand Knight
Posts: 1759
Joined: 07 Aug 2004, 10:47
Location: Germany->Bavaria

Post by Matt »

if ((being->getType() == Being::PLAYER && being != player_node) && ((being->action == Being::STAND) || (being->action == Being::WALK) || (being->action == Being::SIT)))
xand
Novice
Novice
Posts: 95
Joined: 19 Jul 2005, 18:08

Post by xand »

Thx that works nicely.
I'll try to post my version soon
Post Reply