Raised This Month: $ Target: $400
 0% 

Solved Making an entity levitate and player follow it


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-18-2018 , 06:43   Re: Making an entity levitate and player follow it
Reply With Quote #6

Quote:
Originally Posted by maqi View Post
The entity won't move on it's own, you have to set it's velocity. Also do what Natsheh said, or nothing will probably work

For attaching the players:
You can try something like attach_view() to simulate what you are trying to achieve. It's a good solution, except the camera won't be movable before jumping ( seet the player origin to the plane and reset the view ). The alternative would be to match the player origin and velocity with the plane, that should work. ( not 100% sure ). Other than that you can try to set the view manually somehow or actually set the origin of a player, but i figure those would be clunky if not done properly.

Also, demonstration 10/10
If you checked the code, you'd see I'm constantly changing the velocity.
I don't need to attach the view, I need to attach the entire entity.
Again, if you checked the code you'd see I'm settings players' origin at plane's origin.

Quote:
Originally Posted by EFFx View Post
I don't know what you mean with levitate, but you can just set the plane:

- Origin
- View angle (to the direction)
- And pev_velocity

For make players follow the plane, you just need set them the same vectors of the plane and set their gravity and maxspeed to 0. (can't fall and can't move inside the plane).

That's the code I'm using on my Battleground to create the plane:

PHP Code:
public createPlane()
{
    new 
Float:fOrigin[3], Float:fAngle[3], Float:fVelocity[3]
    
getRandomPlaneDirection(fOriginfAnglefVelocity//the code that gets four random directions

    
new iEnt fm_create_entity("info_target")
    
fm_create_ent
    
(
        
iEnt
        
g_szClassNamesData[cTransporter], 
        
g_szModelsData[mTransporter], 
        
fOrigin,
        
fVelocity,
        
fAngle
    
// code to create the plane
    
    
g_bPlaneSpanwed true
    g_iEnt
[pPlaneTransporter] = iEnt
    fOrigin
[2] -= 40.0 // players under the plane.
    
    
new iPlayers[MAX_PLAYERS], iNum
    get_players
(iPlayersiNum"ach")
    for(new 
iid;iNum;i++)
    {
        
id iPlayers[i]
        
        
setInvisibility(idtrue// for players can't be seen by their enemies.
        
client_cmd(id"spk ^"%s^""g_szSoundsData[sTransporter]) // sound of the plane
        
                //here are all vectors for players be able to follow the plane
        
set_pev(idpev_originfOrigin// Same origin of the plane
        
set_pev(idpev_anglesfAngle// Same direction of the plane
        
set_pev(idpev_fixangle1// Fix the angle 
        
set_pev(idpev_velocityfVelocity// Same velocity of the plane
        
set_pev(idpev_gravity0.000001//Can't fall
        
set_pev(idpev_maxspeed0.000001//Can't move

              // some booleans to use later.
        
g_dUserData[id][bIsOnPlane] = true
        g_dUserData
[id][bCanUseParachute] = false
    
}
    
        
// to remove the plane
    
set_task(PLANE_REMOVE_TIME"checkPlaneOrigin"TASK_PLANE)

Levitate = stay in air

Thanks I'll check it out
edon1337 is offline
 



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 12:26.


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