AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help getting models frame (https://forums.alliedmods.net/showthread.php?t=92058)

shine771 05-09-2009 14:20

Help getting models frame
 
Hello again. I'm trying to get the models current sequences frame, but seems like pev_frame doesn't work. I tried to store it in both integer and float, but it always returns 0 or 0.0. I tried with AddToFullPack(Es_frame). It always returns 1. I'm trying to catch a frame(ex. 21) and do a specific action when the models animation reaches frame ##(ex. 21).

Thanks.

Arkshine 05-09-2009 14:50

Re: Help getting models frame
 
pev_frame works fine. You should have something wrong in your code.

shine771 05-09-2009 14:54

Re: Help getting models frame
 
I registered HamThink for "info_target". My entity thinks every 0.01 second. Every think it check entities sequence. If it matches the DEFINEDSEQUENCE then it checks it's frame.
Code:

static Frame
Frame = pev(Entity,pev_frame)

I also tried:
Code:

static Frame
pev(Entity,pev_frame,Frame)

And:
Code:

static Float:Frame
pev(Entity,pev_frame,Frame)

I used log_amx to check the frame. It always returned 0/0.0.

hleV 05-09-2009 14:59

Re: Help getting models frame
 
Code:
set_pev(iEnt, pev_frame, 9999.999999); static Float:fFrame; pev(iEnt, pev_frame, fFrame); server_print("%f", fFrame); // Shows 10000.000000

Exolent[jNr] 05-09-2009 15:02

Re: Help getting models frame
 
http://www.amxmodx.org/funcwiki.php?go=module&id=16

Code:

enum {
        //...
        pev_float_start,
        pev_impacttime,
        pev_starttime,
        pev_idealpitch,
        pev_ideal_yaw,
        pev_pitch_speed,
        pev_yaw_speed,
        pev_ltime,
        pev_nextthink,
        pev_gravity,
        pev_friction,
        pev_frame,
        pev_animtime,
        pev_framerate,
        pev_scale,
        pev_renderamt,
        pev_health,
        pev_frags,
        pev_takedamage,
        pev_max_health,
        pev_teleport_time,
        pev_armortype,
        pev_armorvalue,
        pev_dmg_take,
        pev_dmg_save,
        pev_dmg,
        pev_dmgtime,
        pev_speed,
        pev_air_finished,
        pev_pain_finished,
        pev_radsuit_finished,
        pev_maxspeed,
        pev_fov,
        pev_flFallVelocity,
        pev_fuser1,
        pev_fuser2,
        pev_fuser3,
        pev_fuser4,
        pev_float_end,
        //...
};

pev_frame is a float value, therefore the 3rd way is the only way you can use it:
Code:
new Float:frame; pev(entity, pev_frame, frame);

Quote:

Originally Posted by hleV (Post 824334)
What about:
Code:
static Float:Frame Frame = pev(Entity, pev_frame)

pev() returns an integer value.
If you want a Float value from pev(), you must reference the variable.

shine771 05-09-2009 15:02

Re: Help getting models frame
 
Haha, it doesn't matter. I tried it without a variable, directly putting into log_amx. I tried %f and %d.
Exolent, i noticed that testing it. Thanks.

Maybe it doesn't work on entities? I've only seen it work on players, cause i've never used it on entities, i've used only sequences and framerate.

Arkshine 05-09-2009 15:06

Re: Help getting models frame
 
Frame beeing an integer you can use directly pev( entity, pev_frame) without problem here. Are you sure that the sequence is playing ?

hleV 05-09-2009 15:08

Re: Help getting models frame
 
That Exolent didn't even let me to edit the post in time. :@ Anyway, check my edition.

shine771 05-09-2009 16:41

Re: Help getting models frame
 
Quote:

Are you sure that the sequence is playing ?
Yes, absolutely. Any ideas?

Arkshine 05-09-2009 17:55

Re: Help getting models frame
 
No. Is it possible to see your code ?


All times are GMT -4. The time now is 01:27.

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