• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Item Problem

Status
Not open for further replies.

Wii

Wii

Level 2
Joined
Jul 30, 2007
Messages
10
Hi, can anyone tell me how i can make it so my items have a chance to cast a spell? like 20% chance to cast chain lightning when holding a item. thanks
 
Level 8
Joined
Oct 8, 2005
Messages
409
to make the chance you need to make an integer equal a random integer

and then check it using a "For Next" and a "If Then"

This is a good example of a triggered passive spell:

  • Rush Base
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Legendary Doomhammer
    • Actions
      • If ((Level of Rush for (Attacking unit)) Equal to 1) then do (Set RushChance = (Random integer number between 1 and 15)) else do (Do nothing)
      • If ((Level of Rush for (Attacking unit)) Equal to 2) then do (Set RushChance = (Random integer number between 1 and 14)) else do (Do nothing)
      • If ((Level of Rush for (Attacking unit)) Equal to 3) then do (Set RushChance = (Random integer number between 1 and 13)) else do (Do nothing)
      • If ((Level of Rush for (Attacking unit)) Equal to 4) then do (Set RushChance = (Random integer number between 1 and 12)) else do (Do nothing)
      • If ((Level of Rush for (Attacking unit)) Equal to 5) then do (Set RushChance = (Random integer number between 1 and 11)) else do (Do nothing)
      • If ((Level of Rush for (Attacking unit)) Equal to 6) then do (Set RushChance = (Random integer number between 1 and 10)) else do (Do nothing)
      • If ((Level of Rush for (Attacking unit)) Equal to 7) then do (Set RushChance = (Random integer number between 1 and 9)) else do (Do nothing)
      • If ((Level of Rush for (Attacking unit)) Equal to 8) then do (Set RushChance = (Random integer number between 1 and 8)) else do (Do nothing)
      • If ((Level of Rush for (Attacking unit)) Equal to 9) then do (Set RushChance = (Random integer number between 1 and 7)) else do (Do nothing)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RushPercent Equal to RushChance
          • ((Attacked unit) is A structure) Equal to False
          • ((Attacked unit) is A ground unit) Equal to True
          • ((Attacked unit) belongs to an ally of (Owner of (Casting unit))) Equal to False
          • ((Attacked unit) is alive) Equal to True
          • ((Attacked unit) is Magic Immune) Equal to False
        • Then - Actions
          • Animation - Change (Attacking unit)'s animation speed to 175.00% of its original speed
          • Unit - Move (Attacking unit) instantly to ((Position of (Attacked unit)) offset by 70.00 towards (Facing of (Attacking unit)) degrees)
          • Unit - Make (Attacking unit) face (Attacked unit) over 0.00 seconds
          • Unit - Order (Attacking unit) to Attack (Attacked unit)
          • Animation - Play (Attacking unit)'s Attack animation
          • Special Effect - Create a special effect attached to the chest of (Attacked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
          • Special Effect - Destroy (Last created special effect)
          • Wait 0.50 seconds
          • Unit - Move (Attacking unit) instantly to ((Position of (Attacked unit)) offset by 70.00 towards (Facing of (Attacking unit)) degrees)
          • Unit - Make (Attacking unit) face (Attacked unit) over 0.00 seconds
          • Unit - Cause (Attacking unit) to damage (Attacked unit), dealing 50.00 damage of attack type Spells and damage type Normal
          • Animation - Play (Attacking unit)'s Attack animation
          • Special Effect - Create a special effect attached to the chest of (Attacked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
          • Special Effect - Destroy (Last created special effect)
          • Wait 0.50 seconds
          • Unit - Move (Attacking unit) instantly to ((Position of (Attacked unit)) offset by 70.00 towards (Facing of (Attacking unit)) degrees)
          • Unit - Make (Attacking unit) face (Attacked unit) over 0.00 seconds
          • Unit - Cause (Attacking unit) to damage (Attacked unit), dealing 50.00 damage of attack type Spells and damage type Normal
          • Animation - Play (Attacking unit)'s Attack animation
          • Special Effect - Create a special effect attached to the chest of (Attacked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
          • Special Effect - Destroy (Last created special effect)
          • Animation - Change (Attacking unit)'s animation speed to 100.00% of its original speed
        • Else - Actions
          • Do nothing
 

Wii

Wii

Level 2
Joined
Jul 30, 2007
Messages
10
under Events i found Generic Unit Event but i cant find the one that says attacks a unit.
 

Wii

Wii

Level 2
Joined
Jul 30, 2007
Messages
10
do you have a aim sn so if i have more questions we can easily contact each other? :D
 

Wii

Wii

Level 2
Joined
Jul 30, 2007
Messages
10
can you send me the file so i can edit it from there? i can't seem to find some trigger scripts..

sorry im a noob at triggers
 
Status
Not open for further replies.
Top