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, 02:38

hard to click on enemies

Post by Chaaalle » 16 Aug 2005, 02:42

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
TMW Adviser
TMW Adviser
Posts: 2526
Joined: 13 Apr 2004, 20:11
Location: Italy
Contact:

Post by ElvenProgrammer » 16 Aug 2005, 09:03

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

Post by xand » 10 Sep 2005, 02:07

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
TMW Adviser
TMW Adviser
Posts: 2526
Joined: 13 Apr 2004, 20:11
Location: Italy
Contact:

Post by ElvenProgrammer » 10 Sep 2005, 07:21

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

Post by Matt » 10 Sep 2005, 10:54

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
Peon
Peon
Posts: 95
Joined: 19 Jul 2005, 19:08

Post by xand » 10 Sep 2005, 11:55

Nice :D

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

Post by xand » 03 Oct 2005, 22:51

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
Knight
Knight
Posts: 1747
Joined: 07 Aug 2004, 11:47
Location: Germany->Bavaria

Post by Matt » 04 Oct 2005, 15:34

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

Post by xand » 04 Oct 2005, 20:20

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