I don't know where to post this so I guess I could here:
I am making a game called Dot Wars. Basicly you go around and defeate other dots by using spells. Each spell has a cooldown to prevent people from using the same attack every time. Say it has a cooldown of one, you can't use it for 1 turn. Because you and your ennimie take turns. Now here is the problim: When cooldown is taking affect the card is supposed to turn gray and you can not use it. If you try to use it while it is in cooldown the spell will not work. And when the cooldown is over you can use it again. But I don't know how to do that. So could somone please tell me what script I use to do that? If somone does and it works I will give them credit in the credits. Example:
Debug: YourNameHere
-CaptanAwesome
Offline
Solution:
Make a variable named CoolDown(itemnamehere) for each item.
Make a broadcast called 'Item Used' and make it be broadcasted when the item is used.
Make a broadcast called 'Enemy Attacked' and have it be activated when the enemy attacks.
Let's have an example of an item called 'default item'.
Make these scripts on the sprite:
[blocks]<when green flag clicked>
<set{ CoolDowndefaultitem }to( 0
<when I receive[ Enemy Attacked
<change{ CoolDowndefaultitem }by( -1
<when I receive[ item used
<set{ CoolDowndefaultitem }to( 1[/blocks]
Have the weapon be selected when clicked.
[blocks]<when[ defaultitem ]clicked>
<if>
<( CoolDowndefaultitem <<> 1 )>[/blocks]
(then insert script here for item)
<end>
Now have two costumes, when the item is usable, and when it is unusable.
[blocks]<when green flag clicked>
<switch to costume[ costume1
<forever>
<if>
<( cooldowndefaultitem <>> 1 )>
<switch to costume[ usable
<else>
<switch to costume[ unusable
<end>
If this doesn't work tell me.
Offline
This looks like it would fit better in the Requests forum. Let me move it over there for you
Offline
benjamin2 wrote:
Solution:
Make a variable named CoolDown(itemnamehere) for each item.
Make a broadcast called 'Item Used' and make it be broadcasted when the item is used.
Make a broadcast called 'Enemy Attacked' and have it be activated when the enemy attacks.
Let's have an example of an item called 'default item'.
Make these scripts on the sprite:
[blocks]<when green flag clicked>
<set{ CoolDowndefaultitem }to( 0
<when I receive[ Enemy Attacked
<change{ CoolDowndefaultitem }by( -1
<when I receive[ item used
<set{ CoolDowndefaultitem }to( 1[/blocks]
Have the weapon be selected when clicked.
[blocks]<when[ defaultitem ]clicked>
<if>
<( CoolDowndefaultitem <<> 1 )>[/blocks]
(then insert script here for item)
<end>
Now have two costumes, when the item is usable, and when it is unusable.
[blocks]<when green flag clicked>
<switch to costume[ costume1
<forever>
<if>
<( cooldowndefaultitem <>> 1 )>
<switch to costume[ usable
<else>
<switch to costume[ unusable
<end>
If this doesn't work tell me.
The one thing that might break that is each item has a diffrent cooldown time. One might be 1 and one might be 5. Woud the script still work?
Offline
you would probably just have to use different variables for each item. this sounds like it will be a fun game
Offline
okay thanks!
Offline
CaptanAwesome wrote:
benjamin2 wrote:
Solution:
Make a variable named CoolDown(itemnamehere) for each item.
Make a broadcast called 'Item Used' and make it be broadcasted when the item is used.
Make a broadcast called 'Enemy Attacked' and have it be activated when the enemy attacks.
Let's have an example of an item called 'default item'.
Make these scripts on the sprite:
[blocks]<when green flag clicked>
<set{ CoolDowndefaultitem }to( 0
<when I receive[ Enemy Attacked
<change{ CoolDowndefaultitem }by( -1
<when I receive[ item used
<set{ CoolDowndefaultitem }to( 1[/blocks]
Have the weapon be selected when clicked.
[blocks]<when[ defaultitem ]clicked>
<if>
<( CoolDowndefaultitem <<> 1 )>[/blocks]
(then insert script here for item)
<end>
Now have two costumes, when the item is usable, and when it is unusable.
[blocks]<when green flag clicked>
<switch to costume[ costume1
<forever>
<if>
<( cooldowndefaultitem <>> 1 )>
<switch to costume[ usable
<else>
<switch to costume[ unusable
<end>
If this doesn't work tell me.The one thing that might break that is each item has a diffrent cooldown time. One might be 1 and one might be 5. Woud the script still work?
Just change the numbers marked in red.
Last edited by benjamin2 (2010-10-24 03:28:09)
Offline