Game Development Community

(Solved) Trying to call a behavior in onParticleCollision callback

by J.T. Ooley · in Torque Game Builder · 09/24/2010 (12:53 am) · 3 replies

I'm trying to have the splash from a particle effect damage enemies. With an echo statement, I know that when each particle collides with said enemies, a collision is detected. So my problem is calling the enemies "stats" behavior in the onParticleCollision() callback.

This code gives me an error in the console:
Quote:
game/gameScripts/SceneObjects.cs (45): Unable to find object: ' ' attempting to call function 'getBehavior'

function SplashClass::onParticleCollision( %eff , %dstObj , %srcRef , %dstRef , %time , %normal , %contactCount , %contacts )
{
   %behavior = %dstObj.getBehavior("EnemyStatsBehavior");
   %behavior.CurrentHitPoints -= 1;
}

#1
09/25/2010 (4:48 am)
I tried echoing %dstObj.class and it came out blank in the console. It's like the particles know they're colliding, but they don't have a clue what they're hitting. Is %dstObj a valid parameter in this callback?
#2
09/25/2010 (3:52 pm)
You'll see here that "onParticleCollision" doesn't send any parameters to the callback. It's only a "yes/no" kind of thing.
#3
09/25/2010 (10:29 pm)
Yea I saw that last night. I ended up changing the effect to make a perfect circle and adding a trigger that grows with the effect. It wasn't quite what I was looking for, but actualy ended up looking better with the games visual presentation.