dim3 Forum

Full Version: hitbox problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This function IS beign called, but it never gets to any of the cases :|.
Code:
function fyTrooperDamage(obj)
{
iface.console.write('DAMAGE');
    if (obj.health.current<=0) return;
    //mood='hurt';
    switch (obj.hit.hitBoxName) {
        case 'head':
            iface.console.write('BOOM HEADSHOT');
            obj.model.animation.startThenChange('hit head','idle ready');
            obj.event.chain(20,'fyTrooperDamageDone');
            break;

        case 'body':
            obj.model.animation.startThenChange('hit body','idle ready');
            obj.event.chain(10,'fyTrooperDamageDone');
            break;

        case 'legs':
            obj.model.animation.startThenChange('hit legs','idle ready');
            obj.event.chain(15,'fyTrooperDamageDone');
            break;
    }
}
And yes, the hit boxes are named right, and yes, obj.setting.hitBox is turned on.
bump, anyone?
Well why don't you add a 'default' to it to make sure that the problem is that none of those names are being hit. Once you know that go back and quadruple-check the names. otherwise it's Brian's fault.
teh1ghool Wrote:Well why don't you add a 'default' to it to make sure that the problem is that none of those names are being hit. Once you know that go back and quadruple-check the names. otherwise it's Brian's fault.

Good suggestion, also remember that iface.console.write is your best debugging friend. Change the top of the code to be:

Code:
function fyTrooperDamage(obj)
{
iface.console.write('DAMAGE');
    if (obj.health.current<=0) return;
    iface.console.write('hitbox name = ('+obj.hit.hitBoxName+')');
    //mood='hurt';
    switch (obj.hit.hitBoxName) {

Then you'll see what text you are really getting. Why the ()? To tell if it's blank, or has spaces, or has extra spaces.

Note that these comparisons are NOT case sensitive, which might also be your problem.

[>] Brian
You mean I HAVE to capitalize the first letter?
Or that I can't have 2 named the same with different caps? (I don't)

Anyway, it gets null when I do that :|.
ccccc Wrote:You mean I HAVE to capitalize the first letter?
Or that I can't have 2 named the same with different caps? (I don't)

Anyway, it gets null when I do that :|.

By not case-sensitive, if you compare:

ggadwa = ggadwa is true
GGadwa = ggadwa is false

It seems hitbox name in hitbox collisions is broken, I need to look at this, I'll have it fixed for the next beta.

[>] Brian
Brian, that would be 'not case-insensitive' (or 'case-sensitive'), not 'not case-sensitive'. Wink
teh1ghool Wrote:Brian, that would be 'not case-insensitive' (or 'case-sensitive'), not 'not case-sensitive'. Wink

Oops, you get the point, though Smile This has been fixed, I've noticed some bugs that have also cropped up with the animation smoothing which I need to look into.

[>] Brian
Reference URL's