Raised This Month: $ Target: $400
 0% 

change entity path


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kp_uparrow
Penalized Member
Join Date: Jun 2006
Location: 192.168.0.1
Old 07-08-2007 , 20:10   change entity path
Reply With Quote #1

is there a way to change the path that an entity is flying by origin?? like the entity is going straight, then needs to fly towards a different origin

i need it to fly toward an origin because im trying to create an accuracy effect, the entity try to fly towards the origin dead on but the script gives it some random numbers to make the aiming inaccurate
__________________
I USED A SECOND ACCOUNT TO DO MORE KARMA UPS AND DOWNS UNTIL GREENTRYST CAUGHT ME
kp_uparrow is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 07-09-2007 , 01:59   Re: change entity path
Reply With Quote #2

How about this?

http://forums.alliedmods.net/showthread.php?t=49343
Code:
set_speed(ent,Float:speed,mode=0,const Float:origin[3]={0.0,0.0,0.0})
/*
*
*  Sets ent's speed in the direction specified
*  by the mode variable
*
*  Modes:
*   0 = In direction ent is currently moving
*        but not including the z axis
*   1 = In direction ent is currently moving
*   2 = In direction ent is currently looking
*   3 = In direction ent is currently looking
*        but not including the z axis
*   4 = In direction of origin[3]
*
*
*  Use a negative speed to go in the opposite
*  direction of the specified mode.
*
*/
stupok is offline
kp_uparrow
Penalized Member
Join Date: Jun 2006
Location: 192.168.0.1
Old 07-10-2007 , 01:09   Re: change entity path
Reply With Quote #3

will try, currently im creating a fake model at the origin and making it follow, really wierd
Code:
stock entity_set_follow(entity, target, Float:speed) {   if (!is_valid_ent(entity) || !is_valid_ent(target)) return 0   new Float:entity_origin[3], Float:target_origin[3]   entity_get_vector(entity, EV_VEC_origin, entity_origin)   entity_get_vector(target, EV_VEC_origin, target_origin)   new Float:diff[3]   diff[0] = target_origin[0] - entity_origin[0]   diff[1] = target_origin[1] - entity_origin[1]   diff[2] = target_origin[2] - entity_origin[2]   new Float:length = floatsqroot(floatpower(diff[0], 2.0) + floatpower(diff[1], 2.0) + floatpower(diff[2], 2.0))   new Float:Velocity[3]   Velocity[0] = diff[0] * (speed / length)   Velocity[1] = diff[1] * (speed / length)   Velocity[2] = diff[2] * (speed / length)   entity_set_vector(entity, EV_VEC_velocity, Velocity)   return 1 }



can i just edit the above to : ?

Code:
stock entity_set_follow2(entity,const Float:target_origin[3]={0.0,0.0,0.0}, Float:speed) {   if (!is_valid_ent(entity)) return 0   new Float:entity_origin[3]   entity_get_vector(entity, EV_VEC_origin, entity_origin)   new Float:diff[3]   diff[0] = target_origin[0] - entity_origin[0]   diff[1] = target_origin[1] - entity_origin[1]   diff[2] = target_origin[2] - entity_origin[2]   new Float:length = floatsqroot(floatpower(diff[0], 2.0) + floatpower(diff[1], 2.0) + floatpower(diff[2], 2.0))   new Float:Velocity[3]   Velocity[0] = diff[0] * (speed / length)   Velocity[1] = diff[1] * (speed / length)   Velocity[2] = diff[2] * (speed / length)   entity_set_vector(entity, EV_VEC_velocity, Velocity)   return 1 }


so far its working!
__________________
I USED A SECOND ACCOUNT TO DO MORE KARMA UPS AND DOWNS UNTIL GREENTRYST CAUGHT ME

Last edited by kp_uparrow; 07-10-2007 at 02:41.
kp_uparrow is offline
Ownage
BANNED
Join Date: Jul 2007
Location: I don't know
Old 07-10-2007 , 12:31   Re: change entity path
Reply With Quote #4

calculating xyz is hard man, hes in calculus right?
Ownage 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 21:27.


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