HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Very Nasty Hero Ability Trigger

02-19-2004, 04:46 AM#1
Cronanius
I'm trying to run a dual trigger for a hero ability. I have the first part done alright -->

Trigger 1
Event - (Generic Unit Event) Unit - A unit is attacked
Condition - (Unit-Type Comparison) - Unit-type of attacked unit is equal to <custom unit>
Condition - (Boolean Comparison) - Attacked unit has buff <custom buff> equal to True
Action - (Run Trigger) - Run <Trigger 2> Checking conditions

Now here's the hard part. <Trigger 2> is supposed to give a chance to hex the attacking unit, but this is supposed to correspond to the level of the hero ability - ie. Level 1 - 5%, Lvl 2 - 7%, etc. - it will increase by 2% each time. I was told to do a thing where it picks a random number between 1 and 100 and if it is less than or equal to the percentage number, the unit is to be hexed. However. I want to make it correspond to the level of the hero ability, meaning that, were I to do it with separate triggers, I would have to make a kajillion of them, and obviously, i don't want to. I think that I may be able to do it via intergers, but that is beyond me. Can anybody help me? Plz?
02-19-2004, 04:48 AM#2
dataangel
Just use an integer comparison, look for Unit - Level of Ability or something like that. It was added in 1.13. Also, if Your only action is to just run trigger 2, why break it up into 2 triggers?
02-19-2004, 04:52 AM#3
Cronanius
I had to break it up so that the conditions wouldn't clash. Thx.

[edit]
Uh... that's nice and all but how do I get it to "pick a random number" or "give a percent chance". I can't find anything that looks like that.
02-19-2004, 07:53 AM#4
overdrive
Here's a suggestion:
Use Math - Random Number under Integers to choose a number between 1 and 100.

Then compare the number to 5, 7, 9, whatever and if the chosen random number is less than or equal to the 5, 7, 9, or whatever, then you hex the unit.

So in other words:

Actions
- Set Variable: IntVar = (Random integer number between 1 and 100)
- If (IntVar less than or equal to HexChance), then Hex the Attacked Unit, else Do nothing.

Hope this helps

EDIT: HexChance being the percentage. I would just store that as an integer variable and increment it by 2 when you gain a level for your ability.