Raised This Month: $ Target: $400
 0% 

Help with some phy emulation


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nightfall1
Senior Member
Join Date: Aug 2008
Old 05-06-2011 , 16:18   Help with some phy emulation
Reply With Quote #1

PHP Code:
new const classes[][] = { "weaponbox""item_thighpack""weapon_shield""grenade"}
 
public 
plugin_init()
{
 for (new 
xsizeof classesx++)
  
RegisterHam(Ham_Touchclasses[x], "touch_test")
}
 
public 
touch_test(enttouched)
{
 new 
owner pev(entpev_owner)
 if (!
pev_valid(ent)) return HAM_IGNORED
 
if ((touched != owner) && (touched <= 33 && touched != 0))
 {
  
set_pev(entpev_ownertouched)
  if(
pev(entpev_flags) & FL_ONGROUND)
  {
   
set_pev(entpev_owner0)
   return 
HAM_IGNORED
  
}
 
  static 
Float:oent[3], Float:otou[3], Float:oaim[3], velnew
  pev
(entpev_originoent)
  
pev(entpev_originotou)
  
fm_get_aim_origin(entoaim)
  if(
oaim[1] == otou[1] && oaim[2] == otou[2])
   
velnew random_num(-150, -50)
  else
   
velnew random_num(50150)
 
  
pev(entpev_velocityset_peventpev_velocityvel_by_aimownervelnew ) ))
 }
}
 
stock Float:vel_by_aimidspeed )
{
 new 
Float:v1[3], Float:vBlah[3]
 
pevidpev_anglev1 )
 
engfuncEngFunc_AngleVectorsv1v1vBlahvBlah )
 
 
v1[0] *= speed
 v1
[1] *= speed
 v1
[2] *= speed
 
 
return v1
}
 
// ported from AMXX's core get_user_origin(..., 3) (suggested by Greenberet)
stock fm_get_aim_origin(indexFloat:origin[3]) {
 new 
Float:start[3], Float:view_ofs[3];
 
pev(indexpev_originstart);
 
pev(indexpev_view_ofsview_ofs);
 
xs_vec_add(startview_ofsstart);
 
 new 
Float:dest[3];
 
pev(indexpev_v_angledest);
 
engfunc(EngFunc_MakeVectorsdest);
 
global_get(glb_v_forwarddest);
 
xs_vec_mul_scalar(dest9999.0dest);
 
xs_vec_add(startdestdest);
 
 
engfunc(EngFunc_TraceLinestartdest0index0);
 
get_tr2(0TR_vecEndPosorigin);
 
 return 
1;

Explication: drop weapon will reflect/return from him to look down \/




.gif at attackment





who I can do to look more realistic because my velocity by aim is not quite well
__________________
SIGNATURE

Last edited by Nightfall1; 05-07-2011 at 12:07.
Nightfall1 is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 05-06-2011 , 16:55   Re: Help with some phy emulation
Reply With Quote #2

Why do you create custom entity in the first place? My CSO weapons work fine by using regular weaponbox entities.
__________________

SonicSonedit is offline
Nightfall1
Senior Member
Join Date: Aug 2008
Old 05-07-2011 , 03:43   Re: Help with some phy emulation
Reply With Quote #3

please ignore the skin is regular weaponbox entities, i want to reflect a weapon from body but i don't want to use vel_by_aim because is not a good choise
__________________
SIGNATURE
Nightfall1 is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 05-07-2011 , 11:07   Re: Help with some phy emulation
Reply With Quote #4

Nightfall1
You don't like regular weaponboxes behavior? What exactly do you want to change?

P.S.
Can you change the images to clickable preview please?
__________________

SonicSonedit is offline
Nightfall1
Senior Member
Join Date: Aug 2008
Old 05-07-2011 , 12:04   Re: Help with some phy emulation
Reply With Quote #5

OK !!! Simple reflect weapon from playerbody / weapon rebounds / the weapon is repulsive / weapon is reflected / touches playerid turns back
but I Don't Want to Turn FROM MY AIM, I change a litel byte code see up after I edit
__________________
SIGNATURE
Nightfall1 is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 05-07-2011 , 13:14   Re: Help with some phy emulation
Reply With Quote #6

Nightfall1
Quote:
weapon from playerbody / weapon rebounds / the weapon is repulsive / weapon is reflected / touches playerid turns back
You don't need to calculate anyone's aim. Use weapon velocity to calcalute reflection angle and then use this angle to set aiment.
__________________

SonicSonedit is offline
Nightfall1
Senior Member
Join Date: Aug 2008
Old 05-07-2011 , 14:48   Re: Help with some phy emulation
Reply With Quote #7

Quote:
Originally Posted by SonicSonedit View Post
Nightfall1
You don't need to calculate anyone's aim. Use weapon velocity to calcalute reflection angle and then use this angle to set aiment.
NO but I want this

__.\/.__


PHP Code:
if (touched != owner && touched <= 33 && touched != )
 {
  
set_pev(entpev_ownertouched)
 
  static 
Float:velnew[3]
  
pev(entpev_velocityvelnew)
  
xs_vec_mul_scalar(velnew, -0.4velnew)
 
  
set_pev(entpev_velocityvelnew)
 } 
and I need to protect if 2 player touch the weapon wath is not on ground because is can't reflect and it drop slow
something like if(is_2_player_touched) return HAM_IGNORED
__________________
SIGNATURE

Last edited by Nightfall1; 05-07-2011 at 15:12.
Nightfall1 is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 05-07-2011 , 15:10   Re: Help with some phy emulation
Reply With Quote #8

It's hard to understand you.
To check if player is on gorund, check
PHP Code:
if (pev(idpev_flags)&FL_ONGROUND
__________________

SonicSonedit is offline
Nightfall1
Senior Member
Join Date: Aug 2008
Old 05-07-2011 , 15:21   Re: Help with some phy emulation
Reply With Quote #9

don't try to understand from my try from code, I don't need to check if is on ground I need to check if is 2 of player touch the classes if is true the plugin will stop if is false will continue what is down
sorry because I don't speak very fluent(good) english
the point is if 2 player is touch the weapon that is in classes the plugin will not execute what is below(will return HAM_IGNORED)
simple or I need to write a book of you?
__________________
SIGNATURE
Nightfall1 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 04:30.


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