• 🏆 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!

[Trigger] Random Spell Casting

Status
Not open for further replies.
Level 4
Joined
Jan 21, 2009
Messages
57
So i'm currently attempting to make a TD, and one of the towers has a percentage chance to cast 3 different spells.

I've gotten the spell casting to work properly, problem is i can't figure out how to remove the dummy for the spell casting, could anyone help me with this?

Here's one of the spells, they're all based off each other with different chances..

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Random integer number between 1 and 20) Equal to 20
    • Then - Actions
      • Unit - Create 1 Spell Monolith Dummy for (Owner of (Attacking unit)) at ((Position of (Attacking unit)) offset by (0.00, 0.00)) facing (Position of (Attacking unit))
      • Set monolith_dummy[(Player number of (Owner of (Attacking unit)))] = (Last created unit)
      • Unit - Order (Last created unit) to Special Archimonde - Finger Of Death (Attacked unit)
      • Wait 2.00 seconds
      • Unit - Remove monolith_dummy[(Player number of (Owner of (Attacking unit)))] from the game
    • Else - Actions
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Just add the expiration timer for up to 0.50 ~ 1.00 second, it should work.

This function is to have your dummy a "limited time duration" for it to live on that map.

Once it has passed a certain time (you set it at the action), it will die automatically.

And about your condition.... "Equal to 20"
You do notice 1 ~ 20 Equal to 20 = 0.05 = 5% chance for that spell to occur ? (leaving your other 2 spells to occur at most 95% of the time)

Whereas you want an approximate of 33% chance to occur for the 3 spells, right ?

It should be 1 ~ 100 Less than or Equal to 33

And in the Else branch, it should be 1 ~ 66 Less than or Equal to 33

Thus, making all your spells nearly equivalent chance to occur.
 
Level 4
Joined
Jan 21, 2009
Messages
57
Just add the expiration timer for up to 0.50 ~ 1.00 second, it should work.

This function is to have your dummy a "limited time duration" for it to live on that map.

Once it has passed a certain time (you set it at the action), it will die automatically.

And about your condition.... "Equal to 20"
You do notice 1 ~ 20 Equal to 20 = 0.05 = 5% chance for that spell to occur ? (leaving your other 2 spells to occur at most 95% of the time)

Whereas you want an approximate of 33% chance to occur for the 3 spells, right ?

It should be 1 ~ 100 Less than or Equal to 33

And in the Else branch, it should be 1 ~ 66 Less than or Equal to 33

Thus, making all your spells nearly equivalent chance to occur.

Actually, i set them to different percentages because the 5% spell does high amounts of damage, and i wanted to make it rare, and it's not constant spell casting, it gives the tower a chance to cast the spells.

But thanks for the help guys, fixed it :)
 
Status
Not open for further replies.
Top