AlliedModders

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

SentryIII 10-29-2005 03:13

Follow Entity
 
I cant get this to work for the life of me, the entity doesnt follow the player. It only spawns at the players origin and sits there...

Code:
public view(id, target){     new Float:origin[3]     new entFollow = create_entity("info_target")         entity_set_string(entFollow, EV_SZ_classname, "follow_entity")         entity_set_int(entFollow, EV_INT_movetype, MOVETYPE_FOLLOW)     entity_set_int(entFollow, EV_INT_solid, SOLID_NOT)     entity_set_edict(entFollow, EV_ENT_aiment, target)     entity_get_vector(id, EV_VEC_origin, origin);     entity_set_origin(entFollow, origin)     attach_view(id, entFollow)         viewing[id]=true     return PLUGIN_HANDLED }

Heres the function to go back to the players own view which doesnt work either...
Code:
public client_command(id){     if(viewing[id]){         new button = get_user_button(id)         if(button & IN_USE ||button & IN_ATTACK){             attach_view(id, id)             viewing[id]=false         }     } }

Batman/Gorlag 10-29-2005 04:14

Get rid of these two lines:

Code:
entity_set_int(entFollow, EV_INT_movetype, MOVETYPE_FOLLOW)   entity_set_edict(entFollow, EV_ENT_aiment, target)

Apparently those are the lines that causes those errors. Instead you should constantly change the origin of the follow_entity, using client_PreThink.

MrDev 10-29-2005 17:30

or even better. Register a think function for the entity and update it's position say ever 0.1s - See amx help on register_think.

if an entity of Classname[] thinks, its entity ID is forwarded to the named function

Zenith77 10-29-2005 19:54

any view function in AMXX seems to be messed up in both the engine and fakemeta modules even Eng_Fucn() calls....


Avalanche posted this a while back in bug reports so hopefullu it will be fixed in the next version of amxx

SentryIII 10-29-2005 22:26

Thanks for the nfo!

Batman/Gorlag 10-30-2005 01:56

The view functions are only messed up if you try to directly attach a view to a player. Otherwise it works just fine, to directly attach a view to non-player entities.

Zenith77 10-30-2005 09:11

1 Attachment(s)
No its still broken.... i would know...

If you dont belive me you can try out htis little script...


All times are GMT -4. The time now is 23:42.

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