AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Move Entity (https://forums.alliedmods.net/showthread.php?t=214271)

victorngl 04-25-2013 01:40

Move Entity
 
how to move the entity forward based to where she pointed?

hornet 04-25-2013 06:51

Re: Move Entity
 
Be more specific of what you want to do.

EpicMonkey 04-25-2013 07:34

Re: Move Entity
 
Or try searching, i found around 10 useful threads.

victorngl 04-25-2013 07:42

Re: Move Entity
 
[IMG]http://img37.**************/img37/6559/entbz.jpg[/IMG]

I want the entity to move to the opposite side of the player or a wall.

hornet 04-25-2013 07:49

Re: Move Entity
 
No picture is worth a thousand words.
Give a detailed description if you'd like to be helped.

Unkolix 04-25-2013 07:55

Re: Move Entity
 
Quote:

Originally Posted by hornet (Post 1939565)
No picture is worth a thousand words.
Give a detailed description if you'd like to be helped.

I think:
When player moves towards an entity, the entity moves exactly the same way as the player.

victorngl 04-25-2013 07:55

Re: Move Entity
 
I want an entity to move to the opposite side of the player.
I tested with velocity_by_aim, but if the player aim at the sky, the entity goes to sky, I want it only to move to the opposite side of the player.

hornet 04-25-2013 08:36

Re: Move Entity
 
You should have posted what you tried so we wouldn't have to guess as much.

Is this what your after? ( Entity remains behind the player at all times? )
Code:
#include <amxmodx> #include <engine> #include <xs> #define DIST        100 #define THINK_TIME  0.05 new const g_szModel[] = "models/w_c4.mdl"; public plugin_init() {     register_clcmd( "say /create", "MakeEnt" );         register_think( "MyEnt", "EntThink" ); } public MakeEnt( id ) {     new iEnt = create_entity( "info_target" );         entity_set_string( iEnt, EV_SZ_classname, "MyEnt" );     entity_set_model( iEnt, g_szModel );         entity_set_edict( iEnt, EV_ENT_owner, id );         entity_set_float( iEnt, EV_FL_nextthink, get_gametime() + THINK_TIME ); } public EntThink( iEnt ) {     static Float:flOrigin[ 3 ], Float:flBaseOrigin[ 3 ], id;         if( !id )         id = entity_get_edict( iEnt, EV_ENT_owner );         velocity_by_aim( id, DIST, flOrigin );     entity_get_vector( id, EV_VEC_origin, flBaseOrigin );         flOrigin[ 2 ] = flBaseOrigin[ 2 ] - 25.0;     xs_vec_sub( flBaseOrigin, flOrigin, flOrigin );         entity_set_vector( iEnt, EV_VEC_origin, flOrigin );         entity_set_float( iEnt, EV_FL_nextthink, get_gametime() + THINK_TIME ); }
To test the effect, you can change xs_vec_sub() to xs_vec_add().

Psychic 04-25-2013 10:02

Re: Move Entity
 
check if player aim at the sky with the engfunc function:
PHP Code:

engfunc(EngFunc_PointContentsorigin) == CONTENTS_SKY // origin = Float:origin[3] 



All times are GMT -4. The time now is 10:55.

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