[Pogamut-list] Feedback, Things that don't work properly and things that should be included

aisa87 pogamut-forum at diana.ms.mff.cuni.cz
Thu Apr 14 13:58:05 CEST 2011


Re: Feedback, Things that don't work properly and things that should be included

Author: aisa87

I've made a listener for the shock-combo, but it doesn't make the combo blow.. it actually doesn't shoot most of the times. I tried the following:

* In the logic block

        if (players.canSeeEnemies()) {
            // If you don't have the shock rifle equiped, then do it!
            if (!weaponry.getCurrentWeapon().getType().equals(ItemType.SHOCK_RIFLE)) {
                weaponry.changeWeapon(ItemType.SHOCK_RIFLE);
            }

            // Throw a shock ball to your nearest enemy
            shoot.shootSecondary(players.getNearestVisibleEnemy());
        }
        else {
            shoot.stopShooting ();
        }

* Listener code

    @ObjectClassEventListener(eventClass = WorldObjectUpdatedEvent.class, objectClass = IncomingProjectile.class)
    protected void shockCombo(WorldObjectUpdatedEvent event) {
        IncomingProjectile shockBall = event.getObject();

        if (players.canSeeEnemies()) {
            // If distance from ball-shock to enemy is lower than 800 then hit the ball
            if (players.getNearestVisibleEnemy().getLocation().getDistance(shockBall.getLocation()) < 800) {
                shoot.shootPrimary(shockBall.getId());
            }
        }
    }

I tried putting some global messages inside the part where the bot is supposed to shoot the ball (to see if it was a problem with the distance function), and I get the message correctly, the problem is, he almost never shoots.

-- 
Reply Link: <http://diana.ms.mff.cuni.cz/main/tiki-view_forum_thread.php?forumId=4&comments_reply_threadId=4&comments_parentId=646&post_reply=1#form>





More information about the Pogamut-list mailing list