Raised This Month: $ Target: $400
 0% 

Entity bounce


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Spriite
Member
Join Date: Aug 2010
Old 10-04-2011 , 00:17   Entity bounce
Reply With Quote #1

how to do a object(entity) bounce, when touch wall or floor?

Sorry for my bad english.
Spriite is offline
Flipper_SPb
Senior Member
Join Date: Jun 2009
Location: Worldspawn
Old 10-04-2011 , 01:30   Re: Entity bounce
Reply With Quote #2

set_pev(entid, pev_movetype, MOVETYPE_BOUNCE)
__________________
Полный похуизм.
Flipper_SPb is offline
Send a message via ICQ to Flipper_SPb
Spriite
Member
Join Date: Aug 2010
Old 10-04-2011 , 09:48   Re: Entity bounce
Reply With Quote #3

Yeah, but my idea would the object always flying, and bounce only when touches something.
Spriite is offline
Flipper_SPb
Senior Member
Join Date: Jun 2009
Location: Worldspawn
Old 10-04-2011 , 10:21   Re: Entity bounce
Reply With Quote #4

PHP Code:
set_pev(entidpev_gravity0.0)     
set_pev(entidpev_movetypeMOVETYPE_BOUNCE
__________________
Полный похуизм.
Flipper_SPb is offline
Send a message via ICQ to Flipper_SPb
Spriite
Member
Join Date: Aug 2010
Old 10-04-2011 , 14:13   Re: Entity bounce
Reply With Quote #5

Yeah, works thx.

But now, I have prolem to detect when his entity touches some player, I'm using:

RegisterHam(Ham_Touch, "info_target", "ent_touch");

But not works, someone can help me?

Last edited by Spriite; 10-04-2011 at 14:18.
Spriite is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 10-04-2011 , 14:26   Re: Entity bounce
Reply With Quote #6

Use engine's register_touch:
Code:
register_touch("YourClassname", "player", "ent_touch")
__________________
Hunter-Digital is offline
Spriite
Member
Join Date: Aug 2010
Old 10-04-2011 , 14:35   Re: Entity bounce
Reply With Quote #7

Quote:
Originally Posted by Hunter-Digital View Post
Use engine's register_touch:
Code:
register_touch("YourClassname", "player", "ent_touch")
I tryed this too, but not works, maybe I'm making something wrong, can you give me some more detailed example?
Spriite is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 10-04-2011 , 15:07   Re: Entity bounce
Reply With Quote #8

Are you assigning a classname for your entity? If so, registering "info_target" along with the touch hook will not trigger the function when your entity touches something. You need to hook touch with the correct entity classname in order for it to work correctly.
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 10-04-2011 , 15:13   Re: Entity bounce
Reply With Quote #9

Make sure you set a solid type too:
Code:
// pev(entity, pev_solid) values
// NOTE: Some movetypes will cause collisions independent of SOLID_NOT/SOLID_TRIGGER when the entity moves
// SOLID only effects OTHER entities colliding with this one when they move - UGH!
#define	SOLID_NOT                       0           // No interaction with other objects
#define	SOLID_TRIGGER                   1           // Touch on edge, but not blocking
#define	SOLID_BBOX                      2           // Touch on edge, block
#define	SOLID_SLIDEBOX                  3           // Touch on edge, but not an onground
#define	SOLID_BSP                       4           // BSP clip, touch on edge, block
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Spriite
Member
Join Date: Aug 2010
Old 10-04-2011 , 15:26   Re: Entity bounce
Reply With Quote #10

Ok, here is my code:

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <engine>
 
new ent_name[] = "new_ent";
 
public 
plugin_init()
{
 
register_clcmd("create""create");
 
 
RegisterHam(Ham_Touch"player""ent_touch");
 
//register_touch(ent_name, "player", "ent_touch")
}
 
public 
plugin_precache()
 
precache_model("some model.mdl");
 
public 
create(id)
{
 new 
ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString,"info_target"));
 new 
Float:StartOrigin[3], Float:Angle[3];
 
 
pev(idpev_originStartOrigin);
 
pev(idpev_anglesAngle);
 
 
set_pev(entpev_classnameent_name);
 
set_pev(entpev_mins, {-1.0, -1.0, -1.0});
 
set_pev(entpev_maxs, {1.01.01.0});
 
//set_pev(entid, pev_gravity, 0.0)     
 //set_pev(entid, pev_movetype, MOVETYPE_BOUNCE)
 
set_pev(entpev_movetypeMOVETYPE_BOUNCEMISSILE);
 
set_pev(entpev_solidSOLID_BBOX);
 
set_pev(entpev_ownerid);
 
engfunc(EngFunc_SetOriginentStartOrigin);
 
engfunc(EngFunc_SetModelent"some model.mdl");
 
 new 
Float:nVelocity[3];
 
velocity_by_aim(id10nVelocity); 
 
set_pev(entpev_velocitynVelocity);
}
 
public 
ent_touch(playerent)
{
 if(!
pev_valid(ent) || !pev_valid(player))
  return 
HAM_IGNORED;
 
 new 
ent_class[33];
 
pev(entpev_classname,  ent_class32)
 
 if(
equali(ent_classent_name))
  
client_print(0print_chat"Someone touches my entity")
 return 
HAM_IGNORED

What's wrong?

Last edited by Spriite; 10-04-2011 at 16:02.
Spriite 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 19:42.


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