What if there was a script that allowed a player to hit other players while holding the block. It would be low damage like 5 hp or something.
Is it possible?
Block Punch!!
-
danhezee
Former Admin / Co-founder
- Posts: 1710
- Joined: Wed Oct 03, 2012 12:09 am
-
Vengeance
Deuced Up - Posts: 350
- Joined: Mon May 06, 2013 12:07 pm
I don't exaclty know if it is possible, but it is a pretty cool idea. Then you could defend yourself while holding a block. Maybe it can work, but does it?
-
learn_more
Coder
- Posts: 891
- Joined: Sun Mar 24, 2013 9:59 pm
how do you want to differentiate between placing a block and hitting a player?
-
Kuma
Scripter
- Posts: 758
- Joined: Fri Mar 22, 2013 10:05 am
not really possible, because you can only place the block... (maybe i am wrong)
-
VladVP
Post Demon
- Posts: 1425
- Joined: Fri Dec 14, 2012 10:48 pm
This challenge requires two things to be resolved first:
- Detecting a mouse click.
- Detecting which player (if there is one at all) is in front of the player who clicked.
It's a Christmas miracle!
-
Kuma
Scripter
- Posts: 758
- Joined: Fri Mar 22, 2013 10:05 am
VladVP wrote:This challenge requires two things to be resolved first:Well, How can we differentiate between a block place and block punch (If you you say if the block is attempted to be placed in the air it means its a punch it wrong and what will happen if the player is looking down?)Number 2 should definitely be doable, but I don't know about how we should go about managing to do number 1.
- Detecting a mouse click.
- Detecting which player (if there is one at all) is in front of the player who clicked.
-
Jdrew
Mapper
- Posts: 4808
- Joined: Tue Oct 30, 2012 10:48 pm
How would you punch someone? What if you just like run into them and it hits them?
-
Kuma
Scripter
- Posts: 758
- Joined: Fri Mar 22, 2013 10:05 am
jdrew wrote:How would you punch someone? What if you just like run into them and it hits them?Vlad said about clicking while looking at other player
-
Jdrew
Mapper
- Posts: 4808
- Joined: Tue Oct 30, 2012 10:48 pm
And that is possible?
-
VladVP
Post Demon
- Posts: 1425
- Joined: Fri Dec 14, 2012 10:48 pm
jdrew wrote:And that is possible?It should be, as the client probably sends a lot of weird and useless things to the server. Unfortunately, I've never seen anything in the pyspades API which could help detect a mouse click. (Apart from on_hit() and on_block_destroy(), but that's not really useful in this conjunction, is it?)
It's a Christmas miracle!
-
Dr.Morphman
Scripter
- Posts: 73
- Joined: Sun Feb 24, 2013 9:55 am
yeah it is all about finding a suitable hook, once you find one it is going to be easy
here is a suggestion from my side using on_orientation_update() as hook:
hooks that may be suitable in my opinion as well: on_walk_update, on_animation_update, on_tool_changed
here is a suggestion from my side using on_orientation_update() as hook:
Code: Select all
im not realy in the mood today to create a whole script but this draft here was already working when i tested it, just replace the hook with whatever one you want and its basicaly done, (on_shoot_set() does not work with blocks for some reason therefore i assume you canot attack people by simply clicking the mouse while holding a block [except you actualy place the block somewhere, but look at block_kill.py for that])from commands import name, add, admin, alias
from pyspades.constants import BLOCK_TOOL
from pyspades.server import *
from pyspades.collision import vector_collision, distance_3d_vector
def apply_script(protocol, connection, config):
class blockpunchconnection(connection):
def on_orientation_update(self, x, y, z):
if self.tool == BLOCK_TOOL:
for babydonthurtme in self.protocol.players.values():
if distance_3d_vector(self.world_object.position, babydonthurtme.world_object.position) <= 3:
if self.world_object.validate_hit(babydonthurtme.world_object, MELEE, 2) and self != babydonthurtme:
babydonthurtme.hit(5, self, MELEE_KILL)
return protocol, blockpunchconnection
hooks that may be suitable in my opinion as well: on_walk_update, on_animation_update, on_tool_changed
-
Kuma
Scripter
- Posts: 758
- Joined: Fri Mar 22, 2013 10:05 am
That could work, But how about we use on_block_build_attempt() and the users must have block punch on using a command after that when they try to place a block on someone they get hit but we return False so the block doesn't get place?
on_block_build_attempt(self, x, y, z):
on_block_build_attempt(self, x, y, z):
-
Dr.Morphman
Scripter
- Posts: 73
- Joined: Sun Feb 24, 2013 9:55 am
as vlad said before you canot find anything detecting clicks (except on_shoot_set which does not work with blocks) so on_block_build_attempt would require you to actualy place a block on the ground but i have written something like that before
the code i posted should be sufficient all you need to do now is find a suitable hook and adjust it
the code i posted should be sufficient all you need to do now is find a suitable hook and adjust it
Who is online
Users browsing this forum: No registered users and 9 guests


