• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Add a change that an effect happens at a weapon?

Status
Not open for further replies.
Level 10
Joined
Nov 5, 2008
Messages
536
Add a chance that an effect happens at a weapon?

I try to make an ability/behaviour similar to the concussive shells that marauders have. Each time the marauder attacks the target becomes slowed. I would like to add a chance of 25% that either effect A, B, C or nothing happens.

There is 25% chance that the attack makes the target slowed. (for example)
25% chance that the target becomes poisoned (for example)
25% that something else happens..
25% that nothing at all happens..

It might sound like a silly ability, but I actually need it for an important thing in my map.

I assume this can be done in the data editor but I can´t find a way to make only one random of several effects happen.

Any ideas?
 
Last edited:
Level 11
Joined
Jul 20, 2004
Messages
2,760
Hope you don't mind if I quote from my most recent tutorial.

Here are some further details on two additional fields of a Set Effect.
- Effect: Random: Unless you have a very good reason not to do so, keep this field Disabled. When activated, it randomizes the sequence of execution of the effects inside the set, instead of following the preset order. Experiment with Energy Burn and see what happens (sometimes it works correctly, other times you will notice the problem I mentioned - when the incorrect order is inputted).
- Effect: Minimum/Maximum Count: Keep both values to 0 to keep the feature inactive. Otherwise, selects random number inside interval and runs only the first k effects in the list (with k being the number selected). Makes sense to combine with Effect:Random activated. Notice that k always starts from minimum + 1 value (if minimum is set to 1, maximum to 5, and there are 10 effects, the system never fires 1 effect alone, but 2 or more, up to 5).

If you're still confused about their usage, think of an ability that would randomly affect a unit (from a list of both positive and negative effects, ranging from energy boost, healing, shields restoration, to mana burn, mana depletion or shields halving – at this point we do not know how to implement buff spells, so we'll stick to such simple manipulations). It is enough to input all these abilities in a set, which upon every cast randomize the list of effects, and always applies only the first (one) of them on the target. To further complicate the effect of the spell (some effects are more likely to occur than others), just add some primary effects multiple times (an effect can appear more than once in the set list).

Basically, just add your effects to a set ability, and follow the behavior described above. Make sure your passive behavior (on the attacker) triggers the set effect, and let the set do the rest of the trick.
 
Level 10
Joined
Nov 5, 2008
Messages
536
Hope you don't mind if I quote from my most recent tutorial.

Basically, just add your effects to a set ability, and follow the behavior described above. Make sure your passive behavior (on the attacker) triggers the set effect, and let the set do the rest of the trick.


Oh it was really simple! For some reason I was trying stuff with "chance". But this works great! Thanks!
 
Status
Not open for further replies.
Top