Aller au contenu

Photo

Cool Downs on Item Use


  • Veuillez vous connecter pour répondre
12 réponses à ce sujet

#1
Lucrane

Lucrane
  • Members
  • 163 messages
Hey all. Does anyone know if there is a way to add a cool down timer to an item on use, so it cannot be used frequently, kind of similar to the timers barbarian rage has?

#2
Guest_Chaos Wielder_*

Guest_Chaos Wielder_*
  • Guests
Do you have scripting knowledge? If so, you could put a local int on the item to limit uses.

#3
Lucrane

Lucrane
  • Members
  • 163 messages
I'm aware of how to link item on use to scripts and have done it for several actions, but I am not sure where or how to implement a cool down on an item

**Edit, I don't want limited uses, that can be done on an item anyway. What I am looking for is after you use an item, like the rage ability, there is a cool down from which it cannot be used again, i.e. used item, then on cool down for about 30 secs.

Modifié par Lucrane, 03 novembre 2010 - 10:12 .


#4
_Knightmare_

_Knightmare_
  • Members
  • 643 messages
Its easy enough to restrict that use of the item to every 30 seconds or whatever, but putting a "fill up the icon, when full ready to use again" type thing - no idea if that's even possible.

#5
Guest_Chaos Wielder_*

Guest_Chaos Wielder_*
  • Guests
Yeah, if you want the icon for the item to light up or darken based on if it can be used or not, I don't think that's possible.

#6
Lucrane

Lucrane
  • Members
  • 163 messages
what Knightmare said is right on point, that's exactly what I am after a restriction on item use for a specified time or so. Not sure how to do that with the script and on unique power use self, etc. How can use be restricted by time?

#7
Guest_Chaos Wielder_*

Guest_Chaos Wielder_*
  • Guests
Set a local int on an item and then have a delay command of 30 seconds to delete that int. The int prevents the item from activating.

#8
rjshae

rjshae
  • Members
  • 4 497 messages
Yes, and if it is a weapon you can build the cool down limitation into an "_hc" script that stores the re-activate time stamp as a local variable. The On-hit effect then only goes off if the current time is past the stored time. &c.

It might be possible to do some sort of charge-up effect with a unique power: when you activate the power, it adds in a couple of charges after some delay interval. This allows one of the charge-based powers in the object to be used. (If you start with an odd number of charges and the powers always use an even number, the object won't disappear when the allowed charges are used up. E.g. allow up to three charges in the item, with two charges per power use.)

Modifié par rjshae, 04 novembre 2010 - 05:25 .


#9
diophant

diophant
  • Members
  • 116 messages
You should try one of the solutions rjshae suggested. The first one is also possible for spell-like powers, just check at the beginning of the _ac script if the cooldown time has passed. If not, just return.

The second should have the advantage that the icon is greyed out during the cooldown. However, if the player saves the game during the cooldown, and reloads, the delayed command is lost, thus the item never recharges. ChaosWielder's approach has the same problem.

#10
rjshae

rjshae
  • Members
  • 4 497 messages

diophant wrote...

The second should have the advantage that the icon is greyed out during the cooldown. However, if the player saves the game during the cooldown, and reloads, the delayed command is lost, thus the item never recharges. ChaosWielder's approach has the same problem.


You can just allow them to hit the recharge unique power at any time. If a recharge is in progress, it can just be ignored by the activate script. Otherwise it will re-initiate the charge-up that you lost because of, say, a save/exit. (Floaty strings for feedback when the recharge is starting and when it's complete would probably be a nice touch.)

Modifié par rjshae, 04 novembre 2010 - 09:56 .


#11
Lucrane

Lucrane
  • Members
  • 163 messages
I like Rjshae's idea I will try and implement that. It's not a weapon though it's an item like a relic. I never thought of the charge up before that could be interesting to do.



Right now though I should work on getting an on item activate script going that sets the local int for the item and then removes it after x time to get a cool down effect, correct?



I've never store a local int before, outside of setlocalint, and delaycommand, I am not sure what else I should do.



Also, the template for on item use/activate scripts is still i_<itemtag>_ac, correct?

#12
Lucrane

Lucrane
  • Members
  • 163 messages
Got it working in a way. What I have is its restricted use for 30 secs, if the item is attempted to be used in 30 secs a floating text appears saying that it can't be.



After 30s it resumes use as normal. Each use creates an item in the inventory, that when 10 are present in the inventory and the item is used again, something different happens now.



What I am lacking is the icon for the item "graying" out, which I don't think is possible, and having an actual countdown over the item, which I am not sure is possible either. These last things are just cosmetic, but other than that it works just fine. Thanks all.


#13
dunniteowl

dunniteowl
  • Members
  • 1 559 messages
It seems to me (and I am quite ignorant of how it all works as a unit) that the "charging" effect of when you are allowed to attack in combat, either with a melee or ranged weapon would be applicable here and I don't see why the graying timer effect on those icons should be only on those icon effects. Of course, please re-read my whole, "I am quite ignorant of how it all works as a unit," comment if I am completely talking out my backside.

Logically, though, the combat icon has a grey sliding sheet effect that acts as a timer for the weapon selected during combat (and it's just a timer that tells you when you can strike again, but you don't automatically strike again when it's 'ready') and this timer effect, it strikes me, as reasonable that it could be applied to any other icon that can be displayed in some manner. Of course, this could be one of those things that are stuck under the hardcoded hood.

I say this all as only a way to sort of get you looking at other possibilities for the timer effect. I don't know if it'd work, though I don't recollect anyone ever telling how they tried and failed to make that work for them, either.

dunniteowl