Triggering Events Using Animations
by Thomas Shaw · in Torque Game Engine · 04/02/2006 (8:42 pm) · 2 replies
I know the footseps in torque use triggers on the actual time line of the animation. I could REALLY use this for some specific things in my prototype.
Does anyone know of an reasources or method to create events that are triggered by a value I place on an animations timeline?
I tried digging through the foostep code but I wasn't able to find anything usefull, if somone could piont me to the location or better yet post some code it would really help me out.
Thanks
Does anyone know of an reasources or method to create events that are triggered by a value I place on an animations timeline?
I tried digging through the foostep code but I wasn't able to find anything usefull, if somone could piont me to the location or better yet post some code it would really help me out.
Thanks
#2
However, We already have an NPC using the RPGdialouge Editor resource, and that means we already have committed that one faithful slot to him."
I want to run the creature as an AI that just sits there, but animates and everything as a player would
Your script should work for the AI player, if I put the new function in the creature's armor definition in player.cs
04/04/2006 (9:57 pm)
If we want to have more than one type of armor class as an AI in aiplayer.cs, how do I add support for another one? I mean by default you just say "create an AI" and the engine already knows what character to use for it, as defined at the top of aiplayer.cs.However, We already have an NPC using the RPGdialouge Editor resource, and that means we already have committed that one faithful slot to him."
I want to run the creature as an AI that just sits there, but animates and everything as a player would
Your script should work for the AI player, if I put the new function in the creature's armor definition in player.cs
Torque Owner Clint S. Brewer
here's what I'm doing for UnEarthed gods.
in the function
void Player::updateActionThread()
right before
// Only need to deal with triggers for footprints on the client if (isGhost()) {add this chunk of code:
if(isServerObject()) { //CLINT spell casting animation specific. //game specific controlled by server //check for trigger 1 through 32 for(U32 trig = 1 ; trig < 32 ; trig ++) { if(mShapeInstance->getTriggerState(trig)) { Con::executef(mDataBlock,3,"onAnimationTrigger",scriptThis(), Con::getIntArg(trig)); } } }then in script somewhwere add the function to your player's datablock
function Armor::onAnimationTrigger(%this, %obj, %trigger) { //a trigger from an animation has fired off. //1 and 2 are used for r & l footsteps for decals etc //if trigger = whatever do whatever if(%trigger == 6) { //do something } else if(%trigger == 7) { //do something } }I don't think there was anything else I had to do to make this work, but it was a while ago, let me know if it works for you.