• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Random Armor and Passive

Status
Not open for further replies.
Level 4
Joined
Aug 28, 2015
Messages
75
Hello, I wonder whether they help me with a trigger ... I want to work this way: every time you finish a training unit, that unit will armor (of any kind), and random passive spells
 
Level 21
Joined
Nov 4, 2013
Messages
2,017
Random armor is impossible unless you create clones of each unit with a different armor but that would be a hellish work and it would increase the loading time drastically because more object data would need to be loaded. However, random spells can be easily done with an integer variable. Just set up the following trigger:

  • Events
    • Unit - A unit Finishes training a unit
  • Conditions
    • (Unit-type of (Trained unit)) Equal to (Your Unit)
  • Actions
    • Set MyInteger = (Random integer number between 1 and 3)
    • If (MyInteger Equal to 1) then do (Unit - Add Bash to (Trained unit)) else do (Do nothing)
    • If (MyInteger Equal to 2) then do (Unit - Add Critical Strike to (Trained unit)) else do (Do nothing)
    • If (MyInteger Equal to 3) then do (Unit - Add Evasion to (Trained unit)) else do (Do nothing)
Of course you can add more if you want but that's the base.
You can remove the condition if you want it to be for any trained unit.
 
Level 4
Joined
Aug 28, 2015
Messages
75
Random armor is impossible unless you create clones of each unit with a different armor but that would be a hellish work and it would increase the loading time drastically because more object data would need to be loaded. However, random spells can be easily done with an integer variable. Just set up the following trigger:

  • Events
    • Unit - A unit Finishes training a unit
  • Conditions
    • (Unit-type of (Trained unit)) Equal to (Your Unit)
  • Actions
    • Set MyInteger = (Random integer number between 1 and 3)
    • If (MyInteger Equal to 1) then do (Unit - Add Bash to (Trained unit)) else do (Do nothing)
    • If (MyInteger Equal to 2) then do (Unit - Add Critical Strike to (Trained unit)) else do (Do nothing)
    • If (MyInteger Equal to 3) then do (Unit - Add Evasion to (Trained unit)) else do (Do nothing)
Of course you can add more if you want but that's the base.
You can remove the condition if you want it to be for any trained unit.

Then I create several units clones ... as I get there the randomness upon finished training of a unit?
 
Status
Not open for further replies.
Top