Raised This Month: $51 Target: $400
 12% 

Moving entity but player also


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JocAnis
Veteran Member
Join Date: Jun 2010
Old 01-22-2019 , 09:38   Moving entity but player also
Reply With Quote #1

hello. i want to replicate func_door entity with yaw UP (or func_plat, same purpose), thats the block which goes up and down on button pressing...so im making a entity with the same origin, but i need to make it go up (and later to get back down)...problem is: when player is standing on that block, when it starts to get higher (changing Z coordinate by 5.0 for example), player is stucked, it goes through him, which is a big problem...is there any way to make both to go up in the same moment? (doing also +5.0 to player origin isnt the right thing in my opinion)
Thanks in advance
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)

Last edited by JocAnis; 01-23-2019 at 16:57.
JocAnis is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 01-22-2019 , 13:28   Re: Moving entity but player also
Reply With Quote #2

Try adding 5.0 to velocity[2] instead of work with player's origin.
__________________









Last edited by CrazY.; 01-22-2019 at 13:28.
CrazY. is offline
raizo11
BANNED
Join Date: Dec 2013
Location: https://t.me/pump_upp
Old 01-22-2019 , 13:51   Re: Moving entity but player also
Reply With Quote #3

maybe this will help

Code:
new Float:stuck_origin[33][3]

stuck_check(origin_entity,360.0)

public stuck_check(Float:origin[3],Float:radius)
{
    new player=-1;
    while((player = find_ent_in_sphere(player,origin,radius)) != 0)
    {
        if(is_user_alive(player))
        {
            if(is_player_stuck(player))
            {
                stuck_origin[player][0] = origin[0]
                stuck_origin[player][1] = origin[1]
                stuck_origin[player][2] = origin[2]+50.0  
                entity_set_origin(player,stuck_origin[player])
            }
        }
    }
}

stock is_player_stuck(id)
{
    static Float:originF[3]
    pev(id, pev_origin, originF)
   
    engfunc(EngFunc_TraceHull, originF, originF, 0, (pev(id, pev_flags) & FL_DUCKING) ? HULL_HEAD : HULL_HUMAN, id, 0)
   
    if (get_tr2(0, TR_StartSolid) || get_tr2(0, TR_AllSolid) || !get_tr2(0, TR_InOpen))
        return true;
   
    return false;
}
raizo11 is offline
Send a message via ICQ to raizo11 Send a message via AIM to raizo11 Send a message via MSN to raizo11 Send a message via Yahoo to raizo11 Send a message via Skype™ to raizo11
LondoN
Senior Member
Join Date: Dec 2015
Location: Roman, Romania.
Old 01-22-2019 , 14:46   Re: Moving entity but player also
Reply With Quote #4

Setting entity team..check for player and entity team then you can check if is same make like semiclip plugin.
__________________
LondoN is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 01-22-2019 , 19:44   Re: Moving entity but player also
Reply With Quote #5

nothing found yet
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)

Last edited by JocAnis; 01-23-2019 at 17:02.
JocAnis is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 01-23-2019 , 17:03   Re: Moving entity but player also
Reply With Quote #6

tryed with changing player origin, at the same moment as entity, but its updating on 0.1sec time, so player isnt able to jump or anything else...

@crazy, with velocity[2] nothing is happening (tryed also with pev_groundentity)

@raizo its again set origin to player :/

@london didnt get what you mean

EDIT: thought about entity nextthinkg (so it can be 0.01 time applied) but again, the only idea in my head is to change player origin if hes on that entity...any other solution? :/
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)

Last edited by JocAnis; 01-23-2019 at 17:05.
JocAnis is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 01-23-2019 , 17:51   Re: Moving entity but player also
Reply With Quote #7

Show your code
__________________








CrazY. is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 01-23-2019 , 18:46   Re: Moving entity but player also
Reply With Quote #8

If pev( id, pev_groundentiy) == ent
New Float: vel[3]
pev( id, pev_velocity, vel)
vel[2] + 10.0
set_pev( id, pev_velocity, vel)

EDIT: when i jump, i can get different velocity in air, but it will be the same as set player origin, i would not be able to jump or anything...is there any proper explanation, how is it possible to what ever you want while brush/func_door (for example) is getting up or going down? i would like to replace that

EDIT2: tryed to set MOVETYPE_PUSH (just like original brushes are) so when player is staying at the entity and entity goes up (changing Z coordinate) he will be pushed up...but its not working like that :/

EDIT3 lol: i guess the best solution is: solid_bbox + movetype_push + change velocity[2] of ENTITY -> so it will push player when block is going up..but then i found a note at hlsdk
Code:
Note
Some movetypes will cause collisions independent of SOLID_NOT and
SOLID_TRIGGER when the entity moves. SOLID only effects OTHER entities
colliding with this one when they move - UGH!
...
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)

Last edited by JocAnis; 01-23-2019 at 21:17.
JocAnis 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 05:44.


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