Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Visual Cooldown Notification?
Visual Cooldown Notification?
2013-09-10, 9:39 AM #1
I've added binwait to several force powers in my mod for 'cooldown' periods. It is a bit annoying to not know exactly when the power can be used again. Having SetInvActivated as 1 until the cooldown is over would do well, but I've no idea how to implement that.

SetInvActivated is the verb used for triggering the force power icon at the top right, isn't it?
2013-09-10, 5:18 PM #2
Yes.

http://jkwiki.massassi.net/wiki/index.php?title=Category:CogVerbs_Inventory
http://jkwiki.massassi.net/wiki/index.php?title=Cog:SetInvActivated
And when the moment is right, I'm gonna fly a kite.
2013-09-14, 12:05 PM #3
Excellent. Now, I'm experienced with the cog language, but I'm no scripter. The only way I figure I can keep the inventory active (without breaking the power) is by checking if the wait time (SetBinWait) is greater than 0. How would I do that though. Surely "if(SetBinWait(player, 33, 35.0) > 0)" is improper syntax.
2013-09-14, 6:10 PM #4
The docs suggest that SetBinWait is used while the inventory bin is inactive and that it won't work when it is. Someone should test this. :ninja:

The alternative is to set up a cooldown timer and flag in the cog and ignore activations while the flag is true.
And when the moment is right, I'm gonna fly a kite.
2013-09-15, 3:36 PM #5
A few years ago when I was messing with the Destruction cog. I used SetBinWait for the first time and the Icon remained for the wait duration. I don't have that cog anymore but this is one section of it I still have:

Code:
activated:

    rank = GetInv(player, 33);
    mana = GetInv(player, 14);

       if(!IsInvActivated(player, 33))
       {
           if((mana >= 120) && (GetInv(player, 13) >= 80)) && (GetThingHealth(player) >= 25))
           {
            if(charge == -1)
            {
                if(GetInv(player, 64) != 1) ChangeInv(player, 13, -cost) && ChangeInv(player, 14, -120);
                SetBinWait(player, 33, GetSoundLen(destChrgSound));
                SetTimerEx(0.001, 0, 0, 0);
            }
        }
    }
    else
    {
        if(charge == 3)
        {
            call stop_power;
            PlaySoundThing(destFireSound, player, 1.0, -1, -1, 0x80);
             SendTrigger(-1, 333, player, rank, 0, 0);
            AddDynamicTint(player, 20.0, 0.0, 0.0);
            PlayKey(player, destFireAnim, 1, 0x38);
            SetBinWait(player, 33, 30.0);
            charge = -1;
        }
    }

   Return;

↑ Up to the top!