• 🏆 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!

[Trigger] Attack Trigger Thingy

Status
Not open for further replies.
Level 3
Joined
Jun 25, 2006
Messages
32
Sorry if I'm too inquisitive but I need a trigger that has a 50/60/70% chance to deal double the damage of the damage dealt of the last casted ability. Sorry if it's confusing :)
 
Level 3
Joined
Jun 25, 2006
Messages
32
A castable one, does 1 damage on cast. So if the % is reached, then it will do 2 damage, if again it is reached, it will do 4 damage and so on and so forth. If it does not reach the % then the ability will stop and do no further damage.
 
Level 21
Joined
Jan 5, 2005
Messages
3,515
you can do this but i think it might lag because it runs this trigger everytime a unit is attacked

  • Melee Initialization
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Attacking unit) Equal to YourHero
    • Actions
      • Unit - Cause (Attacking unit) to damage (Attacked unit), dealing (0.50 x (Damage taken)) damage of attack type Normal and damage type Normal
but it is important to note that the damage taken part refers to a "unit takes damage event" which i cannot find, so how usable this is i dont know.

EDIT: just a little update more catered for you needs if you decide to use it. i reccomend you test it to see if it works and how bady it lags, if at all.

  • Untitled Trigger 001
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Attacking unit) Equal to YourHero
    • Actions
      • If ((Random integer number between 1 and 2) Equal to 1) then do (Unit - Cause (Attacking unit) to damage (Attacked unit), dealing (2.00 x (Damage taken)) damage of attack type Normal and damage type Normal) else do (Do nothing)
 
Level 11
Joined
Jul 12, 2005
Messages
764
Ah i see, so you're talking about ONE spell. If only one hero will use this, you can use a real variable to store how much damage should it deal. The spell itself should not deal damage, you have to do it in the trigger.
  • Events
    • Unit starts the effect of an ability
  • Conditions
    • Ability being cast is Equal to <Ab>
  • Actions
    • If <chance> is Greater then or equal to (Random integer between 1 and 100)
    • Then - Actions
      • Set DmgCounter = DmgCounter + 1
    • Else - Actions
    • Cause Triggering unit to damage Target unit of ability being cast dealing DmgCounter damage ...
 
Last edited by a moderator:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
He wants a spell that deals 2 damage but has the chance to double that damage in a loop untill the chance misses and then the damage is delt.
So basicly you need to make a loop that each time doubles a variable untill chance(1 to 100) > (your %).

Boringly easy with JASS, too bad you want it in GUI only. . .
 
Level 8
Joined
Sep 13, 2006
Messages
431
If you are not using custom values for anything else, then this is exceptionally easy. Otherwise, it could be a problem, as you would not have a way of storing the number of successful attempts. Anyway, with custom values and a custom spell that deals no damage:

  • DmgMultAbil
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to YourSpell
    • Actions
      • If ((Custom value of (Triggering unit)) Equal to 0) then do (Unit - Set the custom value of (Triggering unit) to 1) else do (Do nothing)
      • Set Percent = (40 + ((Level of YourSpell for (Triggering unit)) x 10))
      • Set SuccessfulCast = (Random integer number between 1 and 100)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SuccessfulCast Less than or equal to Percent
        • Then - Actions
          • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (Real((Custom value of (Triggering unit)))) damage of attack type Spells and damage type Normal
          • Unit - Set the custom value of (Triggering unit) to ((Custom value of (Triggering unit)) x 2)
        • Else - Actions
          • Unit - Set the custom value of (Triggering unit) to 1
I hope this is something like you were thinking. If I understood correctly, this should do it for you, though you will obviously have to do some minor tweaking to adapt it to your desires/needs. Good luck, though....
 
Level 21
Joined
Jan 5, 2005
Messages
3,515
why would you not be able to do the same thing a variable array, one for each player:

  • Then - Actions
    • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (Real(DamageAmount[(Player number of (Owner of (Triggering unit)))])) damage of attack type Spells and damage type Normal
    • Set DamageAmount[(Player number of (Owner of (Triggering unit)))] = (DamageAmount[(Player number of (Owner of (Triggering unit)))] x 2)
  • Else - Actions
    • Set DamageAmount[(Player number of (Owner of (Triggering unit)))] = 1
 
Level 21
Joined
Jan 5, 2005
Messages
3,515
but if hes using it for heros (ie only one unit per player will cast this ability) could he not replace everywhere it says "((Custom value of (Triggering unit))" with "VariableInteger[(Player number of (Owner of (Triggering unit)))]"? if more than one (2or3) units owned by a single player had this you could use 2-3 variable array, i would only use this if i had more than 3 units, mainly because i used to intergrate variables like this into other triggers at the same time. i mean, not that it matters or anything, im just why wouldnt using variables be possible if he had already used custom values?

also, i dont know if people are aware of this or not but you can do "(Random integer number between 1 and 10) Less than or equal to 4" instead of having to have a variable to do it, im not sure if this was not known or if people opt not to use it because of whatever reason, but it works when i try it out.
 
Status
Not open for further replies.
Top