Raised This Month: $ Target: $400
 0% 

Changing velocity_by_aim to work like...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 09-03-2011 , 17:42   Changing velocity_by_aim to work like...
Reply With Quote #1

Sorry for the stupid thread name but I didn't come with anything better up.

(I ctrl c'd it from somewhere)

PHP Code:
public fw_PlayerPreThink(id)
{
    if (!
is_user_alive(id))
        return 
FMRES_IGNORED
    
    
if (leap_longjump(id))
    {
        static 
Float:velocity[3]
        
velocity_by_aim(id400velocity)
        
        
velocity[2] = 400.0
        
        set_pev
(idpev_velocityvelocity)
        
        
g_lastLeaptime[id] = get_gametime()
    }
    
    return 
FMRES_IGNORED
}

leap_longjump(id)
{
    
    if (!(
pev(idpev_flags) & FL_ONGROUND))
        return 
false
    
    
static buttons
    buttons 
pev(idpev_button)
    
    if (!
is_user_bot(id) && (!(buttons IN_JUMP) || !(buttons IN_DUCK)))
        return 
false
    
    
    
return true

I want it to make you jump exactly where you are looking, not forward.

If you're looking up, you simply should jump only up and not forward with that.
If you're looking forward, you should jump only forward (thus ignore the height, maybe only a little of it so you will actually jump).

The problem is I'm kind of not familiar with these things, is it even possible?
Backstabnoob is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 09-03-2011 , 17:49   Re: Changing velocity_by_aim to work like...
Reply With Quote #2

velocity_by_aim() actually does that... it launches player in the direction he's aiming... but you don't understand what you're copying:
Code:
velocity[2] = 400.0
That small part of code there overwrites the Z axis velocity generated by velocity_by_aim() and sets it to 400, which makes the player always jump upwards at 400 speed.
__________________
Hunter-Digital is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 09-03-2011 , 17:54   Re: Changing velocity_by_aim to work like...
Reply With Quote #3

It really was that simple?

Thank you, you're right about the part I don't know what I copied

Edit: Is it possible to make you simply dash to the location you're looking at instead of making you jump? I tried to set velocity[2] to some negative values, but that seems to not do the trick.

Last edited by Backstabnoob; 09-03-2011 at 17:56.
Backstabnoob is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 09-03-2011 , 18:30   Re: Changing velocity_by_aim to work like...
Reply With Quote #4

Increase the 2nd argument on velocity_by_aim to something bigger, don't exceed 2000 tough because you'll get weird directions... but if you must exceed 2000, you'll need to increase sv_maxvelocity (or mp_ prefix or sv_maxspeed... I don't really remember) cvar aswell.
__________________
Hunter-Digital is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:53.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode