1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The poll for Hive's 12th Concept Art Contest is up! Go cast your vote for your favourite genie!
    Dismiss Notice
  4. Travel to distant realms and encounter scenes unknown to the common folk. The Greatest of Adventures is upon us with the 8th Cinematic Contest. Join in on a fun ride.
    Dismiss Notice
  5. The 18th Icon Contest is ON! Choose any ingame unit and give him/her Hero abilities. Good luck to all.
    Dismiss Notice
  6. Contestants are to create a scene set in the Stone Age. Come and see what you can come up with. We wish you the best of luck!
    Dismiss Notice
  7. Colour outside the lines! Techtree Contest #13 is a go. The contest is optionally paired.
    Dismiss Notice
  8. Greetings cerebrates, our Swarm needs new spawners that will have numerous children. Join the HIVE's 31st Modeling Contest - Spawners and Spawned! The contest is optionally paired.
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

how to make a chance on hit?

Discussion in 'World Editor Help Zone' started by Darkxs, Dec 27, 2008.

  1. Darkxs

    Darkxs

    Joined:
    Aug 8, 2008
    Messages:
    331
    Resources:
    0
    Resources:
    0
    Hello can someone tell/explain to me how i can make a chance on hit spell, that gets higher when the spell gets a higher leavel?
    (Using triggers)
    Like this:
    Leavel 1 Heros attacks has a 15% chance to (Do my effect)
    Leavel 2 Heros attacks has a 20% chance to (Do my effect)
    Leavel 3 Heros attacks has a 25% chance to (Do my effect)
     
  2. bounty hunter2

    bounty hunter2

    Joined:
    Sep 27, 2005
    Messages:
    1,949
    Resources:
    7
    Icons:
    3
    Maps:
    3
    Tutorials:
    1
    Resources:
    7
    unit begins the effect of an ability ( Lets say your spell does 100 damage okay )
    ability being cast = your spell
    set a ( integer variable ) = random number 1 - 100
    if a > 15 then:
    dmg target of ability being cast for 100
    else
    do nothing



    and for levels just use
    if a > 15 and level of abiltiy being cast = 1
    then dmg 100
    else
    if a > 15 and level of abiltiy being cast = 2
    then dmg 200
    else
    if a > 15 and level of abiltiy being cast = 3
    then dmg 300
    else
    do nothing

    Understand?
     
  3. blightn1

    blightn1

    Joined:
    Nov 26, 2008
    Messages:
    21
    Resources:
    0
    Resources:
    0
    u can also just use the spell Orb of Lightning(new) from items spell section. just change it to a unit or hero spell, change the number of levels to 3 and create spells that go in each level.. i THINK that will work
     
  4. Day-Elven

    Day-Elven

    Joined:
    Apr 3, 2008
    Messages:
    699
    Resources:
    0
    Resources:
    0
    Random Number function + Dummies is what you need.
     
  5. graystuff111

    graystuff111

    Joined:
    Dec 11, 2007
    Messages:
    715
    Resources:
    23
    Icons:
    20
    Skins:
    1
    Maps:
    1
    Tutorials:
    1
    Resources:
    23
    Seriously, you guys are on the right track, but take this example map into acount. The best way to make your spell look good is to find the perfect fitting event to trigger the spell. The event "Starts the effect of an ability" fires right when the mana is used and the caster is unable to be stopped from casting the spell. It is right when the projectile is created, so dealing damage before the projectile hits would look rediculous.
    But you where on the right track with the random integer.
    View attachment Spell On Hit Example.w3x
     
  6. Darkxs

    Darkxs

    Joined:
    Aug 8, 2008
    Messages:
    331
    Resources:
    0
    Resources:
    0
    Well... It still dosen't work
    My spell:
    Events - Unit Starts the effect of an ability
    Conditions - Ability begin cast equal to Orb of lightning (New)
    Random integer number between 1 and 100 less then or equal to 15
    Actions - If/Then/Else
    If Conditions - leavel of Orb of lightning (New) for casting unit equal to 1
    Then Actions - (The effect)
    Else Actions - If/Then/Else (and so one)
    What am i doing wrong? (It has to be chance on auto attack)
     
  7. bounty hunter2

    bounty hunter2

    Joined:
    Sep 27, 2005
    Messages:
    1,949
    Resources:
    7
    Icons:
    3
    Maps:
    3
    Tutorials:
    1
    Resources:
    7
    Random integer number between 1 and 100 less then or equal to 15
    Actions - If/Then/Else
    If Conditions - leavel of Orb of lightning (New) for casting unit equal to 1
    Then Actions - (The effect)
    Else Actions - If/Then/Else (and so one)
    What am i doing wrong? (It has to be chance on auto attack)

    set a = math random number between 1 and 100

    if then else

    if a < 15
    and if level = 1

    then...

    Don't forget the and function: if a and if level
     
  8. Darkxs

    Darkxs

    Joined:
    Aug 8, 2008
    Messages:
    331
    Resources:
    0
    Resources:
    0
    Ohh i can see the mistake now the orb spell does not count as a spell. so it can't use the trigger... But how can I then make a chance on auto attack (The arrows do also not work)
     
  9. terradont

    terradont

    Joined:
    Jan 21, 2007
    Messages:
    1,471
    Resources:
    2
    Icons:
    1
    Template:
    1
    Resources:
    2
    The orb of lightning uses a ability, for example purge. So it should be:
    Ability being cast is equal to purge.
     
  10. Deathclaw24

    Deathclaw24

    Joined:
    May 3, 2006
    Messages:
    81
    Resources:
    2
    Icons:
    2
    Resources:
    2
    Just stick with the orb of lightning new ability. It's pretty much impossible to make a chance on hit passive spell without JASS or something.

    I used to do it like this:

    Event: A unit is attacked

    Condition: Attacking unit = Your Hero
    Level of PASSIVE = blah blah X amount
    Random Integer between 1-100 greater than or equal to 75 (that 25% for all you kiddies out there)

    Action: wait 0.25 seconds (just a little wait so that your guy actually hits the enemy with his attack)
    Deal 1000 spell damage to attacked unit (this is just an example you can put any triggers here and use ATTACKED UNIT as the target of the attack)

    THIS is buggy though, if you pull your unit back and cancel the attack during his animation the trigger will still go off sadly.
     
  11. bboy-tiger-

    bboy-tiger-

    Joined:
    Jul 28, 2007
    Messages:
    899
    Resources:
    0
    Resources:
    0
    Cant he just stop unit if chance is equal to false, lets call integral "chance"
    When unit begins casting an ability
    set chance to 1-100
    if chance is greater than 15, pause unit,stop unit,unpause unit... that will prevent unit from casting a spell.