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

Anti-Camp plugin question #36

Open
rniebecker opened this issue Mar 18, 2016 · 3 comments
Open

Anti-Camp plugin question #36

rniebecker opened this issue Mar 18, 2016 · 3 comments

Comments

@rniebecker
Copy link

I'm working on an anti-camp plugin by tracking the position of the players. Works good so far, only problem is that as punishment I want to kill the camping player but I could not find a way of doing that without side effects in FreezeTag.

Using slay/slap commands let the player immediately respawn instead of freezing them. The only thing killing and freezing the player is:
minqlx.client_command(player.id, "kill")
but that has a nasty side effect, a lot of the time the then frozen players can run around and shoot other players, which is funny to watch but not really what I would like to have.

Here is a video of me running around frozen:
https://www.youtube.com/watch?v=coIJxsoany4

I guess the problem is that the kill command needs to be synched with the game logic but I don't know how to achieve that.

Any help would be appreciated.

Cheers,
niewi

@dsverdlo
Copy link

As Mino would say: 'game logic should never be done in a thread'.
You should refactor the game logic to a function that is decorated by @minqlx.next_frame, for example:

def foo(self):
    ...
    @minqlx.next_frame
    def logic():
        minqlx.client_command(player.id, "kill")
    logic()
    ...

@rniebecker
Copy link
Author

And he is 100% right. I'm new to python, I'm a assembler/c/java coder and I actually coded some games myself. :)

I've added the next_frame annotation and will do some testing today.

Cheers & Thanks,
niewi

@rniebecker
Copy link
Author

I tested my script yesterday and it works great. Just working on tweaking the logic now, not easy to do a proper anti-camp. :)

I have another question, is there a way of detecting if a player is currently swimming in water? Because movement is slower in water I need to use different values in that case.

Cheers,
niewi

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

2 participants