Author Topic: Cloak and Uncloak on attack  (Read 486 times)

I can't seem to figure out how to make it so you can cloak and Uncloak when you push "L". Also if you attack if you are cloaked then you will uncloak. Does anyone know how to do this? I have been trying at it for a while.

It would require a few functions.

Think of other add-ons that you may reference. This is useful in almost any coding project. I'll give a few examples:

-The disguise kit
The disguise kit un-disguises you when you attack while disguised. The same method should be easily applicable to cloaks.

-Invisibility watches set
Cloaking, durr

You'll need to package Function serverCmdLight(%client) for the light thing. Do something like this:
Code: [Select]
package CloakPackage
{
    function ServerCmdLight(%client)
    {
        if(isObject(%client.player) && %client.player.getDataBlock().uiName == "Cloakable Player)
        {
             if(%client.player.isCloaked)
                    %client.player.unCloak();
             else
                    %client.player.Cloak();
        }
        else
        {
             return parent::serverCmdLight(%client);
        }
    }
};
activatePackage(CloakPackage);

Obviously you'll need to edit that to fit whatever you're doing, but hopefully you get the basic idea.