Raised This Month: $ Target: $400
 0% 

Move Entity


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 04-25-2013 , 08:36   Re: Move Entity
Reply With Quote #8

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().
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.

Last edited by hornet; 04-25-2013 at 08:38.
hornet 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 10:55.


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