Raised This Month: $ Target: $400
 0% 

How to set enitity's body


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 07-28-2010 , 08:25   Re: How to set enitity's body
Reply With Quote #1

And you must spawn it.

Made a few adjustments:
Code:
public set_mine(id) {
  new Float:StartOrigin[3]
 
  new PlayerOrigin[3]
  get_user_origin(id, PlayerOrigin, 1)

  StartOrigin[0] = PlayerOrigin[0] + 0.0
  StartOrigin[1] = PlayerOrigin[1] + 0.0
  StartOrigin[2] = PlayerOrigin[2] - 53.0

  new MineEnt = create_entity("info_target")

  entity_set_string(MineEnt, EV_SZ_classname, "landmine")
  entity_set_model(MineEnt, "models/w_landmine_zlw.mdl")
  entity_set_edict(MineEnt, EV_ENT_owner, id)

  DispatchSpawn(MineEnt)

  entity_set_origin(MineEnt, StartOrigin)
  entity_set_size(MineEnt, Float:{-3.0, -3.0, -1.0}, Float:{3.0, 3.0, 1.0})
  entity_set_int(MineEnt, EV_INT_solid, 2) /* for readability, use the HLSDK defines... SOLID_* and MOVETYPE_*. */
  entity_set_int(MineEnt, EV_INT_movetype, 5)

  new Float:Velocity[3]
  VelocityByAim(id, 0, Velocity) /* what's the point of setting velocity 0 towards nothing ? */
  entity_set_vector(MineEnt, EV_VEC_velocity, Velocity)
}
Btw, be careful when spawning the mine while player is ducking.

You could easily make one variable, use entity_get_vector(id, EV_VEC_origin, fOrigin) and use -32 or -16 if player is ducking.
__________________

Last edited by Hunter-Digital; 07-28-2010 at 08:31.
Hunter-Digital 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 00:15.


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