• 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.

X% Chance Abilities

Status
Not open for further replies.
Level 10
Joined
Jun 10, 2007
Messages
557
I saw something about this a while back, but I can't remember what the solution was.

Anyway, one of the spells in a map I'm doing is essentially a 15% chance on attack to have a dummy unit cast a spell. And my problem is with the percentage; how do I make it so that the triggered spell is initiated one-in-x times? I have a dummy unit made and the dummy spell made, I just need this one crucial part.

Help?
 
Level 10
Joined
Jun 10, 2007
Messages
557
Aha! That seems to have done it. Thanks! :grin:

EDIT: Or not. Here's my trigger, and absolutely nothing happens when I attack. (The 100% thing is just for testing)

  • SpiritoftheBear
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of Spirit of the Bear (Neutral Hostile) for (Attacking unit)) Equal to 1
      • (Random integer number between 1 and 100) Less than or equal to 100
    • Actions
      • Set SotBLocation = (Position of (Attacking unit))
      • Unit - Create 1 Dummy for (Owner of (Attacking unit)) at SotBLocation facing Default building facing degrees
      • Unit - Set level of Roar for (Last created unit) to 1
      • Unit - Order (Last created unit) to Night Elf Druid Of The Claw - Roar
      • Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation (udg_SotBLocation)
 
Last edited:
Level 10
Joined
Sep 6, 2007
Messages
440
Well, perhaps this can help;

  • SpiritoftheBear
  • Events
  • Unit - A unit Is attacked
  • Conditions
  • (Level of Spirit of the Bear (Neutral Hostile) for (Attacking unit)) Equal to 1
  • (Random integer number between 1 and 100) Less than or equal to 100
  • Actions
  • Set SotBLocation = (Position of (Attacking unit))
  • Set ChRoar = (Random integer number between 1 and 50)
  • If/then/else multiple actions
  • Conditions
  • ChRoar is less than or equal to 7
  • Actions
  • Unit - Create 1 Dummy for (Owner of (Attacking unit)) at SotBLocation facing Default building facing degrees
  • Unit - Set level of Roar for (Last created unit) to 1
  • Unit - Order (Last created unit) to Night Elf Druid Of The Claw - Roar
  • Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
  • Custom script: call RemoveLocation (udg_SotBLocation)
This should fix. The reason I made it 7-50 is that it makes everything happen faster ( I think ). And 7 should be 7.5 but 7 is a better number for you due to " integer " word.
 
Level 10
Joined
Jun 10, 2007
Messages
557
Well, nothing suggested works, and removing the ability requirement didn't help either, so it has to do with the actions. I tried removing the variable, and just using (Position of (Attacking unit)) but that yielded negative results as well.

I am... very puzzled by this. It might have to do with the (Set level of Roar to 1 for (Last Created Unit), as it doesn't inherently have Roar, so I'll try using (Give (Last Created Unit) Roar) before that... EDIT: Which didn't work. I *also* tried setting the training level of Druid of the Claw to 2, which it shouldn't need, since I disabled Check Dependency (and I believe you don't need to research anything to use Roar).
 
Level 10
Joined
Jun 10, 2007
Messages
557
Try removing random int number from conditions ( first ) and try again. The one I suggested.

Tried it, and nada.

Dr Super Good said:
A unit is attacked is abusable, by pressing the "S" hotkey or stop button repeditly, it causes the trigger to run more than it should and so has a higher chance of working.

Then what do you suggest as a substitute? I looked for A Unit Attacks Another Unit, but it didn't seem to exist.
 
Level 11
Joined
Aug 15, 2004
Messages
710
I think Doctor Super Good means a Unit is Damaged event, but since it's a specific unit event it can be difficult to use in GUI unelss you set up a system that adds every entered unit to a generic unit damaged trigger. I think that right now, dont worry about that. If your map becomes good enough for people to try and cheat it then think about that. Besides using such a technique makes you not deal damage when you attack.

I'm actually not sure why your trigger didnt work, maybe it's something about the ability condition try removing that. Be sure that the dummy unit you created has Roar (just setting it to 1 wont give the ability to him) and make it has no mana cost or anything.
 
Last edited:
Level 10
Joined
Jun 10, 2007
Messages
557
Okay: IT WORKS!

What I did was to change the Level of Ability condition to Unit-Type of Attacking Unit equal to X, and I gave the dummy Roar to begin with. And while it lacked the special affect (which is fixable, but I don't care a whole lot about that), Roar was cast. +rep!
 
Last edited:
Status
Not open for further replies.
Top