Author Topic: I'm having an issue with statename files.  (Read 1343 times)

I removed what you said but it didn't fix anything.

I got it to work by adding this instead.

Code: [Select]
package PitchforkPackage
{
   
    function PitchforkProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
    {
        serverPlay3D(pitchforkExplosion,%obj.getTransform());
        parent::onCollision(%this,%obj,%col,%fade,%pos,%normal);
    }
    function Armor::onCollision(%this, %obj, %col, %a, %b, %c, %d, %e, %f)
    {
       
       Parent::onCollision(%this, %obj, %col, %a, %b, %c, %d, %e, %f);
    }
};
activatePackage(pitchforkPackage);

I got it to work by adding this instead.

Code: [Select]
package PitchforkPackage
{
    
    function PitchforkProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
    {
        serverPlay3D(pitchforkExplosion,%obj.getTransform());
        parent::onCollision(%this,%obj,%col,%fade,%pos,%normal);
    }
    function Armor::onCollision(%this, %obj, %col, %a, %b, %c, %d, %e, %f)
    {
        
       Parent::onCollision(%this, %obj, %col, %a, %b, %c, %d, %e, %f);
    }
};
activatePackage(pitchforkPackage);
I don't understand how that works, but ok

Code: [Select]
      stateName[3] = "AbortChargefire";
stateSound[3] = pitchforkhitSound;

stateName[5] = "Fire";
stateSound[5] = pitchforkhitSound;
};
this will always play your pitchfork hit sound whenever you enter this state. basically what goth said.


Code: [Select]
function Pitchforkprojectile::onCollision(%this, %obj, %col, %fade, %pos, %normal, %velocity)
{
        Parent::onCollision(%this, %obj, %col, %fade, %pos, %normal, %velocity)

        ServerPlay3D(pitchforkhitSound, %pos);
}
I didn't realize you can call parents outside of packages. Are packages just used for "engine" functions?
By the way yes Conan, packages are used to contain modified default functions

I got rid of pitchforkhitsound in the statename and then I used the pitchfork package with the explosion sound instead.

By the way yes Conan, packages are used to contain modified default functions
Not quite the right answer to his question.

Packages are used to modify an existing function. Even if it's a function from another add-on, or even your own functions.

Code: [Select]
    function Armor::onCollision(%this, %obj, %col, %a, %b, %c, %d, %e, %f)
    {
       
       Parent::onCollision(%this, %obj, %col, %a, %b, %c, %d, %e, %f);
    }

This part of your code is completely useless and can be removed.

Why didn't you just give the explosion datablock a sound? That's how the default sword does it. Your states were fine btw, you just tied a "hit" sound to the action of using the weapon.

I gave the explosion datablock a sound after I realized it were missing.

Nice! PM me if you need help with anything else datablock related :)

Not quite the right answer to his question.

Packages are used to modify an existing function. Even if it's a function from another add-on, or even your own functions.

This part of your code is completely useless and can be removed.
Yes, a much better explanation. Thanks Shift Kitty


Someone told me to unlock this.