50 Precent Spawn Unit

Level 12
Joined
Aug 3, 2021
Messages
437
Hello. Its Pekisa7. I have recently saw on Hive Workshop a 50 precent chance spawn unit triggers. So I added it to my map and teseted it. When the knight dies it will spawn the either the death knight or skeletal rider. But it doesn't work for some reason. I did everything the post said . Can somone help me how to fix this too? I will be gratefull. Best regards from Pekisa7. Also here are the triggers:
  • Fifty Precent Chance Spawn
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoned unit)) Equal to Skeletal Rider
      • (Random integer number between 1 and 100) Less than or equal to 50
    • Actions
      • Set TemPoint = (Position of (Summoned unit))
      • Unit - Remove (Summoned unit) from the game
      • Unit - Create 1 Skeletal Rider for (Owner of (Summoned unit)) at TemPoint facing Default building facing degrees
      • Animation - Play (Last created unit)'s birth animation
      • Unit - Add classification of Undead to (Last created unit)
  • Fifty Precent Chance Spawn 02
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoned unit)) Equal to Death Knight
      • (Random integer number between 1 and 100) Less than or equal to 50
    • Actions
      • Set TemPoint = (Position of (Summoned unit))
      • Unit - Remove (Summoned unit) from the game
      • Unit - Create 1 Death Knight for (Owner of (Summoned unit)) at TemPoint facing Default building facing degrees
      • Animation - Play (Last created unit)'s birth animation
      • Unit - Add classification of Undead to (Last created unit)
 
Last edited:
The event does not seem right, you want something that happens when an unit dies so you should be using this one instead. Also your conditions checks if it's a death knight, then you're removing it, and replacing it with a death knight... but only 50% of the time, so 1/2 times nothing will happen. Try this instead

  • Summon
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Knight
    • Actions
      • Set VariableSet TempPoint = (Position of (Triggering unit))
      • -------- ---------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 0.00 and 100.00) Less than or equal to 50.00
        • Then - Actions
          • Unit - Create 1 Skeletal Rider for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
          • Animation - Play (Last created unit)'s birth animation
          • Unit - Add classification of Undead to (Last created unit)
        • Else - Actions
          • Unit - Create 1 Death Knight for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
          • Animation - Play (Last created unit)'s birth animation
          • Unit - Add classification of Undead to (Last created unit)
      • -------- ---------------------- --------
      • Custom script: call RemoveLocation(udg_TempPoint)
Change "owner of triggering unit" if you want the created unit to belong to someone else
 
The event does not seem right, you want something that happens when an unit dies so you should be using this one instead. Also your conditions checks if it's a death knight, then you're removing it, and replacing it with a death knight... but only 50% of the time, so 1/2 times nothing will happen. Try this instead

  • Summon
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Knight
    • Actions
      • Set VariableSet TempPoint = (Position of (Triggering unit))
      • -------- ---------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 0.00 and 100.00) Less than or equal to 50.00
        • Then - Actions
          • Unit - Create 1 Skeletal Rider for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
          • Animation - Play (Last created unit)'s birth animation
          • Unit - Add classification of Undead to (Last created unit)
        • Else - Actions
          • Unit - Create 1 Death Knight for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
          • Animation - Play (Last created unit)'s birth animation
          • Unit - Add classification of Undead to (Last created unit)
      • -------- ---------------------- --------
      • Custom script: call RemoveLocation(udg_TempPoint)
Change "owner of triggering unit" if you want the created unit to belong to someone else
Thanks it worked! But how do I fit this trigger that you sent me to my raise dead spell with permanent units?
 
just add in If (Random integer number between 1 and 100) Less than or equal to 50 and you get 50 % on evey unit type

so it becomes
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Raise Dead
  • Actions
    • Set RaiseUnitType = (Unit-type of (Target unit of ability being cast))
    • Set RaiseUnitPoint = (Position of (Target unit of ability being cast))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • RaiseUnitType Equal to Peasant
      • Then - Actions
        • If (Random integer number between 1 and 100) Less than or equal to 50
        • Then - Actions
          • Unit - Create 1 Skeleton Worker for Player 4 (Purple) at RaiseUnitPoint facing Default building facing degrees
          • Set RaiseSummon = (Last created unit)
          • Animation - Play RaiseSummon's birth animation
          • Animation - Queue RaiseSummon's stand animation
        • Else - Actions
          • Do nothing
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • RaiseUnitType Equal to Footman
      • Then - Actions
        • If (Random integer number between 1 and 100) Less than or equal to 50
        • Then - Actions
          • Unit - Create 1 Death Halberdier for Player 4 (Purple) at RaiseUnitPoint facing Default building facing degrees
          • Set RaiseSummon = (Last created unit)
          • Animation - Play RaiseSummon's birth animation
          • Animation - Queue RaiseSummon's stand animation
        • Else - Actions
          • Do nothing
      • Else - Actions
  • etc etc etc etc
 
just add in If (Random integer number between 1 and 100) Less than or equal to 50 and you get 50 % on evey unit type

so it becomes
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Raise Dead
  • Actions
    • Set RaiseUnitType = (Unit-type of (Target unit of ability being cast))
    • Set RaiseUnitPoint = (Position of (Target unit of ability being cast))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • RaiseUnitType Equal to Peasant
      • Then - Actions
        • If (Random integer number between 1 and 100) Less than or equal to 50
        • Then - Actions
          • Unit - Create 1 Skeleton Worker for Player 4 (Purple) at RaiseUnitPoint facing Default building facing degrees
          • Set RaiseSummon = (Last created unit)
          • Animation - Play RaiseSummon's birth animation
          • Animation - Queue RaiseSummon's stand animation
        • Else - Actions
          • Do nothing
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • RaiseUnitType Equal to Footman
      • Then - Actions
        • If (Random integer number between 1 and 100) Less than or equal to 50
        • Then - Actions
          • Unit - Create 1 Death Halberdier for Player 4 (Purple) at RaiseUnitPoint facing Default building facing degrees
          • Set RaiseSummon = (Last created unit)
          • Animation - Play RaiseSummon's birth animation
          • Animation - Queue RaiseSummon's stand animation
        • Else - Actions
          • Do nothing
      • Else - Actions
  • etc etc etc etc
Okay. Thank you so much!
 
Last edited:
Back
Top