VexdUM is a AMX Mod Module which allows script authors to have greater control and flexibility over most Half-Life related entities, including MOD's.
In the Half-Life world many things are made up of entities:
players
guns
lights
switches
camera's
spawn points
Bombsites/Buyzones (Counter-Strike)
etc, etc
new tName[32]
new iEntity = find_entity(-1, "trigger_teleport") // searches classname only
while(iEntity > 0)
{
entity_get_string(iEntity, EV_SZ_targetname, tName, 31)
// find name
if(equal(tName, "ballstart"))
{
// DO SOMETHING HERE
}
}
new Ball
public create_ball()
{
if(!Ball)
{
// create the entity
Ball = create_entity("info_target")
// rename the classname
entity_set_string(Ball, EV_SZ_classname, "ball")
// set the model
entity_set_model(Ball, "models/w_fb.mdl")
// set the body (not normally needed)
entity_set_int(Ball, EV_INT_body, random_num(1, 3))
// set the thinking flag
entity_set_int(Ball, EV_INT_flags, FL_ALWAYSTHINK)
// set the main movetype
entity_set_int(Ball, EV_INT_movetype, MOVETYPE_BOUNCE)
// set the animation sequence
entity_set_int(Ball, EV_INT_sequence, 1)
// set the solid state
entity_set_int(Ball, EV_INT_solid, SOLID_TRIGGER)
// set friction
entity_set_float(Ball, EV_FL_friction, 0.33)
// set gravity
entity_set_float(Ball, EV_FL_gravity, 1.0)
// set the size
entity_set_size(Ball,Float:{-6.0,-6.0,-6.0},Float:{6.0,6.0,6.0})
// set the origin
entity_set_origin(Ball, Position[0])
}
}
You cannot under any circumstances get or set any parameters to ID: 0 unless you want your plugin to fail. entity_touch(entity1, entity2) forward will pass ID: 0 so you need to be careful with this forward function else you could cause your script to fail. However if ID: 0 is passed you are still allowed to do checking on the entity that interacted with it, for instance Ball bouncing on the ground.
native get_entity_velocity(id, velocity[3]);
new Float:vel[3]
entity_get_vector(id, EV_VEC_velocity, vel)
native set_entity_velocity(id, velocity[3]);
entity_set_vector(id, EV_VEC_velocity, Float:{0.0, 0.0, 0.0})
native get_entity_origin(id, origin[3]);
new Float:orig[3]
entity_get_vector(id, EV_VEC_origin, orig)
native set_entity_origin(id, origin[3]);
entity_set_origin(id, EV_VEC_origin, Float:{0.0, 0.0, 0.0})
native get_user_velocity(id, velocity[3]);
new Float:vel[3]
entity_get_vector(id, EV_VEC_velocity, vel)
native set_user_velocity(id, velocity[3]);
entity_set_vector(id, EV_VEC_velocity, Float:{0.0, 0.0, 0.0})
native get_user_button(id);
get_user_button(id) // VexdUM_stock.inc
native get_grenade_id(id, model[], len, grenadeid = 0);
get_grenade(id) // VexdUM_stock.inc
native find_entity(start_from_ent, category, value[]);
find_entity(iIndex, szValue[])
native current_num_ents();
get_num_ents()
native set_user_footsteps(id, set=1);
needs to be scripted
A bit more explanation:
native get_grenade_id(id, model[], len, grenadeid = 0);
With get_grenade(id) you need to find out the model name, if you want to do something specifically to a player's specific grenade. However there is a new forward which you can play
with which is set_model(entity, const model[]). Now with this forward it tells you the id of the
model spawned along with the relevent model name, so all you'd have to do with this one is find
the owner with entity_get_edict(edict, EV_ENT_owner).
native find_entity(start_from_ent, category, value[]);
As you can tell this one is different from how VexdUM handles it. For a better understanding see
Finding an Entity:.
native set_user_footsteps(id, set=1);
Here's how to do it, inside of client_prethink you need to add
entity_set_int(id, EV_INT_flTimeStepSound, 999) obviously you need to design some sort of system
so not everyone has silent footsteps.
Removed set_view native - caused too much server lag
Removed from native entity_set_origin(iIndex, Float:fNewOrigin[3]); core SET_SIZE - caused problems
Updated to new AMX functionality
Fixed all native functionalities to revert to check_entity or check_player internal functions
Fixed possible server crash bug with remove_entity - invalid or trying to remove a player
Fixed controller0 not being called
Fixed blending0 not being called
Renamed most of the native names for convenience
Added experimental controller4, hoping this will control mouth animation
Added native entity_set_size(iIndex, Float:vecMin[3], Float:vecMax[3]);
Added native angle_to_vector(Float:fAngle[3], Float:vReturn[3]);
Added native precache_generic(szFile[]);
Added native precache_event(type, szEvent[]);
Added native playback_event(flags, invoker, eventindex, Float:delay, Float:origin[3],
Float:angles[3], Float:fparam1, Float:fparam2, iparam1,iparam2,bparam1,bparam2);
Added native get_offset_int(iTarget, iOffset);
Added native set_offset_int(iTarget, iOffset, iValue);
Added native get_num_ents();
Added native get_maxentities();
Added native is_entity(index);
Added forward entity_think(entity);
Added forward client_prethink(id);
Added forward client_postthink(id);
Added forward client_kill(id);
Added forward emitsound(entity, const sample[]);
Added forward set_model(edict, const model[]);
Added native abs(iInput);
Added native fabs(Float:flInput);
Added native asin(Float:flInput);
Added native sin(Float:flInput);
Added native sinh(Float:flInput);
Added native acos(Float:flInput);
Added native cos(Float:flInput);
Added native cosh(Float:flInput);
Added native atan(Float:flInput);
Added native atan2(Float:flInput1, Float:flInput2);
Added native tan(Float:flInput);
Added native tanh(Float:flInput);
Added stock DotProduct(Float:vec1[3], Float:vec2[3])
Added stock fake_kill(killer, victim, headshot, weapon[], log)
Added stock fake_damage(victim, szClassname[], Float:damage, damagetype)
Added stock get_user_button(id)
Added stock get_user_oldbutton(id)
Added stock get_entity_flags(ent)
Added stock get_entity_distance(ent1, ent2)
Added stock get_grenade(id)
Added stock get_brush_entity_origin(ent, Float:orig[3])
Added stock remove_entities(eName[])
Added stock ViewContents(id)
Added stock bool:CheckFlag(ent, flag)
Added stock get_speed(ent)
Added stock IVecFVec(iVec[3], Float:fVec[3])
Added stock FVecIVec(Float:fVec[3], iVec[3])
Added stock set_rendering(index, fx=kRenderFxNone, r=255, g=255, b=255, render=kRenderNormal, amount=16)
Added stock set_entity_flags(ent, flag, onoff)