Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attack attribute broken in style #148

Open
SavagingSky opened this issue Apr 7, 2023 · 8 comments
Open

Attack attribute broken in style #148

SavagingSky opened this issue Apr 7, 2023 · 8 comments

Comments

@SavagingSky
Copy link

It seems that the attack attribute in style.txt is broken. When specyfying custom attack sounds for a unit, that is when an enemy is seen, not when the attack launches, they don't play.
I tried:
attack 15001 15002
attack if_me 15001 else 15002
attack 15001
but never got any sound from the unit when encountering enemies. This is 1.3.6.

@SavagingSky
Copy link
Author

It seems I know the solution. I tested on 1.2 a9, it works. Then I compared two branches. Seems in worldunit in choose_enemy function, previously, when setting action to attack_action there was notify(attack), now it's gone.

@soundmud
Copy link
Owner

soundmud commented Apr 7, 2023

Yes, thanks for the report and sorry for the trouble. I removed this notification because if there was many units it could be too much, and maybe it was slowing down the game. But this notification was useful and gave character to the units, so maybe just limiting the number of notifications would be better.

@SavagingSky
Copy link
Author

SavagingSky commented Apr 7, 2023 via email

@soundmud
Copy link
Owner

soundmud commented Apr 7, 2023

I'll try to restore it. Here is a first step:

In worldunit.py replace:

        self.action = AttackAction(self, reachable_enemies[0])

with:

        # don't notify or attack if already attacking the same target
        # (at the moment, this test is necessary if the target is not a menace, for example a farm)
        if not isinstance(self.action, AttackAction) or self.action.target != reachable_enemies[0]:
            self.action = AttackAction(self, reachable_enemies[0])
            self.notify("attack")
        return True

@SavagingSky
Copy link
Author

The most sad thing is i'm not a python programmer, heh. I don't have anything python related on my computer. I have a hard time with python in general, so yeah.

@soundmud
Copy link
Owner

soundmud commented Apr 7, 2023

don't worry, this change will be included in the next version

@sanslash332
Copy link

sanslash332 commented Apr 8, 2023 via email

@soundmud
Copy link
Owner

soundmud commented Apr 8, 2023

yes, this kind of mechanism will be necessary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants