Jump to content

animation timing with muliple key stroke


Helm Anton
 Share

You are about to reply to a thread that has been inactive for 4361 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hi im kinda new to scripting.  i have made a melee script and it works well.  The next step is to get the animations to stop playing with every key stroke.  What im trying to do is get an animation to play out fully before another is triggered.  IE; left = attack L, but i dont want attackL to fire every time left key is hit until attack L has finnished playing out.  I have tried with event times and this helps a little but it delays the attck for that time before the animation starts, this allows say attack R to play abit behind the key stroke and attack L gets abit more play time before attack R over rides it and visa versa.

 

would i use a counter; ? for the timing of X amount of keystorkes against the animation play time (0.36 seconds?)..

 

any help would be great.

Link to comment
Share on other sites

At first I thought about using llSleep() but that's probably not a good idea because your melee script is likely to be doing other stuff while the animation is playing.

So how about using an integer switch and a timer, something like this:

float min_interval = 0.36;integer active;default{	//.......................//	control(key id, integer held, integer change) {		integer pressed = held & change;	// integer down = held & ~change; // integer released = ~held & change; // integer inactive = ~held & ~change;		if (active == FALSE){			active = TRUE;			if (pressed & CONTROL_LEFT){				llStartAnimation("my animation");			}			else if (pressed & CONTROL_RIGHT){				llStartAnimation(("my other animation");			}			llSetTimerEvent(min_interval);		}	}	timer()	{		llSetTimerEvent(0.0);		active = FALSE;	}}

 ETA

A voice from beyond has pointed out that you don't really need a timer event.   You can simply put something like 

	if (llGetTime() < min_interval){ return; }	llResetTime();	//-- rest of the action

 at the the start of the control event, and it will dump the rest of the event if the minium interval hasn't passed.

Link to comment
Share on other sites

Once an animation starts it has to play the entire animation. Perhaps use shorter animations? Oh or use 3 or 4 animations in a row for one action, that way if you stop not all animations will play only the ones at the beginning of the series, (although I believe this only works with poseballs).

Link to comment
Share on other sites

The problem with llMinEventDelay is -- as the voice from beyond had mentioned to me but I omitted from my earlier post -- that it's going to affect all events, not just the control event, so it might not be the best choice here, since in a melee script there's likely to be other things -- possibly a sensor event -- that could happening while the animation is playing.

Link to comment
Share on other sites

It s not a problem to do a second script to work with other tasks.

The second scripts won t be affected by the comportment of the first

 

To add it s safer ; if there was only one script , the control event could be fired so many times and could block the other events to happen because the queue event is filled  (45 events per seconds when you need only a fire event 1/0.36 = 3 events per seconds )

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4361 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...