Raised This Month: $ Target: $400
 0% 

Create entity failureS


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 12-22-2009 , 06:40   Create entity failureS
Reply With Quote #1

I tried to create an entity when you press attack, so far any atempt failed,
The entity should be a ball, wich bounce a little and then stops

PHP Code:
new ball engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString,"info_target"));
 
set_pev(ballpev_classname"ball");
    
new 
Float:fOrigin[3];
pev(idpev_originfOrigin);
fOrigin[2] += 30.0;

//get_user_origin(id,origin,3) gives a runtime error 10 :s
    
new Float:fAngles[3];
pev(idpev_anglesfAngles);
    
engfunc(EngFunc_SetModelballballmodel);
    
set_pev(ballpev_anglesfAngles);
set_pev(ballpev_originfOrigin);
set_pev(ballpev_movetypeMOVETYPE_BOUNCE);
set_pev(ballpev_velocity500
__________________
I am out of order!
grimvh2 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-22-2009 , 07:20   Re: Create entity failureS
Reply With Quote #2

set_pev(ball, pev_velocity, 500)

pev_velocity is a vector.
__________________
Arkshine is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 12-22-2009 , 08:04   Re: Create entity failureS
Reply With Quote #3

500.0 ?
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-22-2009 , 08:13   Re: Create entity failureS
Reply With Quote #4

VECTOR : { x, y, z }

To calculate the entity velocity, you need to know to scale the direction you want by a value.

What does exactly this entity ? It should spawn in front of you like if you throw a snow ball ?
__________________
Arkshine is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 12-22-2009 , 08:54   Re: Create entity failureS
Reply With Quote #5

Quote:
Originally Posted by Arkshine View Post
VECTOR : { x, y, z }

To calculate the entity velocity, you need to know to scale the direction you want by a value.

What does exactly this entity ? It should spawn in front of you like if you throw a snow ball ?
Yea something like if you throw a snow ball
__________________
I am out of order!
grimvh2 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-22-2009 , 11:01   Re: Create entity failureS
Reply With Quote #6

More like that ( I have not checked if it compiles, you get the idea ) :

Code:
new ball = create_entity( "info_target" );   if ( ball ) {     // Decompose the vector based on the player's view angle.         new Float:angles[3];     pev( id, pev_v_angle, angles );         engfunc( EngFunc_MakeVectors, angles );             // Calculate the eye position.         new Float:origin[3];     new Float:viewOfs[3];         pev( id, pev_origin, origin );     pev( id, pev_view_ofs, viewOfs );         xs_vec_add( origin, viewOfs, origin );             // Configure the entity.         set_pev( ball, pev_classname, "snowball" );     set_pev( ball, pev_angles, angles );     set_pev( ball, pev_origin, origin );     set_pev( ball, pev_owner, id );     set_pev( ball, pev_movetype, MOVETYPE_BOUNCE );         engfunc( EngFunc_SetModel, ball, ballmodel );         // Calculate the velocity by scaling the direction player aims with your value.         new Float:forward[3];     new Float:velocity[3];         pev( id, pev_velocity, velocity );     angle_vector( angles, ANGLEVECTOR_FORWARD, forward );         xs_vec_mul_scalar( forward, 500.0, forward );     xs_vec_add( forward, velocity, velocity );     set_pev( ball, pev_velocity, velocity ); }
__________________

Last edited by Arkshine; 12-23-2009 at 04:58.
Arkshine is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 12-23-2009 , 04:51   Re: Create entity failureS
Reply With Quote #7

PHP Code:
xs_vec_mul_scalarvelocity500.0Forwardvelocity ); 
to

PHP Code:
xs_vec_mul_scalarvelocity500.0Forward ); 
and forward to Forward.

Still not working, no errors in .log
__________________
I am out of order!
grimvh2 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-23-2009 , 04:59   Re: Create entity failureS
Reply With Quote #8

I've edited a bit, forget to retrieve the player's velocity.

If still not working, attach the model. I will give you a full example.
__________________
Arkshine is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 12-23-2009 , 05:06   Re: Create entity failureS
Reply With Quote #9

Still nothing.

http://www.speedyshare.com/files/19936289/ttbball.mdl

(forum doesnt allow .mdl)
__________________
I am out of order!
grimvh2 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-23-2009 , 05:09   Re: Create entity failureS
Reply With Quote #10

You forget the T model.
__________________
Arkshine is offline
Reply


Thread Tools
Display Modes

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 04:09.


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