[INFO] Fakemeta & Ham detailed function descriptions and examples

For scripting examples for learning how to use AMXX.
User avatar
Archive-Poster
Posts: 1067
Gender:
United States of America

Re: [INFO] Fakemeta & Ham detailed function descriptions and examples

Post by Archive-Poster »

Fakemeta function:

Code: Select all

EngFunc_TraceModel 
Description:
This function traces between 2 origins a model and gives us properties about it.
It acts just like a TraceLine but it ignores all the entities except the one we want to hit!

The constants that we can use in hull:

Code: Select all

#define HULL_POINT                      0  // This means that we are moving a point from the start to the end
#define HULL_HUMAN                      1  //  That means that we move a cube of a player from start to end
#define HULL_LARGE                      2  // That means that we move a bigger cube that one of the player from start to end (used in HL for big monsters!)
#define HULL_HEAD                       3  // This means that we move from start to end the hull of a ducked player 
Usage:

Code: Select all

// start - start origin
// end - end origin
// hull - the hull that is moved check above to see them
// ent_to_hit - the entity that you want to hit (this is a must!)
// ptr - the trace handle pointer, acts the same as the one in trace line!
engfunc(EngFunc_TraceModel, const Float:start[3], const Float:end[3], hull, ent_to_hit, ptr) 
User avatar
Archive-Poster
Posts: 1067
Gender:
United States of America

Re: [INFO] Fakemeta & Ham detailed function descriptions and examples

Post by Archive-Poster »

Fakemeta function :

Code: Select all

EngFunc_TraceToss
Description :
Trace the point where some entity movement will finish.
If for some reason the entity movement must be blocked for other entity (or worldspawn), TraceToss will detect that situation taking in account the original entity bounding boxes.

Usage :

Code: Select all

engfunc(EngFunc_TraceToss, ent, skipent, tr);
Parameters
ent = The entity which movement we want to trace
skipent = The entity to skip in trace
tr = trace result
Example:

If you open the attached image, you can see a player jumping and 2 points.

Start Point: Is the origin of the player when TraceToss was called
End Point: Is the point returned in TR result

So the player is making a parabola from START to END.
The green line is only for testing purposes and show from where to where the trace is.
This was tested with gravity = 400.
Attachments
tracetoss.jpg
tracetoss.jpg (48.54 KiB) Viewed 116 times
User avatar
Archive-Poster
Posts: 1067
Gender:
United States of America

Re: [INFO] Fakemeta & Ham detailed function descriptions and examples

Post by Archive-Poster »

Fakemeta function :

Code: Select all

EngFunc_SetModel
Description :
Properly sets a new model on an entity.

Usage :

Code: Select all

engfunc(EngFunc_SetModel, iEnt, sModel);
Parameters
iEnt = Entity index
sModel = Model file name to set on entity (ex: "models/player/vip/vip.mdl")

Engine Replacement :

Code: Select all

entity_set_model( entity, Model[] );
User avatar
Archive-Poster
Posts: 1067
Gender:
United States of America

Re: [INFO] Fakemeta & Ham detailed function descriptions and examples

Post by Archive-Poster »

Fakemeta function :

Code: Select all

EngFunc_ModelIndex
Description :

Returns an unique index of the model name provided.
It's actually the same number that precache_model() returns.

A model index is used for example in some TE_* messages. ( TE_LIGHTNING, TE_GLOWSPRITE, etc.. See message_const.inc file ).
The model index of an entity is stored in pev_modelindex.

Usage :

Code: Select all

ModelIndex = engfunc( EngFunc_ModelIndex, "models/MyModel.mdl" );
User avatar
Archive-Poster
Posts: 1067
Gender:
United States of America

Re: [INFO] Fakemeta & Ham detailed function descriptions and examples

Post by Archive-Poster »

Fakemeta function :

Code: Select all

EngFunc_ModelFrames
Description :

Returns the frames number of a model.

Usage :

Code: Select all

ModelFrames = engfunc( EngFunc_ModelFrames, ModelIndex );
User avatar
Archive-Poster
Posts: 1067
Gender:
United States of America

Re: [INFO] Fakemeta & Ham detailed function descriptions and examples

Post by Archive-Poster »

Fakemeta function :

Code: Select all

EngFunc_DecalIndex
Description :

Returns an unique index of the decal name provided.

A decal index is used for example in some TE_* messages. ( TE_PLAYERDECAL, TE_DECAL, etc.. See message_const.inc file ).
All the available decals are stored in the decals.wad file. ( Located at your mod root )
As side-note a plugin Decals/Models Lister is available to see a list of decals/models index/name. ( Only CS and HL )

Usage :

Code: Select all

DecalIndex = engfunc( EngFunc_DecalIndex, "{bigshot1" );
User avatar
Archive-Poster
Posts: 1067
Gender:
United States of America

Re: [INFO] Fakemeta & Ham detailed function descriptions and examples

Post by Archive-Poster »

Fakemeta function :

Code: Select all

EngFunc_AnimationAutomove
Description :
Plays the selected animation on entity

Usage :

Code: Select all

entity_set_float(iEnt, EV_FL_framerate, fFrameRate);
entity_set_int(iEnt, EV_INT_sequence, iSequence);
engfunc(EngFunc_AnimationAutomove, iEnt, fTime);
Parameters
fFrameRate = Frame rate of desired animation.
iSequence = Sequence to play.
iEnt = Source entity.
fTime = It seems to not affect the animation. Maybe for internal use.

First you have to select the sequence and the desired frame rate. Then you can start the animation.
It will run in an endless loop.

It seems to work only on non-player entities
User avatar
Archive-Poster
Posts: 1067
Gender:
United States of America

Re: [INFO] Fakemeta & Ham detailed function descriptions and examples

Post by Archive-Poster »

Fakemeta function :

Code: Select all

EngFunc_NumberOfEntities
Description :
Returns the number of entities in the world.

Usage :

Code: Select all

ents = engfunc(EngFunc_NumberOfEntities);
Engine Replacement :

Code: Select all

ents = entity_count();
User avatar
Archive-Poster
Posts: 1067
Gender:
United States of America

Re: [INFO] Fakemeta & Ham detailed function descriptions and examples

Post by Archive-Poster »

Fakemeta function :

Code: Select all

EngFunc_SetSize
Description :
Sets the bounds of an entity.

Usage :

Code: Select all

engfunc(EngFunc_SetSize, iEnt, Float:fMins[3], Float:fMaxs[3]);
Parameters
iEnt = Entity index
fMins[3] = Mins boundings values (x,y,z)
fMaxs[3] = Maxs boundings values (x,y,z)

Engine Replacement :

Code: Select all

entity_set_size( index, Float:mins[3], Float:maxs[3] );
User avatar
Archive-Poster
Posts: 1067
Gender:
United States of America

Re: [INFO] Fakemeta & Ham detailed function descriptions and examples

Post by Archive-Poster »

Fakemeta function :

Code: Select all

EngFunc_SetOrigin
Description :
Properly sets a new origin on an entity.

Usage :

Code: Select all

engfunc(EngFunc_SetOrigin, iEnt, Float:Origin[3]);
Parameters
iEnt = Entity index
Origin[3] = New origin for the entity (x,y,z)

Engine Replacement :

Code: Select all

entity_set_origin( index, Float:NewOrigin[3] );
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests