Raised This Month: $ Target: $400
 0% 

Solved Making an entity levitate and player follow it


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 07-17-2018 , 19:30   Re: Making an entity levitate and player follow it
Reply With Quote #1

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
__________________
stuff

Last edited by maqi; 07-17-2018 at 19:38.
maqi is offline
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 #2

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
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 07-18-2018 , 10:21   Re: Making an entity levitate and player follow it
Reply With Quote #3

Quote:
Originally Posted by edon1337 View Post
If you checked the code, you'd see I'm constantly changing the velocity.
I checked the code and as you probably figured by now, you did no such thing back then.

Quote:
Originally Posted by edon1337 View Post
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.
Again, i checked the code, just gave you an alternative solution that produces the same/similar result in a different way.

No need for these kind of responses when im only trying to help and you were also wrong to answer like that.

Anyway, did you make it ?
__________________
stuff

Last edited by maqi; 07-18-2018 at 10:21.
maqi is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-18-2018 , 10:44   Re: Making an entity levitate and player follow it
Reply With Quote #4

Quote:
Originally Posted by maqi View Post
I checked the code and as you probably figured by now, you did no such thing back then.
But I never edited my code?

Quote:
Originally Posted by maqi View Post
No need for these kind of responses when im only trying to help and you were also wrong to answer like that.
What kind of response? What was I wrong about? I don't get it.

Quote:
Originally Posted by maqi View Post
Anyway, did you make it ?
Nope, but I'm still working on it

Last edited by edon1337; 07-18-2018 at 10:47.
edon1337 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 12:26.


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