Chance on hit cast a spell, how?

Broshir

New Member
Reaction score
2
I'm gonna make a spell like the Maelstrom/Mjollnir item on dota.

When you attack there is 20% chance to release a *spell* on your target.

im not sure what the spell should be yet, i guess some kinda chain lightning, but anyway one more question:

Is there any site explaining how to make all the dota spells?

thanks for help
 
Reaction score
65
The skills that have a % to cast a spell on the target on attack are based on the item skill Orb of Lightning (New). There are better ways to do it, such as this, though.
And honestly, I don't think you should just copy skills from DotA, everyone knows them so they aren't really original anymore. We do have a pretty big database of spells here, too, in the Spells section.
 

Bloodcount

Starcraft II Moderator
Reaction score
297
hm.... base it on orb of lightning.Just change te spell from purge to somthing else.
 

Toriad

New Member
Reaction score
4
No, not that i know off, however, you need a couple of things to do this.

A Dummy unit, with your custom ability set to it, Dummy Caster Tutorial.

And the following trigger should get that setup for you.

Code:
Chanetohit
    Events
        Unit - A unit Is attacked
    Conditions
        ((Attacking unit) is A Hero) Equal to True
        Or - Any (Conditions) are true
            Conditions
                (Item-type of (Item carried by (Attacking unit) in slot 1)) Equal to Mjolnir
                (Item-type of (Item carried by (Attacking unit) in slot 2)) Equal to Mjolnir
                (Item-type of (Item carried by (Attacking unit) in slot 3)) Equal to Mjolnir
                (Item-type of (Item carried by (Attacking unit) in slot 4)) Equal to Mjolnir
                (Item-type of (Item carried by (Attacking unit) in slot 5)) Equal to Mjolnir
                (Item-type of (Item carried by (Attacking unit) in slot 6)) Equal to Mjolnir
    Actions
        Set LightningChance = (Random integer number between 1 and 10)
        Game - Display to (All players) the text: (Random nubmer = + (  + (String(LightningChance))))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                LightningChance Less than or equal to 7
            Then - Actions
                Unit - Create 1 Mjollner for (Owner of (Attacking unit)) at (Position of (Attacking unit)) facing Default building facing degrees
                Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning (Attacked unit)
                Wait 5.00 seconds
                Unit - Remove (Last created unit) from the game
            Else - Actions
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
chain lightning can be used in orb of lightning how it is already posted above 2 times. but if you want point target/no target abilitys you would have got to trigger it.
however toriad your trigger leaks and is abuseable by mass clicking the attack order.
 

Toriad

New Member
Reaction score
4
I can see the abused but thats fixable by doing the "does damage" condition instead of attacked... but i dont see the leak... -tears up- :(

Also furthur more, I meant to post that before those 2 post.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
Code:
Chanetohit
    Events
        Unit - A unit Is attacked
    Conditions
        ((Attacking unit) is A Hero) Equal to True
        Or - Any (Conditions) are true
            Conditions
                (Item-type of (Item carried by (Attacking unit) in slot 1)) Equal to Mjolnir
                (Item-type of (Item carried by (Attacking unit) in slot 2)) Equal to Mjolnir
                (Item-type of (Item carried by (Attacking unit) in slot 3)) Equal to Mjolnir
                (Item-type of (Item carried by (Attacking unit) in slot 4)) Equal to Mjolnir
                (Item-type of (Item carried by (Attacking unit) in slot 5)) Equal to Mjolnir
                (Item-type of (Item carried by (Attacking unit) in slot 6)) Equal to Mjolnir
    Actions
        Set LightningChance = (Random integer number between 1 and 10)
        Game - Display to (All players) the text: (Random nubmer = + (  + (String(LightningChance))))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                LightningChance Less than or equal to 7
            Then - Actions
                Unit - Create 1 Mjollner for (Owner of (Attacking unit)) at [B](Position of (Attacking unit))[/B] facing Default building facing degrees
                Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning (Attacked unit)
                Wait 5.00 seconds
                Unit - Remove (Last created unit) from the game
            Else - Actions
the position of the attacking unit does leak. set it to a point variable and remove it afterwards or it may cause laggs if this trigger is running too often.
also the "unit takes damage" event is not generic but specific, thats why you would need a damage detection system.
 

Toriad

New Member
Reaction score
4
Darn, ok I get that damage dection but i still dont see the leak. Maybe I'm lookingat it wrong but.

Setting the point to a variable seems like a waste of time since the point will keep changing, its just an extra line of code.

EDIT: I read up on Leaks and I guess I can see the problem, I just think its just retarded that there our no local variables in the gui triggers... I dun wanna try to learn another language, espcially JASS >.> Just sounds retarded to me :(

+rep for the help
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top