• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Random Integer - Higher stats = Higher probability

Status
Not open for further replies.
Level 2
Joined
May 23, 2018
Messages
13
I am creating a passive skill for a unit, where whenever it casts a spell there is a probability of resetting the cooldown of the previous cast spell. The probability is based on the unit's intelligence.

I tried this:
  • Arcane Lust
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Ytrix
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to ((Intelligence of (Triggering unit) (Include bonuses)) / 2)
        • Then - Actions
          • Unit - Reset ability cooldowns for (Triggering unit)
        • Else - Actions
However, I want to have a more precise probability.
Need help :gg:
 
Level 2
Joined
May 23, 2018
Messages
13
What do you mean by more precise probability? This needs to be established first, so that the baseline is clear and straightforward to resolve.

I mean, if anyone knows how to do the probability with statistical computations
since, I made it just by making sure that the intelligence points will not be greater than 50


By my experience, an ability cooldown has to be refreshed 0 seconds after the spell effect event for the refresh event to work.
well the reset cooldown seemed to work on me
 
Level 39
Joined
Feb 27, 2007
Messages
4,994
If you're annoyed because its giving you the same sequence of random numbers, thats probably because you have 'use fixed map seed' turned on in the World Editor settings. Disable that and it should actually be random. I have never known anyone to be bothered that GetRandomInt() wasn't a uniform enough distribution, so I'm confused by what you mean by "do the probability with statistical computations". The integer generator should be sufficient. It IS random.

Perhaps you mean you want help brainstorming a better 'probability trigger' than "chance to refund cooldown is 0.5% per INT point"? What kind of spells does the unit have?
 
Level 2
Joined
May 23, 2018
Messages
13
Perhaps you mean you want help brainstorming a better 'probability trigger' than "chance to refund cooldown is 0.5% per INT point"? What kind of spells does the unit have?

Sorry for not making myself clear, but yes as you have said, I want to have a chance better than 50% per INT point
The unit has spells:
Ground Dive by Wrda
Frost Nova
and Chain Frost by NightSkyAurora

All abilities have 5 levels
 
Level 13
Joined
Oct 12, 2016
Messages
769
Well, that's simple.
Let X = Intelligence of Triggering Unit (Including bonuses)
Let Y = Random integer between 1 and 100

If [Y > 50 - (X / 2)], then reset the cooldown of the previously cast spell that's stored as a variable.
You can include this in a trigger that both resets the cooldown on cast, and stores the previously cast spell as a variable.
 
Level 39
Joined
Feb 27, 2007
Messages
4,994
@Wark He knows how to do that, it's in his first trigger. He wants a better trigger than it being a chance based on int. Something more interesting. All of those skills have slows or stuns attached to them, which gives me the idea to reset based on units being crowd controlled by the spells, so you chain them together. Example: The hero has a 15% chance to reset the cooldown of its last used spell when it attacks another unit, but if its attacking a unit currently affected by one of its stuns or slows, the chance is increased to 50%. This would require a damage detection system so is a little bit more complicated than Events - Unit - A unit is attacked, but not thaaaat hard.

Another idea: If a spell hits 3 or more units it has a 75% chance to reset the previous used spell's cooldown. So this happens on the 3rd bounce of Chain Frost and instantly for the other two.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,191
Have you tried out the new ability cooldown actions? Perhaps using them one could do HotS style cooldown aids where procing something, eg a stun, knocks off a fixed amount of time from the appropriate cooldowns. No randomness involved and more procs means faster cooldowns so more casts.
 
Status
Not open for further replies.
Top