AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   ent infront of another +5 up (https://forums.alliedmods.net/showthread.php?t=251306)

avril-lavigne 11-10-2014 10:28

ent infront of another +5 up
 
Velocity_by_aim is nice for players
but I have entity punching the ball I want to lift it up a little before kick

PHP Code:

set_pev(entpev_anglesangle)
set_pev(entpev_fixangle1)      // entity is looking to my direction
        
static Float:new_velo[3]
angle_vector(angle,1,new_velo)         
new_velo[1] *= 100.0
new_velo
[0] *= 100.0      //   push another entity in that direction 
                
set_pev(ballpev_velocitynew_velo 

I need to set ball origin +5 up and + 30 forward according to angle

Jhob94 11-11-2014 06:47

Re: ent infront of another +5 up
 
The ball will be always be +5 up and +30 forward or you just want it in that moment?

avril-lavigne 11-11-2014 17:38

Re: ent infront of another +5 up
 
in that moment. I just want to be sure it will not move behind entity before kick to the net [ kicking from back thru entity >> forward works too but looks bad ingame ]

and one more bug in soccerjam

cannot get entity_range while ballowner > 0
so If I take the ball entity_range dont work
it shows me numbers like 11343453635.00

when ball is not taken all works fine

Jhob94 11-11-2014 18:08

Re: ent infront of another +5 up
 
Well, i am not sure what you want to do, but this may help you:
PHP Code:

static Float:vOrigin[3], Float:vForward[3], Float:vUp[3]
    
pev(entpev_originvOrigin)
    
angle[0] = 0.0
    angle_vector
(angle,ANGLEVECTOR_FORWARD,vForward)
    
angle_vector(angle,ANGLEVECTOR_UP,vUp)
    
    static 
Float:BallPosition[3]
    
BallPosition[0] = vOrigin[0] + vForward[0] * 30.0 vUp[0] * 5.0
    BallPosition
[1] = vOrigin[1] + vForward[1] * 30.0 vUp[1] * 5.0
    BallPosition
[2] = vOrigin[2] + vForward[2] * 30.0 vUp[2] * 5.0 

I am not sure if that is correct how to set the ball position, test and let me know if it works correctly.


All times are GMT -4. The time now is 17:42.

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