How to create a percent chance to upgrade for a tower in a TD?

Archenix

New Member
Reaction score
0
What would the trigger look like? I want to make a 10% chance to get a different tower on upgrade rather than the one you were originally supposed to get. So either way the tower upgrades, but there's a 10% chance to get a different, special tower and a 90% chance to get the regular upgrade.

I started off the trigger with the events A unit owned by player 1,2,3, etc... finishes an upgrade.
Then the condition was going to be unit-type equals pre-upgraded tower


I don't know where to go from there. Thanks in advance.
 

bajaist

Member
Reaction score
4
Try something with this:
Trigger:
  • Actions
    • Set Percent[1] = (Random integer number between 1 and 100)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • (Percent[1] Greater than or equal to 0) and (Percent[1] Less than or equal to 10)
    • Then - Actions
    • Else - Actions


Where "Percent[1]" is Integer Variable. And be sure to uncheck "Use Fixed Random Seed" under "File/Preferences/TestMap".
 

Xan_Kriegor

I can change this now in User CP.
Reaction score
12
First off, the event Finishes an upgrade may be different than what you're thinking. I believe when it says upgrades it means things like Iron Forged Swords in ladder games, so you probably may not be using the right kind of event. I could be wrong on that since I haven't looked too deeply into upgrades, but that's my initial concern.

Try something with this:
Trigger:
  • Set Percent[1] = (Random integer number between 1 and 100)
    • (Percent[1] Greater than or equal to 0) and (Percent[1] Less than or equal to 10)
You're using an array variable there that doesn't need to be, so it'd just be Set Percent = (blah). Also, I don't think the Percent Greater than or equal to 0 check is necessary because the Less than or equal to 10 check covers it. It's previously set to somewhere between 1 and 100 so it can't be less than 0 anyway.

That aside, looking at how it was set up your special upgrade is going to go in the Then actions and normal upgrade is going in the Else actions.
 

bajaist

Member
Reaction score
4
You're using an array variable there that doesn't need to be, so it'd just be Set Percent = (blah).
Yes, thats right, as well as:
Also, I don't think the Percent Greater than or equal to 0 check is necessary because the Less than or equal to 10 check covers it.
Sorry i was in a hurry, just wanted to give Archenix something to work with :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top