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

#### Archenix

##### New Member
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.

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".

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.

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:
https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
• Ghan:
Need to try something
• Ghan:
Hopefully this won't cause problems.
• Ghan:
Hmm
• Ghan:
I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
• Ghan:
See how we like that.
• The Helper:
I do not see a way to go past the 1st page of posts on the forum though
• The Helper:
It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
• Ghan:
Yeah I'm not sure what the deal is with the pagination.
• Ghan:
It SHOULD be there so I think it might just be an artifact of having an older style.
• Ghan:
I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
• The Helper:
I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
• Ghan:
RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
• The Helper:
• The Helper:
What do you think Tom?
• tom_mai78101:
I will have to get used to this.
• tom_mai78101:
The latest news feed looks good
• The Helper:
I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
• The Helper:
This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/
• The Helper:
Happy Thursday!
• Ghan:
I'm not so sure, there's still a lot of Thursday left for it to become unhappy.
+3
• The Helper:
still a few hours
• The Helper:
Its Friday!!!!
+1
• Ghan:
Thursday 7/10 would Thursday again
+3