Raised This Month: $ Target: $400
 0% 

Change entity moving pls help!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BANDIT228
Member
Join Date: Sep 2017
Old 08-06-2018 , 02:17   Change entity moving pls help!
Reply With Quote #1

Quote:
public @CreateMafubaBeamEntity(__int_Entity, const __int_Owner, const Float:__float_Scale, const __int_Velocity)
{
__int_Entity = create_entity("env_sprite");

entity_set_model(__int_Entity, "sprites/mafuba.spr");

entity_set_int(__int_Entity, EV_INT_spawnflags, SF_SPRITE_STARTON);

DispatchSpawn(__int_Entity);

entity_set_int(__int_Entity, EV_INT_renderfx, kRenderFxGlowShell);
entity_set_int(__int_Entity, EV_INT_rendermode, kRenderTransAdd);

entity_set_float(__int_Entity, EV_FL_animtime, get_gametime());
entity_set_float(__int_Entity, EV_FL_framerate, float(10));

entity_set_string(__int_Entity, EV_SZ_classname, "mafuba");

entity_set_float(__int_Entity, EV_FL_renderamt, float(254));

entity_set_float(__int_Entity, EV_FL_scale, __float_Scale);

entity_set_int(__int_Entity, EV_INT_movetype, MOVETYPE_FLY);

entity_set_size(__int_Entity, Float:{-8.000_000, -8.000_000, -8.000_000}, Float:{8.000_000, 8.000_000, 8.000_000});

entity_set_int(__int_Entity, EV_INT_solid, SOLID_TRIGGER);

//entity_set_edict(__int_Entity, EV_ENT_owner, __int_Owner);
set_pev(__int_Entity,pev_owner, __int_Owner)
entity_set_edict(__int_Entity, EV_ENT_pContainingEntity, __int_Entity);

static Float:__float_Origin[3];
entity_get_vector(__int_Owner, EV_VEC_origin, __float_Origin);

entity_set_origin(__int_Entity, __float_Origin);

static Float:__float_Velocity[3];
velocity_by_aim(__int_Owner, __int_Velocity, __float_Velocity);

entity_set_vector(__int_Entity, EV_VEC_velocity, __float_Velocity);
set_task(0.1, "follow_enemy", __int_Entity,_,_,"b")

message_begin( MSG_BROADCAST,SVC_TEMPENTITY )
write_byte( TE_BEAMFOLLOW )
write_short( __int_Entity )
write_short( engfunc( EngFunc_ModelIndex,"sprites/mafubatrail2.spr" ) )
write_byte( 20 )// 持续时间[] life in 0.1's
write_byte( 30 )// 宽度[] line width in 0.1's
write_byte( 255 )// Red
write_byte( 255 )// Green
write_byte( 255 )// Blue
write_byte( 255 )// Brightness
message_end( )
}
this code spawns a entity and that one follows the nearest enemy <---works perfectly!
BUT i would need a circular movement andlong that....in order to create something like this:
https://images-ext-2.discordapp.net/...96/unknown.png

a buddy made that but lost the code....and i lost the buddyXD

since the entity is moving automatly forward i only would need to have it move in circle.........with the trail it creates it should look then like a spiral.

so how can i have that thing move in a cirle? i want a radial movement around a center. can someone help there? pls
BANDIT228 is offline
BANDIT228
Member
Join Date: Sep 2017
Old 08-07-2018 , 15:31   Re: Change entity moving pls help!
Reply With Quote #2

new Float:avelocity[3]
avelocity[1] = someFloatValue; // rotating on y axis
set_pev(entity, pev_avelocity, avelocity);

------------------------------------------------

new Float:g_rotation_matrix[2][2]
new Float:g_vec[3] = {70.0, 0.0, 0.0}
new Float:g_deg = 0;


public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);
set_task(0.0001, "rotate", 4373, _, _, "b")
}

public rotate(){
new Float, Float:y
x = 70*floatcos(g_deg, degrees);
y = 70*floatsin(g_deg, degrees);
g_deg += 10;

display()

g_vec[0] = x
g_vec[1] = y
}


public display(){
static players[32], pnum, origin[3]
get_players(players, pnum)
for(new i; i<pnum; i++){
get_user_origin(players[i], origin)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_SPARKS)
write_coord( floatround(g_vec[0] + origin[0]) )
write_coord( floatround(g_vec[1] + origin[1]) )
write_coord( floatround(g_vec[2] + origin[2]) )
message_end()
}
}



--------------------------------


anything of these good? cmon guys....
BANDIT228 is offline
BANDIT228
Member
Join Date: Sep 2017
Old 08-08-2018 , 08:05   Re: Change entity moving pls help!
Reply With Quote #3

http://esfkami.net/forum.php?mod=vie...extra=page%3D1

dont get it to works........its turning but around me......i dont see the mistake i do
BANDIT228 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 12:32.


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