Multi-function function calls
by 000 · in Torque 3D Professional · 10/16/2013 (1:21 pm) · 5 replies
Is there a way to string multiple functions together to call another function?
For example if the player; jump+moveforward+mouseFire it calls specialmove function.
For example if the player; jump+moveforward+mouseFire it calls specialmove function.
#2
10/16/2013 (4:28 pm)
Do you mean combos - the player does those things one after the other - or that they have to press those buttons all at the same time?
#3
10/16/2013 (6:23 pm)
@Daniel: either or works, but yes, like a combo (in a fighting game).
#4
10/17/2013 (7:11 pm)
Ok first have a think about whether you want combos or just pressing multiple buttons at the same time - they're different because combos require sequencing and order. If you want to do combos, I'd highly recommend using a state machine for your inputs. For example, using this scripted state machine framework, you could write a state machine like:new ScriptObject(Combos) {
class = StateMachine;
transition[ready, punch] = punched;
transition[punched, kick] = kickpunch;
transition[punched, _] = ready;
};Which would enter the 'kickpunch' state if you kick after punching, or go back to 'ready' on any other move.
#5
10/19/2013 (10:24 pm)
@Daniel: Yeah, probably to make it proper it should be sequenced. Thanks for the info. :)
Torque Owner Demolishun
DemolishunConsulting Rocks!