Hey,
I'm currently trying to find out, how I can reproduce the trigger_push entity.
My idea is, to create a clean trigger and make it useable for all in one, like teleport, gravity, push, etc, but I'm stuck on the push part.
The first approach I did was, that I simply set the base velocity to the boost vector on start touch. (push dir with speed/length) But i have to adjust it on top of the normal player base velocity.
But the trigger_push behaves like, it constantly pushes you until you leave the trigger.
If i would do that every tick, i would most likely leave the zone with like 100.000 u/s, lol.
Do you guys have any idea? It works for the very first tick, but after I have to somehow filter the real-player-base-velocity next to boosted vector. (So the player can also strafe and is not limited) I tried to look it up on valve's source but I couldnt find anything how they add that speed.
Reproduce trigger_push
Re: Reproduce trigger_push
This is how it's done in the SDK:
https://github.com/ValveSoftware/source ... 2208-L2299
https://github.com/ValveSoftware/source ... 2208-L2299
Re: Reproduce trigger_push
Hey,
Thanks.
I tried to convert it somehow to source.python, and this is my work so far:
I sadly cant test it, and wish someone could and tell me, if it works and what I've forgot.
Thanks
Thanks.
I tried to convert it somehow to source.python, and this is my work so far:
Syntax: Select all
from listeners import OnPlayerRunCommand
from entities.constants import EntityStates
from entities.constants import MoveType
from players.constants import PlayerStates
from mathlib import Vector
@OnPlayerRunCommand
def on_player_run_command(player, user_cmd):
# Push Angle = 0 180 0
# Push Speed = 1500
# Get Push Vector
push_vector = Vector(0, 180, 0)
push_vector.length = 1500
# Get Origin
origin = player.origin
# Get Base Velocity Flag
on_ground_flag = player.flags & PlayerStates.ONGROUND
base_velocity_flag = player.flags & EntityStates.BASEVELOCITY
if base_velocity_flag:
# Apply Base Velocity
push_vector += player.base_velocity
if push_vector.z > 0 and on_ground_flag:
# Set Move Type
player.move_type = MoveType.NONE
# Adjust Origin
origin.z += 1
# Set Base Velocity
player.base_velocity = push_vector
# Add Flag (NOT SURE?)
player.flags &= EntityStates.BASEVELOCITY
I sadly cant test it, and wish someone could and tell me, if it works and what I've forgot.
Thanks
Return to “Plugin Development Support”
Who is online
Users browsing this forum: No registered users and 76 guests