AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how do i make my weapon models keep animating? (https://forums.alliedmods.net/showthread.php?t=22061)

Major_victory 12-17-2005 18:43

how do i make my weapon models keep animating?
 
I've tried everything i can think of to do this...

I'm trying to make the animation on the rpg model from HL to KEEP animating even after the user has stopped pressing a button.
Here's what i've learned, tried, and know so far:

1. I know i have to use the function entity_set_int(id, EV_INT_weaponanim, <sequence>)

2. I know what the sequence numbers are and have some constants set up for them:
Code:
#define SEQ_IDLE        0 #define SEQ_FIDGET      1 #define SEQ_RELOAD  2 #define SEQ_FIRE        3

3. I've tried using entity_set_int in client_PreThink and it works only if the person continues to hold down the button, i've also tried a seperate function with the same results. I then tried a system of set_tasks and still had the same results.

4. if i do an if statement in client_PreThink like this:
Code:
if(mysequence = SEQ_RELOAD) {     entity_set_int(id, EV_INT_weaponanim, SEQ_RELOAD) }

then it crashes before i can start a server.

what i need to know is:

1. where to place the entity_set_int function so that it will continue the animation after it has been called once or set in motion.

2. is there any other way to start a players weapon animation?

please reply soon and i'll put your name in the special thanks section of my plugin, which for reference can be found here: http://forums.alliedmods.net/showthread.php?t=20745

Skym(a)ker 12-18-2005 04:12

What about useing set_task in it?

XxAvalanchexX 12-18-2005 04:43

Code:
new Float:lastFrame[33];  public client_PreThink(id) {     if(entity_get_int(id,EV_INT_weaponanim) != SEQ_RELOAD && isReloading[id]) {         entity_set_int(id,EV_INT_weaponanim,SEQ_RELOAD);         entity_set_float(id,EV_FL_frame,lastFrame[id]);     }     lastFrame[id] = entity_get_float(id,EV_FL_frame);  }

Major_victory 12-18-2005 21:50

that didn't work, although i see what you're trying to do. for some reason it only works if i hold down one of the attack buttons.

i've tried having it go to idle if no attack buttons were being used and a whole slew of other conditions but it still won't work :(

this is so frustrating! i can come so close but it always requires the person to hold down the button :x

XxAvalanchexX 12-19-2005 03:43

You could always try PostThink instead.

Major_victory 01-07-2006 00:24

ok... i'm still having lot's o problem animating this thing. i can't use IN_RELOAD or IN_IDLE because the plugin has it's own reloading and firing commands. I can still get pretty close to animating on it's own by performing +attack on the client while it needs to be animating and performing -attack when i'm done but this creates problems when you switch weapons at diff times. it also requires a fet set_tasks to get the timing right.

what i really need is a way to make it keep animating. i've tried so many different ways it's not even funny any more.

P.S. PostThink didn't do anthing.

SubFive 01-07-2006 00:41

Quote:

Originally Posted by XxAvalanchexX
You could always try PostThink instead.

Check my thread with grenade throwing animation. It doesnt work, and if your version does, please share the source.

v3x 01-07-2006 00:52

Could try this: http://forums.alliedmods.net/showthr...=195090#201225

But SubFive had no luck with it. Although, you might ;)

SubFive 01-07-2006 00:58

It was quite difficult and I still couldnt get the animation working. I'm still hoping Avalanche will come through and spill the beans though, he keeps telling me to do stuff but never has directly given me code. :?

XxAvalanchexX 01-07-2006 13:31

Quote:

Originally Posted by SubFive
It was quite difficult and I still couldnt get the animation working. I'm still hoping Avalanche will come through and spill the beans though, he keeps telling me to do stuff but never has directly given me code. :?

Here's spilling the beans for you:

I did give you code, you dumbass. You just neglected to follow it but cutting half of it out.

When you do finally test it, make sure you have another person watching you as opposed to using a third-person camera because of client prediction.


All times are GMT -4. The time now is 16:04.

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