I’m making an RPG in which the character engages in a swing attack. It’s on an action actuator and I have it set to play. The problem is, while in the progress of swinging it can be interrupted by a new swing. How can I avoid this?
Maybe set whatever sensor is triggering the swing to not go active again until ‘x’ frames go by, x being the length of the swing animation?
EDIT: That was sorta vague.
Next to the ‘…’ buttons on the sensor, change the ‘F:’ to the length of your swing animation.
Or you could set it to Loop End.
Red- While that might work right with just one swing type, wouldn’t it still have the same problem if he was switching between different animations, say for a combo? The new swing would override the one that was already playing?
Ahh I see. Well, if you’re only using one animation, that would work, but if its more than one, I would go with ZDaters’s method.
Use the state engine. When the action occurs, switch the state so that none of the other actions can occur. Monitor the progress of the animation using the “FrameProp” field in the IPO actuator, then use a sensor to change the state back once the animation has reached its final frame.
This would also allow you to build a combo system, since you could cause player input events to trigger different actions depending on the current state.
I’m very intrigued by the idea but I’m extremely unfamiliar with states. Could you perhaps explain in a very detailed fashion how I can do this? What sensors should I be using? etc. Thanks so much =)
I’m also working on a combo now. So input is greatly appreciated.
LostInSpace made a useful tutorial on the subject:
Clark Thames has a wealth of useful info on his site:
Basically, what you use the state engine for is to separate your logic into groups called “states”, and then you specify which of these state groups should be active at a given point in time. It allows you to run only the logic needed at a time (saving resources) and to run different logic depending on a given set of circumstances.
Edit: BTW, I apologize, but I am not able to show you how to do specifically what you want to do because of time constraints.
Now I know I’m getting a little badgery, but just one more question. I use the action editor (or used) to set up my different actions. I not only am having issues with states, but also the IPO and actuator sensor. I’m having difficulty understanding the sensor. How does it monitor the actuator? How does the triggering system work? Does it do something when say, the final frame is hit and the IPO actuator turns off? (presumably set to play) Thanks in advance =)
Triggering works like this: The event sensor (mouse click or whatever) sends a positive pulse when it activates. If TRUE level triggering (positive pulse mode) is on, then it continues to send positive pulses as long as the sensor is active (as long as the mouse button is held, in this case). When the event ends (mouse button is released) a negative pulse is sent.
The controllers determine whether the pulse should be sent to the actuators or not. If you have two sensors hooked to an AND, then both sensors must be active (positive) for the controller to pass the positive pulse on to the actuator.
I did some testing, and I was not able to get reliable results with the actuator sensor when trying to read the state of an IPO actuator. That is why I would recommend that you use the “FrameProp” field on the IPO and Action actuators and test the value of the frame property instead.
Angry face! >:(. Now I have no idea to use the frameprop system to determine what frame triggers the positive pulse in the actuator sensor! Bahhhh! It just went back to state 1 instantly instead of playing the animation. I got to see the first frame though. In state one, you click, it plays the swing animation, and sends it to state 2. (Note: I’ve been using action editor mostly due to unfamiliarity with IPO editor). But as I said before, it would just send it back right away. This is the last roadblock I have left before I can finish my combat system! A billion thanks for your time.